git icon indicating copy to clipboard operation
git copied to clipboard

git-p4: fix issue with perforce branch synchronized multiple times.

Open 0xfk0 opened this issue 3 years ago • 1 comments

Perforce branch might be sync'ed multiple times with different revision numbers (by the command "git p4 sync --branch=NAME //perforce/path...")

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).

Thanks for taking the time to contribute to Git! Please be advised that the Git community does not use github.com for their contributions. Instead, we use a mailing list ([email protected]) for code submissions, code reviews, and bug reports. Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/) to conveniently send your Pull Requests commits to our mailing list.

Please read the "guidelines for contributing" linked above!

0xfk0 avatar Mar 18 '22 19:03 0xfk0

Thanks for taking the time to contribute to Git! Please be advised that the Git community does not use github.com for their contributions. Instead, we use a mailing list ([email protected]) for code submissions, code reviews, and bug reports. Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/) to conveniently send your Pull Requests commits to our mailing list.

Please read the "guidelines for contributing" linked above!

@kfrolov could you please remove this before /submiting?

dscho avatar Mar 21 '22 10:03 dscho