All of lore.kernel.org
 help / color / mirror / Atom feed
* git checkout -b refs/master origin/master
@ 2021-07-09 12:40 Martin
  2021-07-09 14:56 ` Felipe Contreras
  0 siblings, 1 reply; 2+ messages in thread
From: Martin @ 2021-07-09 12:40 UTC (permalink / raw)
  To: git

Just curious..

"refs/master" is allowed as local branch name (git checkout / git branch 
/ git switch)

Is that intentionally allowed?

  git for-each-ref
6faf346455d0a024cb1edf2d64fc4c42b450c53d commit refs/heads/refs/master

  git for-each-ref --format="ref=%(refname)"
ref=refs/heads/refs/master

Especially the effect on
git for-each-ref --format="ref=%(refname:lstrip=-1)"
master

You only get part of the branch name.
Because "lstrip" does not distinguish between the / as separator in the 
refs, and the "/" as part of the name.

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

* RE: git checkout -b refs/master origin/master
  2021-07-09 12:40 git checkout -b refs/master origin/master Martin
@ 2021-07-09 14:56 ` Felipe Contreras
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Contreras @ 2021-07-09 14:56 UTC (permalink / raw)
  To: Martin, git

Martin wrote:
> Especially the effect on
> git for-each-ref --format="ref=%(refname:lstrip=-1)"
> master

It's probably better to do refname:lstrip=2.

> You only get part of the branch name.
> Because "lstrip" does not distinguish between the / as separator in the 
> refs, and the "/" as part of the name.

That shouldn't matter. I use 'fc/area/topic' as names of my branches,
and I know Junio uses similar names: '<contributor>/topic'.

-- 
Felipe Contreras

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

end of thread, other threads:[~2021-07-09 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 12:40 git checkout -b refs/master origin/master Martin
2021-07-09 14:56 ` Felipe Contreras

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.