Skip to contentSkip to conversation

Output from git diff-tree (documentation)

DISCUSSION David Kågedal 3 participants 8 messages Jun 15, 2016 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

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.

Signature · 1 line
David Kågedal
#1 lore raw
Quoted 3 lines · David Kågedal

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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

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

Looks reasonable; thanks.

#5 lore raw

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

Quoted 1 line · Junio C Hamano

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.

Signature · 1 line
David Kågedal
#6 lore raw

Output from git diff

In reply to David Kågedal

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?

Signature · 1 line
David Kågedal
#7 lore raw

Re: Output from git diff

Quoted 11 lines · David Kågedal

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

Quoted 11 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: Output from git diff

In reply to David Kågedal
Quoted 1 line · David Kågedal

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.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: Output from git diff

Quoted 2 lines · David Kågedal

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.