@matheusbsbs / matheus-bagliano / commits / 4b56cf58a9
Fork 0

reflog: fix overriding of command line options

Currently, "git reflog" overrides some command line options such as "--format". Fix this by using the new 2-phase version of cmd_log_init(). Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael J Gruber committed Apr 1, 2011 at 11:20 UTC 4b56cf58a9ee684d47e01d815eccd75252d61da5
2 files changed +3 -8
builtin/log.c
+2 -7
@@ -489,16 +489,11 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
489 rev.verbose_header = 1;
490 memset(&opt, 0, sizeof(opt));
491 opt.def = "HEAD";
492 - cmd_log_init(argc, argv, prefix, &rev, &opt);
493 -
494 - /*
495 - * This means that we override whatever commit format the user gave
496 - * on the cmd line. Sad, but cmd_log_init() currently doesn't
497 - * allow us to set a different default.
498 - */
492 + cmd_log_init_defaults(&rev);
493 rev.commit_format = CMIT_FMT_ONELINE;
494 rev.use_terminator = 1;
495 rev.always_show_header = 1;
496 + cmd_log_init_finish(argc, argv, prefix, &rev, &opt);
497
498 return cmd_log_walk(&rev);
499 }
t/t1411-reflog-show.sh
+1 -1
@@ -41,7 +41,7 @@ Author: A U Thor <author@example.com>
41
42 one
43 EOF
44 -test_expect_failure 'override reflog default format' '
44 +test_expect_success 'override reflog default format' '
45 git reflog --format=short -1 >actual &&
46 test_cmp expect actual
47 '