From: Paolo Bonzini <bonzini@gnu.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/4] git-commit: Refactor creation of log message.
Date: Mon, 04 Feb 2008 18:14:19 +0100 [thread overview]
Message-ID: <47A747EB.9020909@gnu.org> (raw)
In-Reply-To: <alpine.LSU.1.00.0802041646461.7372@racer.site>
Johannes Schindelin wrote:
> Hi,
>
> On Mon, 21 Jan 2008, Paolo Bonzini wrote:
>
>> This means that: 1) the commit may be aborted after editing the message
>> if there is a problem writing out the tree object (slight disadvantage);
>
> I consider this more than a slight disadvantage. I regularly take ages
> coming up with a good commit message, because I think that the overall
> time balance is better with me spending more time on the message, but
> every reader spending less time to guess what I meant.
>
> So I would be quite annoyed to edit a message, only to find out that for
> whatever reason the commit was not successful.
Just to make it clearer, the piece of code that would have to fail, for
the behavior to change, is this:
discard_cache();
read_cache_from(index_file);
if (!active_cache_tree)
active_cache_tree = cache_tree();
if (cache_tree_update(active_cache_tree,
active_cache, active_nr, 0, 0) < 0) {
rollback_index_files();
die("Error building trees");
}
There are a couple of failure modes hidden in update_one (in cache-tree.c):
sub = find_subtree(it, path + baselen, entlen, 0);
if (!sub)
die("cache-tree.c: '%.*s' in '%s' not found",
entlen, path + baselen, path);
...
if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
return error("invalid object %s", sha1_to_hex(sha1));
but I don't really understand how they could happen. If you do, I
appreciate being taught. :-)
Also note that some problems writing the tree object (I cannot think of
anything but running out of diskspace -- permission errors could be
caught creating the index and logmessage too) could also happen writing
the commit object. I don't think in practice the disadvantage I
mentioned can happen.
> Are you _sure_ you need 3/4 for 4/4?
Probably no, but it makes it much easier to avoid duplicated code (all
the cases are already enumerated in prepare_log_message). I tried it
first and did not finish because the code was really really ugly.
Thanks for the review.
Paolo
next prev parent reply other threads:[~2008-02-04 17:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 14:27 [PATCH] git-commit: add a prepare-commit-msg hook Paolo Bonzini
2008-01-21 14:02 ` [PATCH 1/4] git-commit: support variable number of hook arguments Paolo Bonzini
2008-02-04 16:43 ` Johannes Schindelin
2008-02-05 3:09 ` Junio C Hamano
2008-01-21 14:06 ` [PATCH 2/4] git-commit: set GIT_EDITOR=: if editor will not be launched Paolo Bonzini
2008-01-21 14:27 ` [PATCH 4/4] git-commit: add a prepare-commit-msg hook Paolo Bonzini
2008-02-05 3:08 ` Junio C Hamano
2008-01-21 14:33 ` [PATCH 3/4] git-commit: Refactor creation of log message Paolo Bonzini
2008-02-04 16:48 ` Johannes Schindelin
2008-02-04 17:14 ` Paolo Bonzini [this message]
2008-02-05 1:39 ` Junio C Hamano
2008-02-05 4:07 ` Junio C Hamano
2008-02-05 6:07 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47A747EB.9020909@gnu.org \
--to=bonzini@gnu.org \
--cc=Johannes.Schindelin@gmx.de \
--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.
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).