diff options
author | Alex Riesen <raa.lkml@gmail.com> | 2007-11-28 22:13:08 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-28 14:03:59 -0800 |
commit | 7168624c3530d8c7ee32f930f8fb2ba302b9801f (patch) | |
tree | c849e2b0e4f287fd14980806ebb33bbdb4b6131d /builtin-commit.c | |
parent | e475fe16a9b7f36478ee4f304e53d6979e4f1710 (diff) | |
download | git-7168624c3530d8c7ee32f930f8fb2ba302b9801f.tar.gz |
Do not generate full commit log message if it is not going to be used
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>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r-- | builtin-commit.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/builtin-commit.c b/builtin-commit.c index a35881e20b..1a9a256881 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -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" |