Skip to content

Commit 4b56cf5

Browse files
Michael J Grubergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 21d2616 commit 4b56cf5

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

builtin/log.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -489,16 +489,11 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
489489
rev.verbose_header = 1;
490490
memset(&opt, 0, sizeof(opt));
491491
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);
499493
rev.commit_format = CMIT_FMT_ONELINE;
500494
rev.use_terminator = 1;
501495
rev.always_show_header = 1;
496+
cmd_log_init_finish(argc, argv, prefix, &rev, &opt);
502497

503498
return cmd_log_walk(&rev);
504499
}

t/t1411-reflog-show.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Author: A U Thor <[email protected]>
4141
4242
one
4343
EOF
44-
test_expect_failure 'override reflog default format' '
44+
test_expect_success 'override reflog default format' '
4545
git reflog --format=short -1 >actual &&
4646
test_cmp expect actual
4747
'

0 commit comments

Comments
 (0)