Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 4/4] builtin-remote: add set-head verb

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:46:10

Junio C Hamano [off-list ref] writes:
Also it may be better to be more explicit about both the syntax and the
semantics of `<branch>`.  Do you expect "refs/remotes/<name>/master" or
just "master" (I assume the latter)?  Is it an error if the branch does
not exist in the specified hierarchy?  Can you force to set to a branch
that does not exist in your tracking side (yet) but you know exists on the
remote side already?
A few things I forgot (and before I go to bed).

If remotes/<name>/HEAD already points at a branch frotz, and you peek the
remote (i.e. you do not actually run "fetch" to download objects, but just
"ls-remote" it) and find out that "HEAD" does not point at the same commit
as "frotz" but it now points at the same commit as another branch
"nitfol", you probably would want to update it to point at "nitfol", but
it was unclear from the description in the documentation if this option
was meant to perform this kind fo update, or only to set a missing HEAD.

If you meant to do an update, there is one thing to watch out for when you
reuse the logic used by clone.  It favors "master" if more than one
branches point at the same commit as HEAD.  You need to customize it to
favor the one that the HEAD points at on the local side before you start
(iow, try to keep the current value when you can).

For example, if it points at "frotz" locally when the command was started,
and you found out that HEAD now points at the commit at the tip of "frotz"
and "master" branches by peeking, you do not want to repoint HEAD from
"frotz" to "master".
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help