git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Git <git@vger.kernel.org>,
	Brandon Williams <bwilliams.eng@gmail.com>
Subject: Re: [PATCH] refspec: make @ a valid refspec
Date: Tue, 24 Nov 2020 18:28:37 -0600	[thread overview]
Message-ID: <CAMP44s0F9TijOQ=JvosX_3z_F6wRtKe3gF=0NxrqucW4gAuzHQ@mail.gmail.com> (raw)
In-Reply-To: <CA+P7+xp_iTnkdbWoDSRZustvjk5BRJOPD=snae8D1Fe_uXqO7g@mail.gmail.com>

On Tue, Nov 24, 2020 at 5:47 PM Jacob Keller <jacob.keller@gmail.com> wrote:
>
> On Tue, Nov 24, 2020 at 3:14 PM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > Jacob Keller <jacob.keller@gmail.com> writes:
> >
> > >> Worse yet, @{4} does not refer to HEAD@{4} but refers to the 4-th
> > >> previous commit the current branch pointed at, so a mnemonic for the
> > >> end user to remember the distinction between the two is that a bare
> > >> "@" is different from HEAD, which is a total opposite X-<.
> > >>
> > >
> > > However, @{0} *does* refer to what is currently checked out, which
> > > would be head.. So in a sense @ meaning "the current branch" and
> > > applying @{0} would always be HEAD, no?
> >
> > Not really.
> >
> > It happens to hold true for @{0}, because by definition you couldn't
> > have been on a different branch than the current one when you made
> > the topmost commit on the current branch.  For @{1} and higher, it
> > is always "where was the current branch at N commits ago?" which is
> > different from "where was the HEAD at N commits ago?", unless you
> > always use a single branch and never switch away.
>
> Right, once you add anything greater than zero it breaks down.. but
> think about it a little differently: "@{N}" is sort of eliding the
> branch name, which means we use the current branch. "branch@" (if it
> were valid syntax) would be eliding the number which means "the most
> recent version of branch". Thus, eliding both and using just "@" would
> mean "the most recent version of the current branch", which cannot be
> anything other than HEAD.

Yes, but to me HEAD is supposed to mean "the current branch", so
"branch@{1}" and "HEAD@{1}" should be the same, and they are not. So
to me they are the other way around.

1. branch@{1}, HEAD@{1}, @@{1}: current branch 1 commit ago
2. @{1}: 1 commit ago in general

Since it's the opposite of what I would expect, I simply don't use
these notations.

-- 
Felipe Contreras

  reply	other threads:[~2020-11-25  0:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-22 16:46 [PATCH] refspec: make @ a valid refspec Felipe Contreras
2020-11-24  7:42 ` Jeff King
2020-11-24 20:01   ` Junio C Hamano
2020-11-24 22:01     ` Felipe Contreras
2020-11-24 22:45       ` Junio C Hamano
2020-11-24 22:52         ` Jacob Keller
2020-11-24 23:14           ` Junio C Hamano
2020-11-24 23:47             ` Jacob Keller
2020-11-25  0:28               ` Felipe Contreras [this message]
2020-11-25  0:30               ` Junio C Hamano
2020-11-25  0:14             ` Felipe Contreras
2020-11-25  0:09         ` Felipe Contreras
2020-12-04 22:20           ` Felipe Contreras

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMP44s0F9TijOQ=JvosX_3z_F6wRtKe3gF=0NxrqucW4gAuzHQ@mail.gmail.com' \
    --to=felipe.contreras@gmail.com \
    --cc=bwilliams.eng@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jacob.keller@gmail.com \
    --cc=peff@peff.net \
    /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.
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).