|
|
@ -286,6 +286,10 @@ static int cmd_log_wc(int argc, const char **argv, char **envp, |
|
|
|
const char *commit_prefix = "commit "; |
|
|
|
const char *commit_prefix = "commit "; |
|
|
|
int shown = 0; |
|
|
|
int shown = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rev->abbrev = DEFAULT_ABBREV; |
|
|
|
|
|
|
|
rev->commit_format = CMIT_FMT_DEFAULT; |
|
|
|
|
|
|
|
argc = setup_revisions(argc, argv, rev, "HEAD"); |
|
|
|
|
|
|
|
|
|
|
|
if (argc > 1) |
|
|
|
if (argc > 1) |
|
|
|
die("unrecognized argument: %s", argv[1]); |
|
|
|
die("unrecognized argument: %s", argv[1]); |
|
|
|
if (rev->commit_format == CMIT_FMT_ONELINE) |
|
|
|
if (rev->commit_format == CMIT_FMT_ONELINE) |
|
|
@ -294,16 +298,20 @@ static int cmd_log_wc(int argc, const char **argv, char **envp, |
|
|
|
prepare_revision_walk(rev); |
|
|
|
prepare_revision_walk(rev); |
|
|
|
setup_pager(); |
|
|
|
setup_pager(); |
|
|
|
while ((commit = get_revision(rev)) != NULL) { |
|
|
|
while ((commit = get_revision(rev)) != NULL) { |
|
|
|
|
|
|
|
unsigned long ofs = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (shown && rev->diff && |
|
|
|
if (shown && rev->diff && |
|
|
|
rev->commit_format != CMIT_FMT_ONELINE) |
|
|
|
rev->commit_format != CMIT_FMT_ONELINE) |
|
|
|
putchar('\n'); |
|
|
|
putchar('\n'); |
|
|
|
fputs(commit_prefix, stdout); |
|
|
|
|
|
|
|
|
|
|
|
ofs = sprintf(buf, "%s", commit_prefix); |
|
|
|
if (rev->abbrev_commit && rev->abbrev) |
|
|
|
if (rev->abbrev_commit && rev->abbrev) |
|
|
|
fputs(find_unique_abbrev(commit->object.sha1, |
|
|
|
ofs += sprintf(buf + ofs, "%s", |
|
|
|
rev->abbrev), |
|
|
|
find_unique_abbrev(commit->object.sha1, |
|
|
|
stdout); |
|
|
|
rev->abbrev)); |
|
|
|
else |
|
|
|
else |
|
|
|
fputs(sha1_to_hex(commit->object.sha1), stdout); |
|
|
|
ofs += sprintf(buf + ofs, "%s", |
|
|
|
|
|
|
|
sha1_to_hex(commit->object.sha1)); |
|
|
|
if (rev->parents) { |
|
|
|
if (rev->parents) { |
|
|
|
struct commit_list *parents = commit->parents; |
|
|
|
struct commit_list *parents = commit->parents; |
|
|
|
while (parents) { |
|
|
|
while (parents) { |
|
|
@ -311,7 +319,8 @@ static int cmd_log_wc(int argc, const char **argv, char **envp, |
|
|
|
parents = parents->next; |
|
|
|
parents = parents->next; |
|
|
|
if (o->flags & TMP_MARK) |
|
|
|
if (o->flags & TMP_MARK) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
printf(" %s", sha1_to_hex(o->sha1)); |
|
|
|
ofs += sprintf(buf + ofs, " %s", |
|
|
|
|
|
|
|
sha1_to_hex(o->sha1)); |
|
|
|
o->flags |= TMP_MARK; |
|
|
|
o->flags |= TMP_MARK; |
|
|
|
} |
|
|
|
} |
|
|
|
/* TMP_MARK is a general purpose flag that can |
|
|
|
/* TMP_MARK is a general purpose flag that can |
|
|
@ -323,17 +332,20 @@ static int cmd_log_wc(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 (rev->commit_format == CMIT_FMT_ONELINE) |
|
|
|
buf[ofs++] = |
|
|
|
putchar(' '); |
|
|
|
(rev->commit_format == CMIT_FMT_ONELINE) ? ' ' : '\n'; |
|
|
|
else |
|
|
|
ofs += pretty_print_commit(rev->commit_format, commit, ~0, |
|
|
|
putchar('\n'); |
|
|
|
buf + ofs, |
|
|
|
pretty_print_commit(rev->commit_format, commit, ~0, buf, |
|
|
|
LOGSIZE - ofs - 20, |
|
|
|
LOGSIZE, rev->abbrev); |
|
|
|
rev->abbrev); |
|
|
|
printf("%s\n", buf); |
|
|
|
|
|
|
|
if (rev->diff) { |
|
|
|
if (rev->diff) { |
|
|
|
printf("--\n"); |
|
|
|
rev->use_precomputed_header = buf; |
|
|
|
|
|
|
|
strcpy(buf + ofs, "\n---\n"); |
|
|
|
log_tree_commit(rev, commit); |
|
|
|
log_tree_commit(rev, commit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
printf("%s\n", buf); |
|
|
|
shown = 1; |
|
|
|
shown = 1; |
|
|
|
free(commit->buffer); |
|
|
|
free(commit->buffer); |
|
|
|
commit->buffer = NULL; |
|
|
|
commit->buffer = NULL; |
|
|
@ -347,12 +359,8 @@ static int cmd_wc(int argc, const char **argv, char **envp) |
|
|
|
struct rev_info rev; |
|
|
|
struct rev_info rev; |
|
|
|
|
|
|
|
|
|
|
|
init_revisions(&rev); |
|
|
|
init_revisions(&rev); |
|
|
|
rev.abbrev = DEFAULT_ABBREV; |
|
|
|
|
|
|
|
rev.no_commit_id = 1; |
|
|
|
|
|
|
|
rev.commit_format = CMIT_FMT_DEFAULT; |
|
|
|
|
|
|
|
rev.diff = 1; |
|
|
|
rev.diff = 1; |
|
|
|
rev.diffopt.recursive = 1; |
|
|
|
rev.diffopt.recursive = 1; |
|
|
|
argc = setup_revisions(argc, argv, &rev, "HEAD"); |
|
|
|
|
|
|
|
return cmd_log_wc(argc, argv, envp, &rev); |
|
|
|
return cmd_log_wc(argc, argv, envp, &rev); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -362,14 +370,11 @@ static int cmd_show(int argc, const char **argv, char **envp) |
|
|
|
|
|
|
|
|
|
|
|
init_revisions(&rev); |
|
|
|
init_revisions(&rev); |
|
|
|
rev.diff = 1; |
|
|
|
rev.diff = 1; |
|
|
|
rev.ignore_merges = 0; |
|
|
|
rev.diffopt.recursive = 1; |
|
|
|
rev.combine_merges = 1; |
|
|
|
rev.combine_merges = 1; |
|
|
|
rev.dense_combined_merges = 1; |
|
|
|
rev.dense_combined_merges = 1; |
|
|
|
rev.abbrev = DEFAULT_ABBREV; |
|
|
|
rev.ignore_merges = 0; |
|
|
|
rev.commit_format = CMIT_FMT_DEFAULT; |
|
|
|
|
|
|
|
rev.diffopt.recursive = 1; |
|
|
|
|
|
|
|
rev.no_walk = 1; |
|
|
|
rev.no_walk = 1; |
|
|
|
argc = setup_revisions(argc, argv, &rev, "HEAD"); |
|
|
|
|
|
|
|
return cmd_log_wc(argc, argv, envp, &rev); |
|
|
|
return cmd_log_wc(argc, argv, envp, &rev); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -378,10 +383,10 @@ static int cmd_log(int argc, const char **argv, char **envp) |
|
|
|
struct rev_info rev; |
|
|
|
struct rev_info rev; |
|
|
|
|
|
|
|
|
|
|
|
init_revisions(&rev); |
|
|
|
init_revisions(&rev); |
|
|
|
rev.abbrev = DEFAULT_ABBREV; |
|
|
|
rev.always_show_header = 1; |
|
|
|
rev.no_commit_id = 1; |
|
|
|
rev.diffopt.recursive = 1; |
|
|
|
rev.commit_format = CMIT_FMT_DEFAULT; |
|
|
|
rev.combine_merges = 1; |
|
|
|
argc = setup_revisions(argc, argv, &rev, "HEAD"); |
|
|
|
rev.ignore_merges = 0; |
|
|
|
return cmd_log_wc(argc, argv, envp, &rev); |
|
|
|
return cmd_log_wc(argc, argv, envp, &rev); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|