All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Matthieu Moy" <Matthieu.Moy@grenoble-inp.fr>,
	git@vger.kernel.org,
	"Clément Poulain" <clement.poulain@ensimag.imag.fr>,
	"Diane Gasselin" <diane.gasselin@ensimag.imag.fr>,
	"Axel Bonnet" <axel.bonnet@ensimag.imag.fr>
Subject: Re: [PATCH] git-cat-file.txt: Document --textconv
Date: Fri, 25 Jun 2010 11:04:10 +0200	[thread overview]
Message-ID: <4C24710A.7000506@drmicha.warpmail.net> (raw)
In-Reply-To: <7vocf0chwa.fsf@alter.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 24.06.2010 22:09:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> Wait a minute:
>>
>> git show HEAD:path >a
>> git show :path >b
>> diff a b
>>
>> Oh no! We've been having this all along. This is bad but probably
>> unchangeable.
> 
> There is nothing "bad" about this, unless you forgot about the index.

I'll object to the "unless"...

> The comparision target of "git diff" defaults to the index, not HEAD, if
> you want other precedents.

...but agree here. Do we have a logic/principle which determines whether
"empty ref" means HEAD or INDEX (which doesn't exist, of course)?

> 
> If you kept telling others that "everything defaults to HEAD", it is
> indeed bad, but that can be fixed ;-).

I'll promise to be more careful ;-)

But I still think the situation is unfortunate:

rm -Rf tt && mkdir tt && cd tt && git init
echo a >f && git add f && git commit -m a
echo b >f && git add f && git commit -m b
echo c >f && git add f && echo d >f
for c in "show --oneline f" "show --oneline :f" "diff f"; do
  echo "#git $c"
  git $c
done

produces

#git show --oneline f
3b977dc b
diff --git a/f b/f
index 7898192..6178079 100644
--- a/f
+++ b/f
@@ -1 +1 @@
-a
+b
#git show --oneline :f
c
#git diff f
diff --git i/f w/f
index f2ad6c7..4bcfe98 100644
--- i/f
+++ w/f
@@ -1 +1 @@
-c
+d

[I don't need "f" with "show" or "diff" nor "--oneline" with ":f", of
course.]

I know why it does that, but I think it's confusing that "show :f" does
not show the version of f which is the endpoint of the comparison for
the diff shown by "git show", which is the only parameter to show.

diff is different in that it really has two parameters for the two
points of comparison (which default to INDEX and WORKTREE), and by
giving one you specify the startpoint.

> 
>> I was going with the usage line, but you are right: <a>:<b> makes more
>> sense semantically and is clearer.
>>>
>>> What about this:
>>>
>>> --textconv:: 
>>> 	Show the content as transformed by a textco+nv filter. In this
>>> 	case, <object> has be of the form <treeish>:<path>, or :<path>
>>> 	to run the filter on the file <path> stored in the index.
>>
>> I'll be more mathematically stubborn about "file", see v2;)
> 
> If you want to be mathematically stubborn, then I think you should prefer
> <path> in a context like this, since <treeish>:<path> is the notation to
> reach to a <blob> inside the treeish.  <file> is merely one of the two
> possible manifestations of <blob> when it is accessed through the tree
> that immediately contains it (other being <symlink>).
> 
> Most importantly, "cat-file blob <blob>" codepath has nothing to do with
> that "should this <blob> materialize as a <file> or a <symlink>?" logic,
> so saying <file> is doubly wrong in this context.

Yes. Maybe my remark was ambiguous, but from my v2 you can see what I
meant: not "on the file <path> stored in the index", but "content
recorded in the index at <path>".

Michael

      reply	other threads:[~2010-06-25  9:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24 10:14 [PATCH] git-cat-file.txt: Document --textconv Michael J Gruber
2010-06-24 11:53 ` Matthieu Moy
2010-06-24 12:56   ` Michael J Gruber
2010-06-24 12:56     ` [PATCHv2] " Michael J Gruber
2010-06-24 13:54       ` Matthieu Moy
2010-06-24 20:10       ` Junio C Hamano
2010-06-24 13:02     ` [PATCH] git-rev-parse.txt: Document ":path" specifier Michael J Gruber
2010-06-24 20:47       ` Junio C Hamano
2010-06-25 14:32         ` [PATCHv2] " Michael J Gruber
2010-06-25 15:25           ` Matthieu Moy
2010-06-25 17:52             ` Junio C Hamano
2010-06-27 13:15               ` [PATCHv3] " Michael J Gruber
2010-06-27 19:29                 ` Junio C Hamano
2010-06-27 19:41                   ` Michael J Gruber
2010-06-28  6:22                   ` Matthieu Moy
2010-06-28  8:18                   ` [PATCH] git-rev-parse.txt: Add more examples for caret and colon Michael J Gruber
2010-06-28 10:03                     ` Peter Kjellerstedt
2010-06-28 10:27                       ` Michael J Gruber
2010-06-28 19:01                         ` [PATCHv2] " Michael J Gruber
2010-06-25 15:53           ` [PATCHv2] git-rev-parse.txt: Document ":path" specifier Junio C Hamano
2010-06-24 20:09     ` [PATCH] git-cat-file.txt: Document --textconv Junio C Hamano
2010-06-25  9:04       ` Michael J Gruber [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=4C24710A.7000506@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=axel.bonnet@ensimag.imag.fr \
    --cc=clement.poulain@ensimag.imag.fr \
    --cc=diane.gasselin@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.