On 2006-11-24, Junio C Hamano <junkio@xxxxxxx> wrote: > Peter Baumann <Peter.B.Baumann@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> > writes: > >> One question, what's the difference between git-log -p and >> git-whatchanged -p? >> ... >> As you can see, the root commit isn't shown. Is this intentional? > > Some historical background. > > The traditional command do do log-minded things was whatchanged > and it was implemented as > > git rev-list $revision_args -- $path_limits | > git diff-tree --stdin --pretty -r $format_args > > and whatchanged did not give --root to diff-tree by default. > And 'diff-tree' does not show --pretty logs when there is no > diff to be shown (which still is true today and is a useful > behaviour), hence no mention of the root commit. > > On the other hand, "git-log" traditionally looked like this: > > git rev-list --pretty $revision_args > > Back then, there was no path_limits nor even diff options to > it. > > Later, Linus (with help from others) made the revision walk > machinery as callable inside programs other than "rev-list", > eliminating the need to pipe rev-list into diff-tree to perform > log-minded things. That enriched what "git log" can do, and > mostly made "whatchanged" a redundant command. As you may have > noticed, there isn't much difference between these two commands > in builtin-log.c; their differences are solely what default > options for diff and revision machinery are used and are meant > to match the traditional behaviour of these commands. > > So there shouldn't be any differences, really, when you override > their defaults with the likes of -p. > > Honestly speaking, I do not think there was _any_ consciously > designed intention to handle root commits, either to make these > commands behave identically or differently; regarding parentless > commits, they just behave the way they happen to behave, because > root commits were not something either Linus nor I were > interested in. > > Given the recent discussion, however, the intention now should > be that Porcelain level commands should default to do --root > (i.e. when asked to do "diff" to show how a commit without a > parent differs from its nonexistent parent, show diff with > emptiness). > Ah. I see. Thanks for the clarification. Peter - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html