From: Alex Riesen <raa.lkml@gmail.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Git Mailing List" <git@vger.kernel.org>,
"Johannes Sixt" <j.sixt@viscovery.net>,
"Junio C Hamano" <gitster@pobox.com>,
"Kristian Høgsberg" <krh@redhat.com>
Subject: [PATCH] Do not generate full commit log message if it is not going to be used
Date: Wed, 28 Nov 2007 22:13:08 +0100 [thread overview]
Message-ID: <20071128211308.GB3173@steel.home> (raw)
In-Reply-To: <20071128211059.GA3173@steel.home>
Like when it is already specified through -C, -F or -m to git-commit.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
Alex Riesen, Wed, Nov 28, 2007 22:10:59 +0100:
> Johannes Schindelin, Wed, Nov 28, 2007 13:18:10 +0100:
> > Besides, would this not be more elegant as
> >
> > setup_revisions(0, NULL, &rev, "HEAD");
>
> Hmm... And I was so puzzled as to what that "def" argument could
> possibly mean... Still am, in fact. But it works.
>
> > > + (void)run_diff_index(&rev, 1 /* cached */);
> >
> > (void)?
>
> I'll remove them and resubmit. Stupid custom.
>
Here it goes.
builtin-commit.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index a35881e..1a9a256 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"
--
1.5.3.6.1014.g3543
next prev parent reply other threads:[~2007-11-28 21:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-27 10:54 [PATCH] builtin-commit: add --cached to operate only on index Alex Riesen
2007-11-27 11:18 ` Johannes Schindelin
2007-11-27 12:57 ` Alex Riesen
2007-11-27 11:35 ` Johannes Sixt
2007-11-27 12:48 ` Alex Riesen
2007-11-27 17:16 ` Junio C Hamano
2007-11-27 18:12 ` Alex Riesen
2007-11-27 18:18 ` Alex Riesen
2007-11-27 21:44 ` [PATCH] Do not generate full commit log message if it not going to be used Alex Riesen
2007-11-27 21:47 ` Alex Riesen
2007-11-28 12:18 ` Johannes Schindelin
2007-11-28 21:10 ` Alex Riesen
2007-11-28 21:13 ` Alex Riesen [this message]
2007-11-28 21:43 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071128211308.GB3173@steel.home \
--to=raa.lkml@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=krh@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).