Skip to content

Commit 0881312

Browse files
luked99gitster
authored andcommitted
git-p4: unshelve into refs/remotes/p4-unshelved, not refs/remotes/p4/unshelved
The branch detection code looks for branches under refs/remotes/p4/... and can end up getting confused if there are unshelved changes in there as well. This happens in the function p4BranchesInGit(). Instead, put the unshelved changes into refs/remotes/p4-unshelved/<N>. Signed-off-by: Luke Diamand <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0742b7c commit 0881312

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Documentation/git-p4.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,21 +174,21 @@ $ git p4 submit --update-shelve 1234 --update-shelve 2345
174174
Unshelve
175175
~~~~~~~~
176176
Unshelving will take a shelved P4 changelist, and produce the equivalent git commit
177-
in the branch refs/remotes/p4/unshelved/<changelist>.
177+
in the branch refs/remotes/p4-unshelved/<changelist>.
178178

179179
The git commit is created relative to the current origin revision (HEAD by default).
180180
If the shelved changelist's parent revisions differ, git-p4 will refuse to unshelve;
181181
you need to be unshelving onto an equivalent tree.
182182

183183
The origin revision can be changed with the "--origin" option.
184184

185-
If the target branch in refs/remotes/p4/unshelved already exists, the old one will
185+
If the target branch in refs/remotes/p4-unshelved already exists, the old one will
186186
be renamed.
187187

188188
----
189189
$ git p4 sync
190190
$ git p4 unshelve 12345
191-
$ git show refs/remotes/p4/unshelved/12345
191+
$ git show p4-unshelved/12345
192192
<submit more changes via p4 to the same files>
193193
$ git p4 unshelve 12345
194194
<refuses to unshelve until git is in sync with p4 again>

git-p4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3956,7 +3956,8 @@ def __init__(self):
39563956
]
39573957
self.verbose = False
39583958
self.noCommit = False
3959-
self.destbranch = "refs/remotes/p4/unshelved"
3959+
self.destbranch = "refs/remotes/p4-unshelved"
3960+
self.origin = "p4/master"
39603961

39613962
def renameBranch(self, branch_name):
39623963
""" Rename the existing branch to branch_name.N

t/t9832-unshelve.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ EOF
5454
cd "$git" &&
5555
change=$(last_shelved_change) &&
5656
git p4 unshelve $change &&
57-
git show refs/remotes/p4/unshelved/$change | grep -q "Further description" &&
58-
git cherry-pick refs/remotes/p4/unshelved/$change &&
57+
git show refs/remotes/p4-unshelved/$change | grep -q "Further description" &&
58+
git cherry-pick refs/remotes/p4-unshelved/$change &&
5959
test_path_is_file file2 &&
6060
test_cmp file1 "$cli"/file1 &&
6161
test_cmp file2 "$cli"/file2 &&
@@ -88,7 +88,7 @@ EOF
8888
cd "$git" &&
8989
change=$(last_shelved_change) &&
9090
git p4 unshelve $change &&
91-
git diff refs/remotes/p4/unshelved/$change.0 refs/remotes/p4/unshelved/$change | grep -q file3
91+
git diff refs/remotes/p4-unshelved/$change.0 refs/remotes/p4-unshelved/$change | grep -q file3
9292
)
9393
'
9494

0 commit comments

Comments
 (0)