1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-02 15:16:11 +02:00

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>
This commit is contained in:
Johannes Schindelin 2018-04-25 14:29:16 +02:00 committed by Junio C Hamano
parent 24293359cc
commit a9be29c981
2 changed files with 16 additions and 1 deletions

3
refs.c
View File

@ -600,7 +600,8 @@ int dwim_log(const char *str, int len, struct object_id *oid, char **log)
static int is_per_worktree_ref(const char *refname)
{
return !strcmp(refname, "HEAD") ||
starts_with(refname, "refs/bisect/");
starts_with(refname, "refs/bisect/") ||
starts_with(refname, "refs/rewritten/");
}
static int is_pseudoref_syntax(const char *refname)

View File

@ -176,4 +176,18 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
EOF
'
test_expect_success 'refs/rewritten/* is worktree-local' '
git worktree add wt &&
cat >wt/script-from-scratch <<-\EOF &&
label xyz
exec GIT_DIR=../.git git rev-parse --verify refs/rewritten/xyz >a || :
exec git rev-parse --verify refs/rewritten/xyz >b
EOF
test_config -C wt sequence.editor \""$PWD"/replace-editor.sh\" &&
git -C wt rebase -i HEAD &&
test_must_be_empty wt/a &&
test_cmp_rev HEAD "$(cat wt/b)"
'
test_done