Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix annoying "fatal: bad revision '^master'" git error
On some buildbots and friends, we don't have remotes as you normally think of them. Provide a fallback for $origin in that case.
- Loading branch information
a4f4ce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contiuation of discussion in #8731 (comment)
cc: @staticfloat @tkelman
The intention when I wrote this, was that
$origin
should be empty when I couldn't find a reasonable remote. If the search for remote turns up empty, I assumed thatorigin/master
would bejust asinvalidas, and that there were some slim chance that the user would have a reasonablemaster
master
branch that we could use as a reference.a4f4ce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that is the case, then we need to alter line 62. It fails when it is passed just
^master
. Apparently,^origin/master
is valid, but^master
isn't?a4f4ce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^master
is valid for me, so there seems to be something strange with your checkout, which makes it hard for me to debug. Do you clone without creating a localmaster
branch?a4f4ce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. It works on my local machine as well. That's strange. I wonder if this was because Travis was using an old version of
git
at one point in time. The error didn't break anything except the fork distance calculation, so I'm willing to revert this and see if I can track down further what circumstances cause it to arise, if you like.a4f4ce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we add more code to handle more conditions, we have two options when the config parsing to find the official remote fails:
master
branch (my approach)origin
remote (your approach)Both seems equally reasonable, and travis has a preference, so that's probably the best option.
a4f4ce7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One case in which I've seen funny git errors on buildbots is due to shallow cloning, if you're working in a branch and you accumulate a whole bunch of small commits so the shallow clone doesn't contain anything that's present upstream. But I doubt that was the same failure case that led to @staticfloat making this change.