git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH] make commit --interactive lock index
Date: Thu, 29 May 2008 22:29:01 -0700	[thread overview]
Message-ID: <7vr6bkmkbm.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <E1K1eXH-00063c-Bt@fencepost.gnu.org> (Paolo Bonzini's message of "Thu, 29 May 2008 10:09:21 +0200")

Paolo Bonzini <bonzini@gnu.org> writes:

> 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.

Sorry, you need to defend this change much better than that.

I fail to see why it is a bad thing to have differences among the
codepaths that do different things.  The quoted commit 2888605
(builtin-commit: fix partial-commit support, 2007-11-18) was _not_ about
"doing it the same way".  It was simply "commit has three cases, AS_IS,
NORMAL and PARTIAL; the codepath that implements PARTIAL case is not done
right, so fix it to behave exactly the same as the old scripted version".

When interactive_add() returns, the index has already been updated, and
there is no reason to take the index lock, refresh the index, nor anything
that the normal "as-is" commit codepath needs to do (let alone the
alternate index dance forced upon the partial commit codepath).

If your change were so that "git commit --interactive" reverts the index
when one of the hooks exited non-zero just like COMMIT_NORMAL case (as
opposed to the current code which does not revert the index), I would
understand the need to change what's inside "if (interactive)" block.  But
that is not what the patch is about.  Changing the codepath so that it
does not return from that block made me follow unnecessary and unrelated
codepath to convince myself that this patch is mostly a no-op, except that
you are doing an extra refresh_cache() on the index that interactive_add()
has already refreshed before giving the control back to you.

Can you explain why this is an improvement?

  parent reply	other threads:[~2008-05-30  5:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29  8:09 [PATCH] make commit --interactive lock index Paolo Bonzini
2008-05-29 12:43 ` 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 [this message]
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=7vr6bkmkbm.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=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).