Fix git-p4 detection after git gc

Review Request #12257 — Created April 25, 2022 and submitted

Information

RBTools
master

Reviewers

The detection of git-p4 repositories is based on the presence of the
`remotes/p4/master` file. Sometimes after a `git gc` this physical file
on the filesystem can be removed by git although the ref `p4/master`
still exists (and it is of course, stil a git-p4 repo). The result is
incomprehehsible backtraces and users are confused why their repo
suddently stopped working.

The solution is to use `git show-ref` instead. Note this is still not
bulletproof as in theory the git-p4 ref could be anything, but this is
an improvement on status quo.

in a git-p4 repo that has been around for a long time and had many commits etc, git gc. (this often happens unexpectedly/automatically). Observe that .git/refs/remotes/p4/master does not exist. rbt post from that repo and see that it works (PASS)> previously, and obscure stacktrace was printed (becauae repo detection failed to correctly identify it as git-p4).

Summary ID
Fix git-p4 detection after git gc
The detection of git-p4 repositories is based on the presence of the `remotes/p4/master` file. Sometimes after a `git gc` this physical file on the filesystem can be removed by git although the ref `p4/master` still exists (and it is of course, stil a git-p4 repo). The result is incomprehehsible backtraces and users are confused why their repo suddently stopped working. The solution is to use `git show-ref` instead. Note this is still not bulletproof as in theory the git-p4 ref could be anything, but this is an improvement on status quo.
8a9528ca4bd420218261067d662c751fbcc2af58
chipx86
  1. Ship It!
  2. 
      
puremourning
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (e99a9fa)
Loading...