From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] git-commit: exit non-zero if we fail to commit the index
Date: Wed, 23 Jan 2008 12:01:03 -0800 [thread overview]
Message-ID: <7vzluwgvls.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <47977792.5080001@nrlssc.navy.mil> (Brandon Casey's message of "Wed, 23 Jan 2008 11:21:22 -0600")
Brandon Casey <casey@nrlssc.navy.mil> writes:
> In certain rare cases, the creation of the commit object
> and update of HEAD can succeed, but then installing the
> updated index will fail. This is most likely caused by a
> full disk or exceeded disk quota. When this happens the
> new index file will be removed, and the repository will
> be left with the original now-out-of-sync index. The
> user can recover with a "git reset HEAD" once the disk
> space issue is resolved.
>
> We should detect this failure and offer the user some
> helpful guidance.
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> ---
Thanks, looks much better, especially with S-o-b: line.
>> Brandon Casey <casey@nrlssc.navy.mil> writes:
>>> If you're interested, here's a patch.
>>
>> Looks Ok from a quick glance. I am mired at day job this week
>> so it may take a while for me to come up with a commit log
>> message though.
>
> Oh, I had /ASS/u/ME/d this was simple enough that the one-liner
> was sufficient.
I do not get the funny punctuation, sorry.
Anyway, here is a bit more detailed reason behind my request.
(1) The subject is primarily to help people who look at
shortlog (or "gitk") to get the overview of recent changes,
or in general "changes within a given range".
Readers are most interested in what areas are affected
(e.g. the command from the end-user's point of view, or the
internal implementation) and what the nature of the change
was (e.g. bugfix vs enhancement). To help them, the
Subject: line summarizes "what the change is about".
Your Subject: line is _perfect_. It identifies the area as
"git-commit" instead of "builtin-commit.c", because it is
not about fixing internal implementation of that file, but
about the end-user experience interacting with the command.
It also makes it clear that it is a fix by saying that we
failed to exit with non-zero status code upon some failure.
(2) The body of the commit log message is primarily to help
people who look at this particular commit 6 months down the
road to see why things got there that way.
Reason behind the logic in the code _after_ the change can
be left in in-code comments. The reason behind the change
itself (why the logic behind the code _before_ the change
was faulty or insufficient, and the logic behind the new
code is better) is not captured well in such a comment (and
we do not want to clutter the code comments with a long "in
ancient versions we used to do this but then we updated it
to do that but now we do it this way instead." --- I made
that mistake earlier and I suspect some of the older source
files still have them).
The commit log message should describe why the change was
needed (e.g. "The earlier code assumed X because it knew Y
won't happen, but that is not the case anymore since commit
Z, so this code stops relying on that assumption and
implements the logic this way instead"), why the proposed
implementation was thought to be the best one to choose
(e.g. "We alternatively could do W and it may have some
performance edge, but this way the code is simpler and in
my benchmark with real life data I did not see significant
gain from the added complexity").
How the code was changed in this commit does not need to be
described; that can be seen in "git show $this_commit"
output easily.
In this particular case, I think it is probably sufficient to
briefly describe what "failure to commit the index", mentioned
in the summary line, means. For more complex fixes and
enhancements, it would make a good log message to also describe
what the plausible cases the updated codepath is triggered, from
the point of view of the committer/author when making the commit
(IOW, what scenarios the updated behaviour intends to handle),
like you did in this version.
Such a description will help the person who finds the change was
faulty or insufficient 6 months down the road by allowing him to
say "Aha, the change considered these cases but forgot to
consider this case, and missed the fact that this part of the
code needs to work differently in that particular case" while
making further fixes. Otherwise the person will be left
wondering if the omission of handing that case he encountered
was deliberate or a simple oversight. With the comment, he can
make his fix with more confidence.
In addition, at the end of the body, there is expected to be
your S-o-b: line, so it will never be "1-liner".
In any case, thanks for a fix. Will apply.
next prev parent reply other threads:[~2008-01-23 20:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-17 0:07 [PATCH] git-commit: exit non-zero if we fail to commit the index Brandon Casey
2008-01-17 1:13 ` Junio C Hamano
2008-01-17 1:49 ` Brandon Casey
2008-01-17 2:11 ` Junio C Hamano
2008-01-22 19:26 ` Brandon Casey
2008-01-22 23:42 ` Junio C Hamano
2008-01-23 17:21 ` Brandon Casey
2008-01-23 20:01 ` Junio C Hamano [this message]
2008-01-23 20:47 ` Brandon Casey
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=7vzluwgvls.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=casey@nrlssc.navy.mil \
--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).