Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge procedure creates bogus Perforce branch locations #96

Closed
rptb1 opened this issue Jan 7, 2023 · 0 comments · Fixed by #97
Closed

Merge procedure creates bogus Perforce branch locations #96

rptb1 opened this issue Jan 7, 2023 · 0 comments · Fixed by #97
Labels
git-migration Project migration from Ravenbrook internal Perforce infrastructure to public git repo optional Will cause failures / of benefit. Worth assigning resources. process To do with process or procedure

Comments

@rptb1
Copy link
Member

rptb1 commented Jan 7, 2023

At some point we gained a bogus top-level directory in Perforce at //info.ravenbrook.com/project/mps/save-errno-win32. How'd that happen? It's something that's very hard to correct. How do we prevent it happening again?

Basically, this happened because a branch was pushed that did not conform to the branch/DATE/TOPIC naming convention. Git Fusion is mapping branch names to Perforce directories relative to //info.ravenbrook.com/project/mps, so if a branch is pushed called "foo" it'll end up at //info.ravenbrook.com/project/mps/foo/...

Here's how I found out what happened and my hypothesis of the steps that led to this.

The branch was created by Git Fusion and changes within it belong to the placeholder user "unknown_git":

$ p4 changes save-errno-win32/...
Change 197885 on 2021/08/08 by unknown_git@git-fusion--temp-perforce-mps-public-8299bb4a-f83a-11eb-a758-00163e71ffc3 'Fixed typos in the test/functio'
Change 197884 on 2021/08/08 by unknown_git@git-fusion--temp-perforce-mps-public-8299bb4a-f83a-11eb-a758-00163e71ffc3 'Save and restore GetLastError()'
Change 197883 on 2021/08/08 by unknown_git@git-fusion--temp-perforce-mps-public-8299bb4a-f83a-11eb-a758-00163e71ffc3 'Added a test case for GitHub is'
Change 197882 on 2021/08/08 by git-fusion-user@git-fusion--temp-perforce-mps-public-8299bb4a-f83a-11eb-a758-00163e71ffc3 'Git Fusion branch management  I'

When Git Fusion creates a branch like this, it updates the configuration for the repo, so we can track it down there:

$ p4 annotate -c //.git-fusion/repos/mps-public/p4gf_config | grep save-errno-win32
197888: git-branch-name = save-errno-win32
...
$ p4 changes //...@197886,197888
Change 197888 on 2021/08/08 by git-fusion-user@git-fusion--perforce-8226a998-f83a-11eb-8966-00163e71ffc3 'Update 'p4gf_config'. '
Change 197887 on 2021/08/08 by git-fusion-user@git-fusion--perforce-8226a998-f83a-11eb-8966-00163e71ffc3 'Git Fusion 'mps-public' copied '
Change 197886 on 2021/08/08 by gdr@git-fusion--temp-perforce-mps-public-82b3ee86-f83a-11eb-b986-00163e71ffc3 'Merge branch 'save-errno-win32''

So we can see that this was caused by a merge of a third-party pull request by @gareth-rees :

$ p4 describe -s 197886
Change 197886 by gdr@git-fusion--temp-perforce-mps-public-82b3ee86-f83a-11eb-b986-00163e71ffc3 on 2021/08/08 12:19:50

  Merge branch 'save-errno-win32' from Filip Strömbäck.

  Imported from Git
   Author: Gareth Rees [<gdr@garethrees.org>](mailto:gdr@garethrees.org) 1628421098 +0100  (2021-08-08 12:11:38+01:00)
   Committer: Gareth Rees [<gdr@garethrees.org>](mailto:gdr@garethrees.org) 1628421098 +0100 (2021-08-08 12:11:38+01:00)
   sha1: 86a528d1cdee81ecbf9365e3db7a65b1a3aaa05b
   push-state: complete
   parent-changes: cb4051bd02a61cc75927bb28aa4d2643a848c3eb=[197876, 197878]/8360988487490952f6edae36b70c1bba00fe6d2f=[197885]

Affected files ...

... //info.ravenbrook.com/project/mps/master/code/protw3.c#31 edit
... //info.ravenbrook.com/project/mps/master/design/thread-manager.txt#26 edit
... //info.ravenbrook.com/project/mps/master/test/function/237.c#1 add

This explains the "unknown_git" changes: they were made by @fstromback .

@fstromback's branch was imported into the git repo and can be see at https://github.com/Ravenbrook/mps/tree/save-errno-win32. How'd that happen?

There is no pull request by @fstromback by searching https://github.com/Ravenbrook/mps/pulls?q=is%3Apr+fstromback

This is where we can see flaws in GitHub's system. How do we track this down? Searching for a branch name in the pull requests does not reveal them. (I tested with some known ones.) I just had to make some guesses and found #62

That pull request resulted in a merge of a branch from a fork of the MPS at https://github.com/fstromback/mps/tree/save-errno-win32 .

Somehow (probably GitHub's default behaviour via the GUI) this created a branch of the same name in Ravenbrook's repo at https://github.com/Ravenbrook/mps/tree/save-errno-win32.

From there I think @gareth-rees followed his procedure and at step 7 did git push ravenbrook master "$BRANCH” at which point Git Fusion created //info.ravenbrook.com/project/mps/save-errno-win32.

@rptb1 rptb1 added git-migration Project migration from Ravenbrook internal Perforce infrastructure to public git repo process To do with process or procedure labels Jan 8, 2023
@rptb1 rptb1 linked a pull request Jan 11, 2023 that will close this issue
@rptb1 rptb1 added the optional Will cause failures / of benefit. Worth assigning resources. label Jan 15, 2023
@rptb1 rptb1 added this to the Perforce Polarity milestone Jan 16, 2023
@rptb1 rptb1 closed this as completed in #97 Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
git-migration Project migration from Ravenbrook internal Perforce infrastructure to public git repo optional Will cause failures / of benefit. Worth assigning resources. process To do with process or procedure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant