sequencer: make refs generated by the `label` command worktree-local

This allows for rebases to be run in parallel in separate worktrees (think: interrupted in the middle of one rebase, being asked to perform a different rebase, adding a separate worktree just for that job). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Apr 25, 2018 at 14:29 UTC a9be29c9817067128a2818a609450db6e6722ffd
2 files changed +16 -1
refs.c
+2 -1
@@ -600,7 +600,8 @@ int dwim_log(const char *str, int len, struct object_id *oid, char **log)
600 static int is_per_worktree_ref(const char *refname)
601 {
602 return !strcmp(refname, "HEAD") ||
603 - starts_with(refname, "refs/bisect/");
603 + starts_with(refname, "refs/bisect/") ||
604 + starts_with(refname, "refs/rewritten/");
605 }
606
607 static int is_pseudoref_syntax(const char *refname)
t/t3430-rebase-merges.sh
+14
@@ -176,4 +176,18 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
176 EOF
177 '
178
179 +test_expect_success 'refs/rewritten/* is worktree-local' '
180 + git worktree add wt &&
181 + cat >wt/script-from-scratch <<-\EOF &&
182 + label xyz
183 + exec GIT_DIR=../.git git rev-parse --verify refs/rewritten/xyz >a || :
184 + exec git rev-parse --verify refs/rewritten/xyz >b
185 + EOF
186 +
187 + test_config -C wt sequence.editor \""$PWD"/replace-editor.sh\" &&
188 + git -C wt rebase -i HEAD &&
189 + test_must_be_empty wt/a &&
190 + test_cmp_rev HEAD "$(cat wt/b)"
191 +'
192 +
193 test_done