Skip to content

Commit

Permalink
Do not generate full commit log message if it is not going to be used
Browse files Browse the repository at this point in the history
Like when it is already specified through -C, -F or -m to git-commit.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Nov 28, 2007
1 parent e475fe1 commit 7168624
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions builtin-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,28 @@ static int prepare_log_message(const char *index_file, const char *prefix)

strbuf_release(&sb);

if (no_edit) {
struct rev_info rev;
unsigned char sha1[40];

fclose(fp);

if (!active_nr && read_cache() < 0)
die("Cannot read index");

if (get_sha1("HEAD", sha1) != 0)
return !!active_nr;

init_revisions(&rev, "");
rev.abbrev = 0;
setup_revisions(0, NULL, &rev, "HEAD");
DIFF_OPT_SET(&rev.diffopt, QUIET);
DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS);
run_diff_index(&rev, 1 /* cached */);

return !!DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES);
}

if (in_merge && !no_edit)
fprintf(fp,
"#\n"
Expand Down

0 comments on commit 7168624

Please sign in to comment.