Re: specifying revision - how to enforce matching a tag/branch-name or revision only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kyle Meyer <kyle@xxxxxxxxxx> writes:

>> git rev-parse "${BRANCH_NAME}"  || git rev-parse "refs/remotes/${UPSTREAM}/${BRANCH_NAME}"
>>
>> Unfortunately somebody used the branch name "add-gcc10" and `git rev-parse` which didn't exist on one repository. However `git rev-parse`
>> also supports to parse the `git-describe` format which resulted in checkout a commit starting with "cc10".
>
> Can't you prepend "refs/heads/" to BRANCH_NAME to disambiguate?

Yes, that is the kosher way for most commands.  

It gets a bit tricky for "checkout <branch-or-committish>" that
changes its behaviour (a local branch is checked out and the next
commit extends it, other committishes like tags and remote-tracking
branch tips are checked out on a detached HEAD), and has special
rules for a "${BRANCH_NAME}" that is both the name of a local branch
and something else.

Hopefully (Duy Cc'ed) "git switch" would improve the situation.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux