]> git.ipfire.org Git - thirdparty/git.git/commit - git-p4.py
git-p4: fix issue with multiple perforce remotes
authorKirill Frolov <k.frolov@samsung.com>
Mon, 21 Mar 2022 12:43:22 +0000 (12:43 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Mar 2022 21:03:36 +0000 (14:03 -0700)
commit944db25c603ec56aeea95c193a4b74eb5da5d90d
tree8185ac03094973738822caa06a11f22232fd8e16
parent74cc1aa55f30ed76424a0e7226ab519aa6265061
git-p4: fix issue with multiple perforce remotes

Single perforce branch might be sync'ed multiple times with different
revision numbers, so it will be seen to Git as complete different
commits. This can be done by the following command:

  git p4 sync --branch=NAME //perforce/path...

It is assumed, that this command applied multiple times and
peforce repository changes between command invocations.

In such situation, git p4 will see multiple perforce branches with
same name and different revision numbers. The problem is that to make
a shelve, git-p4 script will try to find "origin" branch, if not
specified in command line explicitly. And previously script selected
any branch with same name and don't mention particular revision number.
Later this may cause failure of the command "git diff-tree -r $rev^ $rev",
so shelve can't be created (due to wrong origin branch/commit).

This commit fixes the heuristic by which git p4 selects origin branch:
first it tries to select branch with same perforce path and perforce
revision, and if it fails, then selects branch with only same perforce
path (ignoring perforce revision number).

Signed-off-by: Kirill Frolov <k.frolov@samsung.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4.py