git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francis Moreau <francis.moro@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Is current HEAD pointing at a given revision ?
Date: Tue, 14 Jun 2011 21:17:39 +0200	[thread overview]
Message-ID: <BANLkTikMQxEFEB0wMV0T6DfCFWiiU4ukmg@mail.gmail.com> (raw)
In-Reply-To: <201106141817.23585.jnareb@gmail.com>

On Tue, Jun 14, 2011 at 6:17 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> Francis Moreau wrote:
>> On Tue, Jun 14, 2011 at 11:00 AM, Jakub Narebski <jnareb@gmail.com> wrote:
>> > Francis Moreau <francis.moro@gmail.com> writes:
>> >
>> > > I have a given revision (tag, sha1 ...) and I'd like to know if that
>> > > revisions corresponds to what the current HEAD is pointing at.
>> > >
>> > > Could anybody give me some advices for achieving this ?
>> >
>> > If you want to know if given revision (or ref) points at the same
>> > thing as HEAD, you can use
>> >
>> >  [ "$(git rev-parse HEAD)" = "$(git rev-parse $ref^{commit})" ]
>> >
>> > or something like that.  The '^{commit}' is here in case $ref points
>> > only indirectly to commit, via a tag object.
>> >
>>
>> I see thanks.
>>
>> I'm not sure what the ^{commit} is for because in the case of tag
>> object, git-rev-parse seems to work fine without the suffix:
>>
>> git rev-parse v2.6.39
>> 8b0753a3df28c21b0570fa21362c5f1b3b4f59bf
>>
>> This is in a kernel git repository
>
> But that is the SHA-1 id of a _tag object_, not of commit (revision)
> it points to. '^{}' means peel to not tag, '^{commit}' means peel to
> commit.
>

Oh I see now, thanks a lot !

-- 
Francis

      reply	other threads:[~2011-06-14 19:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14  6:59 Is current HEAD pointing at a given revision ? Francis Moreau
2011-06-14  9:00 ` Jakub Narebski
2011-06-14 15:56   ` Francis Moreau
2011-06-14 16:17     ` Jakub Narebski
2011-06-14 19:17       ` Francis Moreau [this message]

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=BANLkTikMQxEFEB0wMV0T6DfCFWiiU4ukmg@mail.gmail.com \
    --to=francis.moro@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    /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).