git-p4: place temporary refs used for branch import under refs/git-p4-tmp
authorLars Schneider <larsxschneider@gmail.com>
Wed, 29 Jun 2016 07:35:27 +0000 (09:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Jul 2016 22:28:16 +0000 (15:28 -0700)
Git-P4 used to place temporary refs under "git-p4-tmp". Since 3da1f37
Git checks that all refs are placed under "refs". Instruct Git-P4 to
place temporary refs under "refs/git-p4-tmp". There are no backwards
compatibility considerations as these refs are transient.

Use "git show-ref --verify" to check the (non-)existience of the refs
instead of file checks assuming the file-based ref backend.

All refs under "refs" are shared across all worktrees. This is not
desired for temporary Git-P4 refs and will be adressed in a later patch.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Reviewed-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py
t/t9801-git-p4-branch.sh
index b6593cf9a19144650cc476fae0243140f4c0a8bb..6b252df816752be640021fad95e1ed720987bf03 100755 (executable)
--- a/git-p4.py
+++ b/git-p4.py
@@ -2274,7 +2274,7 @@ def __init__(self):
         self.useClientSpec_from_options = False
         self.clientSpecDirs = None
         self.tempBranches = []
-        self.tempBranchLocation = "git-p4-tmp"
+        self.tempBranchLocation = "refs/git-p4-tmp"
         self.largeFileSystem = None
 
         if gitConfig('git-p4.largeFileSystem'):
index 0aafd03334125d1af23acdff3f396b1bdabaf6c1..6a86d6996b97de0bed0503021b76b33db8441029 100755 (executable)
@@ -300,7 +300,7 @@ test_expect_success 'git p4 clone complex branches' '
                test_path_is_file file2 &&
                test_path_is_file file3 &&
                ! grep update file2 &&
-               test_path_is_missing .git/git-p4-tmp
+               test_must_fail git show-ref --verify refs/git-p4-tmp
        )
 '
 
@@ -352,7 +352,7 @@ test_expect_success 'git p4 sync changes to two branches in the same changelist'
                test_path_is_file file2 &&
                test_path_is_file file3 &&
                ! grep update file2 &&
-               test_path_is_missing .git/git-p4-tmp
+               test_must_fail git show-ref --verify refs/git-p4-tmp
        )
 '