threads / discuss / 20250

Output from git diff-tree (documentation)

Subject: Output from git diff-tree (documentation)

## tl;dr

8 messages between Jul 27, 2009 and Jul 30, 2009.

replies: 7people: 3as markdown or json

David Kågedal· Jul 27, 2009, 19:54 UTC · lore

The "git diff-tree HEAD" command (with the default raw output) starts by printing a hash, which seems to be the hash for the commit (HEAD in this case).

I can't find any description of this in the documentation for diff-tree.

The "output format" sectionis the generic diff-format.txt that describes the format of the lines for the files that differ. Nothing wrong with that, but it doesn't explain the initial line of diff-tree.

The documentation of the --stdin flag mentions some initial output, but that is not relevant in this case.

-- 
David Kågedal
Junio C Hamano· Jul 27, 2009, 21:03 UTC · re: David Kågedal · lore

Re: Output from git diff-tree (documentation)

David Kågedal <davidk@lysator.liu.se> writes:
> The "git diff-tree HEAD" command (with the default raw output) starts
> by printing a hash, which seems to be the hash for the commit (HEAD in
> this case).

That was because "git diff-tree" was the historical workhorse of "git log". The latter literally was "rev-list HEAD | git diff-tree --stdin".

Giving a commit on the command line and giving one from the stdin was made consistent. IOW, "rev-list HEAD | xargs -n1 git diff-tree" would give you a similar output.

David Kågedal· Jul 29, 2009, 17:20 UTC · re: David Kågedal · lore

Output from git diff

Here is another diff output question. The updated documentation in diff-format.txt still claims that the output from the diff commands has this format:

:100644 100644 bcd1234... 0123456... M file0

This is true for "git diff --raw", but diff-tree and friends print full 40-char hashes.

I can get diff-tree to use abbreviated hashes with --abbrev, but how do I tell diff to stop abbreviating?

And what should the documentation really say?
-- 
David Kågedal
Pat Notz· Jul 29, 2009, 17:29 UTC · re: David Kågedal · lore

Re: Output from git diff

On Wed, Jul 29, 2009 at 11:20 AM, David Kågedal<davidk@lysator.liu.se> wrote:
Show 11 quoted lines
> Here is another diff output question. The updated documentation in
> diff-format.txt still claims that the output from the diff commands
> has this format:
>
> :100644 100644 bcd1234... 0123456... M file0
>
> This is true for "git diff --raw", but diff-tree and friends print
> full 40-char hashes.
>
> I can get diff-tree to use abbreviated hashes with --abbrev, but how
> do I tell diff to stop abbreviating?

Probably not the answer you *really* want but 'git diff --raw --abbrev=40' will give you the full sha1

Show 11 quoted lines
>
> And what should the documentation really say?
>
> --
> David Kågedal
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Junio C Hamano· Jul 29, 2009, 18:26 UTC · re: David Kågedal · lore

Re: Output from git diff

David Kågedal <davidk@lysator.liu.se> writes:
> And what should the documentation really say?

"git diff" unlike "git diff-<whatiscompared>" is a Porcelain, to produce human-readable output, and defaults to the abbreviated form.

David Kågedal· Jul 29, 2009, 06:11 UTC · re: Junio C Hamano · lore

Re: [PATCH] Update the documentation of the raw diff output format

Junio C Hamano <gitster@pobox.com> writes:
> Looks reasonable; thanks.

Great. But my patch mail doesn't seem to have reached the list, for some reason. At least I can't find it in gmane.

-- 
David Kågedal
Junio C Hamano· Jul 30, 2009, 08:06 UTC · lore

Re: Output from git diff

David Kågedal <davidk@lysator.liu.se> writes:
> Or perhaps the --raw flag to git diff isn't really meant to ever be
> used?
I do not think "git diff" Porcelain had --raw originally.

If you really need to know, you would need to dig the archives yourself, sorry.

← back to recent threads