@matheusbsbs / matheus-bagliano / commits / d56651c0ef
Fork 0

Don't allow combination of -g and --reverse as it doesn't work

The --walk-reflogs logic and the --reverse logic are completely incompatible with one another. Attempting to use both at the same time leads to confusing results that sometimes violates the user's formatting options or ignores the user's request to see the reflog message and timestamp. Unfortunately the implementation of both of these features is glued onto the side of the revision walking machinary in such a way that they are probably not going to be easy to make them compatible with each other. Rather than offering the user confusing results we are better off bailing out with an error message until such a time as the implementations can be refactored to be compatible. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Aug 19, 2007 at 22:33 UTC d56651c0ef1c81c1d0509ea4464451d5724e4036
3 files changed +7
Documentation/git-log.txt
+1
@@ -49,6 +49,7 @@ include::pretty-options.txt[]
49 -g, \--walk-reflogs::
50 Show commits as they were recorded in the reflog. The log contains
51 a record about how the tip of a reference was changed.
52 + Cannot be combined with --reverse.
53 See also gitlink:git-reflog[1].
54
55 --decorate::
Documentation/git-rev-list.txt
+3
@@ -298,6 +298,8 @@ used in the output. When the starting commit is specified as
298 'commit@{now}', output also uses 'commit@\{timestamp}' notation
299 instead. Under '\--pretty=oneline', the commit message is
300 prefixed with this information on the same line.
301 ++
302 +Cannot be combined with --reverse.
303
304 --merge::
305
@@ -373,6 +375,7 @@ By default, the commits are shown in reverse chronological order.
375 --reverse::
376
377 Output the commits in reverse order.
378 + Cannot be combined with --walk-reflogs.
379
380 Object Traversal
381 ~~~~~~~~~~~~~~~~
revision.c
+3
@@ -1277,6 +1277,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1277 compile_grep_patterns(revs->grep_filter);
1278 }
1279
1280 + if (revs->reverse && revs->reflog_info)
1281 + die("cannot combine --reverse with --walk-reflogs");
1282 +
1283 return left;
1284 }
1285