Re: [PATCH 2/2] git-log (internal): more options.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:20
Linus Torvalds [off-list ref] writes:
Most helpers that want a list of commits probably want the printing options too, and the ones that do not probably simply don't care (ie if they silently pass a "--pretty=raw" without it affecting anything, who really cares?)
Perhaps (meaning, agree in general but not 100% convinced and haven't made up my mind yet).
I can actually imagine using "--parents" as a way of parsing both the commit log and the history. Of course, any such use is likely in a script, at which point the script probably doesn't actually want "git log", but just a raw "git-rev-list".
Yes, that is exactly why I did not see why "log viewer" wants --parents.
To me, the question whether a flag would be parsed in the "revision.c" library or in the "rev-list.c" binary was more a question of whether that flag makes sense for other things than just "git log".
Good to know we are in agreement (iow, I wasn't totally off the mark) that revision.c should handle things that are common. That means: * --bisect and --parents are for scripted use only and do not concern log viewer, so we would leave them in rev-list. * --header is good for anything that shows more than one record, so it may be worthwhile to have it in generic.
For example, "git whatchanged" and "git diff" could both use setup_revision(), although "git diff" wouldn't actually _walk_ the revisions (it would just look at the "revs->commits" list to see what was passed in). "git whatchanged" would obviously take all the same flags "git log" does, and "git diff" could take them and just test the values for sanity (ie error out if min/max_date is not -1, for example).
Perhaps.
"git show" is like a "git-whatchanged" except it wouldn't walk the diffs (I considered adding a "--nowalk" option to setup_revisions(), which would just suppress the "add_parents_to_list()" entirely)
Umm. The current "git show -4" walks and I find the behaviour useful. They are the same program with different defaults.