From: "Carlos Martín Nieto" <cmn@elego.de>
To: git@vger.kernel.org
Subject: git diff <file> HEAD^:<file> error message
Date: Wed, 11 Jan 2012 12:18:31 +0100 [thread overview]
Message-ID: <20120111111831.GB15232@beez.lab.cmartin.tk> (raw)
[-- Attachment #1: Type: text/plain, Size: 1434 bytes --]
Hello,
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 but tells me that RelNotes doesn't
exist in HEAD^ which is clearly a lie (it sounds like it's a
misunderstanding on git's part, but it's certainly not the truth). In
both cases, verify_filename gets called and tries to stat both
HEAD^:RelNotes and RelNotes. In the "bad" (latter) case, after it
fails to find a file named "HEAD^:RelNotes" it ends up calling
diagnose_invalid_sha1_path which is not correct according to the
command just before the function
/* Must be called only when object_name:filename doesn't exist. */
It looks like get_sha1_with_context_1 gets confused because we pass it
a filename which looks like object_name:filename even though we
earlier parsed it simply as a filename which happens to have a colon
inside it.
Another issue is that I'm not sure that the error message should even
get shown. The documentation tells me that I should be able to compare
two random blobs, though this mode doesn't seem to work if the first
argument is a file. I realise that a file isn't a blob, but since
specifying the arguments the other way around (blob, file) does work,
it looks to me like it should as well.
cmn
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next reply other threads:[~2012-01-11 11:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-11 11:18 Carlos Martín Nieto [this message]
2012-01-12 2:26 ` git diff <file> HEAD^:<file> error message Junio C Hamano
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=20120111111831.GB15232@beez.lab.cmartin.tk \
--to=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).