1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-18 06:54:55 +01:00

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>
This commit is contained in:
Junio C Hamano 2006-04-15 03:54:32 -07:00
parent f4235f8b2e
commit d2e38d3bc3
2 changed files with 6 additions and 6 deletions

11
git.c
View file

@ -288,19 +288,20 @@ static int cmd_log(int argc, const char **argv, char **envp)
struct rev_info *rev = &wcopt.revopt; struct rev_info *rev = &wcopt.revopt;
struct log_tree_opt *opt = &wcopt.logopt; struct log_tree_opt *opt = &wcopt.logopt;
memset(&wcopt, 0, sizeof(wcopt));
init_log_tree_opt(&wcopt.logopt); init_log_tree_opt(&wcopt.logopt);
wcopt.commit_format = CMIT_FMT_DEFAULT; opt->commit_format = CMIT_FMT_DEFAULT;
wcopt.abbrev = DEFAULT_ABBREV; wcopt.abbrev = DEFAULT_ABBREV;
argc = parse_whatchanged_opt(argc, argv, &wcopt); argc = parse_whatchanged_opt(argc, argv, &wcopt);
if (wcopt.logopt.commit_format == CMIT_FMT_ONELINE) if (opt->commit_format == CMIT_FMT_ONELINE)
commit_prefix = ""; commit_prefix = "";
prepare_revision_walk(rev); prepare_revision_walk(rev);
setup_pager(); setup_pager();
while ((commit = get_revision(rev)) != NULL) { while ((commit = get_revision(rev)) != NULL) {
if (shown && wcopt.do_diff && if (shown && wcopt.do_diff &&
wcopt.commit_format != CMIT_FMT_ONELINE) opt->commit_format != CMIT_FMT_ONELINE)
putchar('\n'); putchar('\n');
fputs(commit_prefix, stdout); fputs(commit_prefix, stdout);
if (wcopt.abbrev_commit && wcopt.abbrev) 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 = parents->next)
parents->item->object.flags &= ~TMP_MARK; parents->item->object.flags &= ~TMP_MARK;
} }
if (wcopt.commit_format == CMIT_FMT_ONELINE) if (opt->commit_format == CMIT_FMT_ONELINE)
putchar(' '); putchar(' ');
else else
putchar('\n'); putchar('\n');
pretty_print_commit(wcopt.commit_format, commit, ~0, buf, pretty_print_commit(opt->commit_format, commit, ~0, buf,
LOGSIZE, wcopt.abbrev); LOGSIZE, wcopt.abbrev);
printf("%s\n", buf); printf("%s\n", buf);
if (wcopt.do_diff) if (wcopt.do_diff)

View file

@ -25,7 +25,6 @@ int log_tree_opt_parse(struct log_tree_opt *, const char **, int);
struct whatchanged_opt { struct whatchanged_opt {
struct rev_info revopt; struct rev_info revopt;
struct log_tree_opt logopt; struct log_tree_opt logopt;
enum cmit_fmt commit_format;
int abbrev; int abbrev;
int abbrev_commit; int abbrev_commit;
int do_diff; int do_diff;