git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Maaartin <grajcar1@seznam.cz>
Cc: git@vger.kernel.org
Subject: Re: Commiting automatically (2)
Date: Tue, 21 Dec 2010 05:06:39 -0800 (PST)	[thread overview]
Message-ID: <m34oa7l1hq.fsf@localhost.localdomain> (raw)
In-Reply-To: <loom.20101221T092948-59@post.gmane.org>

Please try to not cull Cc list (use 'reply via email', if possible)

Maaartin <grajcar1@seznam.cz> writes:

> I let the snapshot point to the current head, which is where I get a problem now:
>
>   git show-ref HEAD
>
> returns nothing,
>
>   git show-ref --head
>
> returns HEAD and all branches and tags. Isn't it a bug? How can I get the HEAD 
> reference? I'm using git version 1.7.2.3 on cygwin.

You can use `git rev-parse --verify HEAD`, for example.  Generally
scripted commands (including those in contrib/examples/) are good
sources of inspiration.  Or if you want symbolic name, you can use
`git symbolic-ref HEAD` or `git rev-parse --symbolic-full-name HEAD`.

As for `git show-ref HEAD` - git-show-ref uses its own way of pattern
matching; in new enough version of git-show-ref manpage you can read
that:

  <pattern>...::

        Show references matching one or more patterns. Patterns are matched from
        the end of the full name, and only complete parts are matched, e.g.
        'master' matches 'refs/heads/master', 'refs/remotes/origin/master',
        'refs/tags/jedi/master' but not 'refs/heads/mymaster' nor
        'refs/remotes/master/jedi'.

So `git show-ref HEAD` would match 'refs/.../HEAD`, e.g. `refs/remotes/origin/HEAD`,
but not `HEAD` which is outside `refs/`.

I tripped over strange git-show-ref <pattern> semantic too.

P.S. there is also git-for-each-ref.
-- 
Jakub Narebski
Poland
ShadeHawk on #git

  reply	other threads:[~2010-12-21 13:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-19  8:29 Commiting automatically (2) Maaartin
2010-12-19 15:08 ` Taylor Hedberg
2010-12-19 18:36   ` Jonathan Nieder
2010-12-19 20:17     ` Jonathan Nieder
2010-12-20  5:12     ` Maaartin
2010-12-19 19:32 ` Junio C Hamano
2010-12-20  5:46   ` Maaartin
2010-12-20  7:33     ` Enrico Weigelt
2010-12-21  8:36       ` Maaartin
2010-12-21 13:06         ` Jakub Narebski [this message]
     [not found]           ` <4D1190A6.4070201@seznam.cz>
2010-12-27 12:04             ` Jakub Narebski
2011-01-03  0:39               ` Maaartin-1
2011-01-03 17:34                 ` Jakub Narebski

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=m34oa7l1hq.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=grajcar1@seznam.cz \
    /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).