diff options
author | Junio C Hamano <junkio@cox.net> | 2006-04-15 03:54:32 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-04-15 04:03:48 -0700 |
commit | d2e38d3bc30d3b1e407cbf9c69424b84244a5f9d (patch) | |
tree | 7a14f7c9f5195b6371ed8f20bcb95bee99d43de0 /git.c | |
parent | Extract "log [diff options]" parser out. (diff) | |
download | tgif-d2e38d3bc30d3b1e407cbf9c69424b84244a5f9d.tar.xz |
whatchanged options parser fix.
We need to have two sets of diff_options structure and abbrev
settings, but there is no point having two separate commit
format setting. Fix the confusion.
Also properly initialize the command options structure.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -288,19 +288,20 @@ static int cmd_log(int argc, const char **argv, char **envp) struct rev_info *rev = &wcopt.revopt; struct log_tree_opt *opt = &wcopt.logopt; + memset(&wcopt, 0, sizeof(wcopt)); init_log_tree_opt(&wcopt.logopt); - wcopt.commit_format = CMIT_FMT_DEFAULT; + opt->commit_format = CMIT_FMT_DEFAULT; wcopt.abbrev = DEFAULT_ABBREV; argc = parse_whatchanged_opt(argc, argv, &wcopt); - if (wcopt.logopt.commit_format == CMIT_FMT_ONELINE) + if (opt->commit_format == CMIT_FMT_ONELINE) commit_prefix = ""; prepare_revision_walk(rev); setup_pager(); while ((commit = get_revision(rev)) != NULL) { if (shown && wcopt.do_diff && - wcopt.commit_format != CMIT_FMT_ONELINE) + opt->commit_format != CMIT_FMT_ONELINE) putchar('\n'); fputs(commit_prefix, stdout); if (wcopt.abbrev_commit && wcopt.abbrev) @@ -327,11 +328,11 @@ static int cmd_log(int argc, const char **argv, char **envp) parents = parents->next) parents->item->object.flags &= ~TMP_MARK; } - if (wcopt.commit_format == CMIT_FMT_ONELINE) + if (opt->commit_format == CMIT_FMT_ONELINE) putchar(' '); else putchar('\n'); - pretty_print_commit(wcopt.commit_format, commit, ~0, buf, + pretty_print_commit(opt->commit_format, commit, ~0, buf, LOGSIZE, wcopt.abbrev); printf("%s\n", buf); if (wcopt.do_diff) |