From: Andy Parkins <andyparkins@gmail.com>
To: git@vger.kernel.org
Cc: Nicolas Pitre <nico@cam.org>, Lars Hjemli <hjemli@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH 3/3] prevent HEAD reflog to be interpreted as current branch reflog
Date: Fri, 2 Feb 2007 16:11:03 +0000 [thread overview]
Message-ID: <200702021611.06029.andyparkins@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0702020955540.3021@xanadu.home>
On Friday 2007 February 02 15:13, Nicolas Pitre wrote:
> On Fri, 2 Feb 2007, Andy Parkins wrote:
> > Forgetting about detached heads for the moment,
>
> That is not the way to go about it. You cannot start forgetting about
> detached heads and come back to it afterwards like an afterthought.
I don't agree. To avoid confusing people the key thing should be consistency.
What holds true for HEAD in the non-detached case should hold true for the
detached case. Otherwise it's just another variable for the user to
remember.
> The exact same argument could be said if you did 1300 operations on a
> single branch, say master. What would master@{yesterday} tell you?
> What will it tell you one minute from now? Now suppose that you have
It doesn't matter - it will be on the same head, as time ticks by I will at
least find that master@{yesterday} ticks by linearly too. That is not the
case if HEAD@{yesterday} means "whatever HEAD pointed to yesterday". How am
I supposed to remember what it pointed to? Therefore what use is
HEAD@{yesterday}?
> only one branch and therefore HEAD reflog would be a duplicate of master
> reflog.
You misunderstand, I'm suggesting that reflogging HEAD is not the right thing
to do. Asking for HEAD's reflog should be the same as asking for the
pointed-to-branch's reflog.
Instead, the reflog should be kept for the "unnamed branch", which would jump
around each time you detached HEAD.
> Answer: it would carry the same kind of confusion as your example above.
I don't agree. HEAD is always "the branch I'm on now", even when it's
detached it's pointing at the branch I'm working on. It just happens that
that branch has no name.
> Then simply use @{15 minutes ago}. You'll even save yourself some
> typing! It is not like if you have to type HEAD for most operations
I'm not worried about the typing, or about the functionality. I think that
the functionality will be there in either of the proposed cases. I am
arguing which is the least confusing. The amount of typing should certainly
not be a factor in this case.
> anyway since HEAD is the likely default in most cases. So you may even
> forget that the HEAD entity exists and be just fine.
Yep; in my scenario that's true. One could completely forget about HEAD. In
your scenario that isn't the case, because I need to remember that when I'm
detached HEAD suddenly gets special powers to tell me about the detached
movements.
> But HEAD is still a moving pointer and we might want to know that it
> switched from one branch to another at some point. And the only way for
> that to be sensible is by having a separate reflog for HEAD that is the
> exact log of every operations you perform regardless of the actual
> branch you might be on.
I agree. I am arguing about nomenclature. There is no dispute that /that/
reflog (or equivalent) should exist. However, I don't believe it should
be "the log of HEAD" it should be "the log of the unnamed branch".
> HEAD _does_ get detached. It becomes loose in the air. It doesn't drag
Well, we're talking semantics now. HEAD becomes detached from a branch, but
it certainly isn't floating. It points at a particular point in the
repository.
HEAD is always a symref (despite what you say); it's just that when HEAD is
detached from all branches, there is no ref for it to point at, so we store
the ref in the file called HEAD. It's analogous to pointers in C:
HashType hash;
HashType *ref;
HashType **HEAD;
By sometimes treating HEAD as a ref, you break the model.
> pointer with it. And everything you do on top of a detached HEAD will
> be forgotten as soon as you leave it (and the eventual reflog for HEAD
> expires) if you don't attach it somehow with a tag or a new branch.
> There is no notion of a virtual branch at all, not technically, not
> conceptually either.
I disagree that there is no virtual branch. That is what HEAD is when it is
in detached mode. It looks just like a ref - HEAD holds a hash, refs hold a
hash - how is that not a virtual branch? I used the word "virtual" only
because it is not stored in refs/ and vanishes when you move back to a real
branch. Just because the virtual branch is stored in HEAD, I think it is
dangerous to thing of HEAD as being the thing that is logged - it is this
virtual branch that should be logged because that branch is always there and
can be tracked through time as a discrete entity. If you track HEAD itself,
then sometimes it will hold the same as a branch reflog, sometimes it will
hold unique data.
Perhaps this is just a product of my warped mental model of git. Obviously
you chaps who do the actual work get final say. Take the above with my usual
two cents of "I can't be sure of what I'm talking about" :-)
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE
andyparkins@gmail.com
next prev parent reply other threads:[~2007-02-02 16:11 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-01 17:33 [PATCH 3/3] prevent HEAD reflog to be interpreted as current branch reflog Nicolas Pitre
2007-02-01 19:13 ` Shawn O. Pearce
2007-02-01 20:58 ` Junio C Hamano
2007-02-01 21:29 ` Simon 'corecode' Schubert
2007-02-01 22:12 ` Nicolas Pitre
2007-02-01 22:17 ` Matthias Lederhofer
2007-02-01 22:29 ` [PATCH 4/3] provide a nice @{...} syntax to always mean the " Nicolas Pitre
2007-02-01 23:07 ` [PATCH 5/3], was " Johannes Schindelin
2007-02-01 23:21 ` [PATCH 6/3], was " Johannes Schindelin
2007-02-02 1:15 ` Junio C Hamano
2007-02-01 21:46 ` [PATCH 3/3] prevent HEAD reflog to be interpreted as " Nicolas Pitre
2007-02-02 10:31 ` Jakub Narebski
2007-02-02 10:42 ` Johannes Schindelin
2007-02-02 11:02 ` Lars Hjemli
2007-02-02 13:02 ` Andy Parkins
2007-02-02 14:55 ` Nicolas Pitre
2007-02-02 15:13 ` Nicolas Pitre
2007-02-02 16:11 ` Andy Parkins [this message]
2007-02-02 16:35 ` Simon 'corecode' Schubert
2007-02-02 17:19 ` Nicolas Pitre
2007-02-03 17:07 ` Mark Wooding
2007-02-03 17:54 ` Andy Parkins
2007-02-02 13:21 ` Jakub Narebski
2007-02-02 13:47 ` Simon 'corecode' Schubert
2007-02-02 19:40 ` Simon 'corecode' Schubert
2007-02-02 14:52 ` Nicolas Pitre
2007-02-02 15:39 ` Lars Hjemli
2007-02-05 11:11 ` Johannes Schindelin
2007-02-05 11:21 ` Shawn O. Pearce
2007-02-05 12:43 ` Johannes Schindelin
2007-02-05 23:11 ` Lars Hjemli
2007-02-02 13:08 ` Andy Parkins
2007-02-02 15:15 ` Rogan Dawes
2007-02-02 16:13 ` Andy Parkins
2007-02-03 3:04 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200702021611.06029.andyparkins@gmail.com \
--to=andyparkins@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=hjemli@gmail.com \
--cc=jnareb@gmail.com \
--cc=nico@cam.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).