files-backend: make reflog iterator go through per-worktree reflog
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 23 Aug 2017 12:37:00 +0000 (19:37 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Aug 2017 21:57:56 +0000 (14:57 -0700)
commit944b4e3013d6e21b1ecd2f2579395341f2cc8b7b
tree85c0edfc4b223a251324b7ece3023cd25152f378
parentd0c39a49ccb5dfe7feba4325c3374d99ab123c59
files-backend: make reflog iterator go through per-worktree reflog

refs/bisect is unfortunately per-worktree, so we need to look in
per-worktree logs/refs/bisect in addition to per-repo logs/refs. The
current iterator only goes through per-repo logs/refs.

Use merge iterator to walk two ref stores at the same time and pick
per-worktree refs from the right iterator.

PS. Note the unsorted order of for_each_reflog in the test. This is
supposed to be OK, for now. If we enforce order on for_each_reflog()
then some more work will be required.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c
t/t1407-worktree-ref-store.sh