Subject: Re: [RFC/PATCH 2/2] messages: uniform error messages for index write

From: Junio C Hamano <[email-masked]>
Date: Mon, 01 Jun 2015 16:01:14 -0700

Michael J Gruber <[email-masked]> writes:

> * Leave "temporary" in place and add TRANSLATORS note.
>   It may happen that the index file is writable but not the temporary
>   one.
>
> * Leave pack-write.c alone.
>   It is low level without l10n.
>
> Signed-off-by: Michael J Gruber <[email-masked]>
> ---
> I am actually a bit torn on the "temporary index" messages. On the one hand
> we should hide technicalities from the user; on the other hand, we should give
> helpful information for debugging.
>
> Maybe "new index" and "temporary index" are really in the same camp? I would
> omit "temporary" in that case, too.

It is true that we never overwrite the file in-place, but instead
create a new file and then rename it to the destiation.  So in that
sense, we are always writing "new index file".

There however indeed is a different kind of "temporary" index
involved, when you are doing "git commit paths" to create a partial
commit.  We populate a pristine (relative to HEAD) index, update the
contents of it with the working tree contents at specified paths in
order to write the tree out, but do not use that index after that.
The real index is updated the same way for the specified paths to
match what was committed, but what was added to the real index
outside the specified paths before the partial commit was made is
all kept in the real index.  The presense of this "temporary" index
is something the end users may have to be aware of, if they want to
peek into the state of the index from inside their hooks, so in that
sense, it may make sense to include the word "temporary" in the
error message in that codepath.