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>
Junio C Hamano committed
Apr 15, 2006 at 03:54 UTC
d2e38d3bc30d3b1e407cbf9c69424b84244a5f9d
2 files changed
+6
-6
git.c
+6
-5
@@ -288,19 +288,20 @@ static int cmd_log(int argc, const char **argv, char **envp)
288
struct rev_info *rev = &wcopt.revopt;
289
struct log_tree_opt *opt = &wcopt.logopt;
290
291
+ memset(&wcopt, 0, sizeof(wcopt));
292
init_log_tree_opt(&wcopt.logopt);
292
- wcopt.commit_format = CMIT_FMT_DEFAULT;
293
+ opt->commit_format = CMIT_FMT_DEFAULT;
294
wcopt.abbrev = DEFAULT_ABBREV;
295
argc = parse_whatchanged_opt(argc, argv, &wcopt);
296
296
- if (wcopt.logopt.commit_format == CMIT_FMT_ONELINE)
297
+ if (opt->commit_format == CMIT_FMT_ONELINE)
298
commit_prefix = "";
299
300
prepare_revision_walk(rev);
301
setup_pager();
302
while ((commit = get_revision(rev)) != NULL) {
303
if (shown && wcopt.do_diff &&
303
- wcopt.commit_format != CMIT_FMT_ONELINE)
304
+ opt->commit_format != CMIT_FMT_ONELINE)
305
putchar('\n');
306
fputs(commit_prefix, stdout);
307
if (wcopt.abbrev_commit && wcopt.abbrev)
@@ -327,11 +328,11 @@ static int cmd_log(int argc, const char **argv, char **envp)
328
parents = parents->next)
329
parents->item->object.flags &= ~TMP_MARK;
330
}
330
- if (wcopt.commit_format == CMIT_FMT_ONELINE)
331
+ if (opt->commit_format == CMIT_FMT_ONELINE)
332
putchar(' ');
333
else
334
putchar('\n');
334
- pretty_print_commit(wcopt.commit_format, commit, ~0, buf,
335
+ pretty_print_commit(opt->commit_format, commit, ~0, buf,
336
LOGSIZE, wcopt.abbrev);
337
printf("%s\n", buf);
338
if (wcopt.do_diff)
log-tree.h
-1
@@ -25,7 +25,6 @@ int log_tree_opt_parse(struct log_tree_opt *, const char **, int);
25
struct whatchanged_opt {
26
struct rev_info revopt;
27
struct log_tree_opt logopt;
28
- enum cmit_fmt commit_format;
28
int abbrev;
29
int abbrev_commit;
30
int do_diff;