git-p4: support git worktrees
git-p4 would attempt to find the git directory using its own specific code, which did not know about git worktrees. Rework it to use "git rev-parse --git-dir" instead. Add test cases for worktree usage and specifying git directory via --git-dir and $GIT_DIR. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8d7a455ed5
commit
378f7be1e7
@ -257,6 +257,26 @@ test_expect_success 'submit from detached head' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submit from worktree' '
|
||||
test_when_finished cleanup_git &&
|
||||
git p4 clone --dest="$git" //depot &&
|
||||
(
|
||||
cd "$git" &&
|
||||
git worktree add ../worktree-test
|
||||
) &&
|
||||
(
|
||||
cd "$git/../worktree-test" &&
|
||||
test_commit "worktree-commit" &&
|
||||
git config git-p4.skipSubmitEdit true &&
|
||||
git p4 submit
|
||||
) &&
|
||||
(
|
||||
cd "$cli" &&
|
||||
p4 sync &&
|
||||
test_path_is_file worktree-commit.t
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
Reference in New Issue
Block a user