From: Paolo Bonzini <bonzini@gnu.org>
To: Git mailing list <git@vger.kernel.org>
Subject: [PATCH] make commit --interactive lock index
Date: Thu, 29 May 2008 10:09:21 +0200 [thread overview]
Message-ID: <E1K1eXH-00063c-Bt@fencepost.gnu.org> (raw)
I noticed that the way "git commit --interactive" sets up the commit
is different from the way a normal "git commit" does it. Commit
2888605c changed one, but not the other. This makes the behavior
equivalent in the two cases.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
---
builtin-commit.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
I am sending this patch for review as I don't know if it's
necessary. The code is a tad cleaner, but it does cause more
system calls in the commit --interactive case, because of the
additional read of the index.
The assert tests that, in the interactive case, we'll go down to
the COMMIT_ASIS case.
The patch is on top of the previous change I sent for signal
handling in git-commit.
diff --git a/builtin-commit.c b/builtin-commit.c
index ef8b1f0..5a5f9a3 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -219,13 +219,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
struct path_list partial;
const char **pathspec = NULL;
- if (interactive) {
+ if (interactive)
interactive_add(argc, argv, prefix);
- if (read_cache() < 0)
- die("index file corrupt");
- commit_style = COMMIT_AS_IS;
- return get_index_file();
- }
if (read_cache() < 0)
die("index file corrupt");
@@ -233,6 +228,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
if (*argv)
pathspec = get_pathspec(prefix, argv);
+ assert (!(interactive && pathspec && *pathspec));
+
signal (SIGINT, rollback_on_signal);
signal (SIGHUP, rollback_on_signal);
signal (SIGTERM, rollback_on_signal);
--
1.5.5
next reply other threads:[~2008-05-29 9:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 8:09 Paolo Bonzini [this message]
2008-05-29 12:43 ` [PATCH] make commit --interactive lock index Johannes Schindelin
2008-05-29 13:12 ` Paolo Bonzini
2008-05-29 13:55 ` Johannes Schindelin
2008-05-29 14:40 ` Paolo Bonzini
2008-05-29 17:51 ` Alex Riesen
2008-05-29 18:00 ` Paolo Bonzini
2008-05-29 18:56 ` Alex Riesen
2008-05-29 19:17 ` Paolo Bonzini
2008-05-30 5:29 ` Junio C Hamano
2008-05-30 7:42 ` Paolo Bonzini
2008-06-02 13:52 ` Paolo Bonzini
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1K1eXH-00063c-Bt@fencepost.gnu.org \
--to=bonzini@gnu.org \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).