git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Carlos Martín Nieto" <cmn@elego.de>
Cc: git@vger.kernel.org
Subject: Re: git diff <file> HEAD^:<file> error message
Date: Wed, 11 Jan 2012 18:26:30 -0800	[thread overview]
Message-ID: <7vr4z54pwp.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20120111111831.GB15232@beez.lab.cmartin.tk> ("Carlos Martín Nieto"'s message of "Wed, 11 Jan 2012 12:18:31 +0100")

Carlos Martín Nieto <cmn@elego.de> writes:

> I was trying to figure out why running
>
>    git diff HEAD^:RelNotes RelNotes
>
> gives the expected output (on maint it tells me that the stable
> version changed from 1.7.8.3 to 1.7.8.4) but swapping the arguments
> doesn't.
>
>    git diff RelNotes HEAD^:RelNotes
>
> doesn't show the opposite patch ...

That comes from the general argument parsing rules of Git, namely, global
options (e.g. --paginate) first, then subcommand name, followed by dashed
options, revs and finally the paths. Once you give "RelNotes", which
cannot be a rev, you cannot give a rev.

We _could_ special case the rule for "diff", but we simply didn't bother,
as the resulting code (and the implications of special casing) would be
too ugly to live to support such a corner case usage, especially when you
could always say "-R" to reverse the output.

  reply	other threads:[~2012-01-12  2:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11 11:18 git diff <file> HEAD^:<file> error message Carlos Martín Nieto
2012-01-12  2:26 ` Junio C Hamano [this message]
2012-01-12 10:31   ` Carlos Martín Nieto
2012-01-12 17:34 ` Nguyen Thai Ngoc Duy

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=7vr4z54pwp.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=cmn@elego.de \
    --cc=git@vger.kernel.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).