Re: [PATCH] commit: ensure correct permissions of the commit message
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Jan 15, 2016, 01:12 UTC
- Message-ID
- <20160115021237.Horde.J6jJsRTdZiG5URajzd8kKsn@webmail.informatik.kit.edu>
- In-Reply-To
- <xmqq7fk8io3f.fsf@gitster.mtv.corp.google.com>
Quoting Junio C Hamano <gitster@pobox.com>:
> Actually, we do not even _need_ a sharedness for this ephemeral > file. The additional "adjust-shared-perm" is merely a workaround > for the fact the next person cannot write into it when it is left > behind, and because we do not want to remove it when we are done.
Do we really want to keep such a file after we are done?
From all the cases where $GIT_EDITOR is run as part of an operation to edit a temporary file, that temporary file is deleted on success most of the time, except the already mentioned COMMIT_EDITMSG, REPLACE_EDITOBJ for 'git replace --edit', and BRANCH_DESCRIPTION for 'git branch --edit-description'. I don't see why these files should be handled differently than the others and why should they be kept after the operation finished, since at that point the contents is already stored in its proper place (in the commit object, in the replacement object, or in the config file), making these files redundant and unnecessary.
If the operation fails for whatever reason, then that's a different matter, of course. In that case we definitely want to keep these files to avoid losing whatever the user has written.
Gábor