git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: git-diff between /dev/null and blob
Date: Sun, 06 Aug 2006 23:02:33 +0200	[thread overview]
Message-ID: <eb5ld6$36k$1@sea.gmane.org> (raw)
In-Reply-To: 7vmzaq9sjs.fsf@assigned-by-dhcp.cox.net

Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Currently, due to artifact of git-diff argument parsing you can get diff 
>> of two arbitrary blobs given by their sha1 id, e.g.
>>   git diff ab8050ceb4e43522e858768cc2c02fcb91839370 fd05278808d458602587bb024a48726018d30926
> 
> Just FYI, it is pretty much by design not artifact to allow
> something like this:
> 
>       git diff master:Makefile next:Makefile

Which we could get using

        git diff master next -- Makefile

Currently ('next' branch) git-diff manpage talks only about comparing trees.

* When  no  <ent>  is given, the working tree and the index file is compared,
  using git-diff-files.

* When one <ent> is given, the working tree and the named tree  is  compared,
  using git-diff-index. The option --cached can be given to compare the index
  file and the named tree.

* When  two  <ent>s  are  given,  these  two   trees   are   compared   using
  git-diff-tree.

And the only way to compare blobs is by giving directly or indirectly 
(like above) sha1 of the blobs, i.e. only the third case is supported. 

git-diff doesn't understand :<stage>:<filename> and :<filename> for
accessing index version of blob (git-cat-file for example understands
it). Note: <filename> in <revision>:<filename> and <stage>:<filename>
must be wrt GIT_DIR.

It is also no way to specify working tree version of file (blob). We 
could use ::<filename> for that, I think...

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

  reply	other threads:[~2006-08-06 21:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-31  1:07 git-diff between /dev/null and blob Jakub Narebski
2006-07-31  6:50 ` Junio C Hamano
2006-08-06 21:02   ` Jakub Narebski [this message]
2006-08-06 21:36     ` Junio C Hamano
2006-08-07 12:52       ` 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='eb5ld6$36k$1@sea.gmane.org' \
    --to=jnareb@gmail.com \
    --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).