git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* specifying revision - how to enforce matching a tag/branch-name or revision only
@ 2019-06-20 14:32 Boettger, Heiko
  2019-06-20 22:54 ` Kyle Meyer
  2019-06-26  8:41 ` [PATCH/RFC] get_oid: new extended SHA-1 syntax to control resolution process Nguyễn Thái Ngọc Duy
  0 siblings, 2 replies; 11+ messages in thread
From: Boettger, Heiko @ 2019-06-20 14:32 UTC (permalink / raw)
  To: git@vger.kernel.org

Hi,

I discovered an interesting problem when using `git checkout` to which I couldn't find a good solution. We have an automatic system trying to checkout a branch only when it exists. To do so we check whether `git rev-parse` finds a commit for given branch name:

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

We saw a similar problem with disambiguation of tag and branch-name. If there any possibility to enforce that `git checkout` and other commands such `git rev-parse` handle a revision as a specific type (branch, tag, commit-id). Is there something like
`git checkout name@{branch}`  or `git checkout name@{tag}` similar to other rev-parse format such as  `branch@{upstream}`.

Best Regards

Heiko Böttger


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-07-01  0:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 14:32 specifying revision - how to enforce matching a tag/branch-name or revision only Boettger, Heiko
2019-06-20 22:54 ` Kyle Meyer
2019-06-21 15:16   ` Junio C Hamano
2019-06-25 11:43     ` Duy Nguyen
2019-06-25 14:35       ` AW: " Boettger, Heiko
2019-06-26  8:41 ` [PATCH/RFC] get_oid: new extended SHA-1 syntax to control resolution process Nguyễn Thái Ngọc Duy
2019-06-26 18:51   ` Junio C Hamano
2019-06-27  2:52     ` Duy Nguyen
2019-06-27 16:47       ` Junio C Hamano
2019-06-30  9:30   ` Jakub Narebski
2019-07-01  0:30     ` Duy Nguyen

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).