git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Left-over COMMIT_EDITMSG file in gitdir
@ 2018-02-08 22:09 Linus Torvalds
  2018-02-08 22:18 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Torvalds @ 2018-02-08 22:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

This may be intentional, but if so, it's not obvious..

Back long long ago, the original "git commit" shell script got rewritten in C.

In that rewrite, removing some temporary files seems to have been left
out. At least one: .git/COMMIT_EDITMSG.

In the original commit.sh shell script, we can find this:

  rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"

after creating the commit.  In the C implementation, we do have a
number of "unlink(...)" calls:

        unlink(git_path_cherry_pick_head());
        unlink(git_path_revert_head());
        unlink(git_path_merge_head());
        unlink(git_path_merge_msg());
        unlink(git_path_merge_mode());
        unlink(git_path_squash_msg());

but no

        unlink(git_path_commit_editmsg());

and that *seems* to be an oversight.

Similarly, builtin/tag,c leaves a stale TAG_EDITMSG file behind.
Again, that actually did exist in the original shell script, which
used to do

  trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG
"$GIT_DIR"/TAG_EDITMSG' 0

which caused that file to be removed at exit.

I guess I really don't care much, but those two files struck me when I
was doing a "git gc --prune=now" and looked at what was still left in
the .git directory..

If this is all intentional, never mind.

               Linus

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Left-over COMMIT_EDITMSG file in gitdir
  2018-02-08 22:09 Left-over COMMIT_EDITMSG file in gitdir Linus Torvalds
@ 2018-02-08 22:18 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-02-08 22:18 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List

Linus Torvalds <torvalds@linux-foundation.org> writes:

> In that rewrite, removing some temporary files seems to have been left
> out. At least one: .git/COMMIT_EDITMSG.
>
> In the original commit.sh shell script, we can find this:
>
>   rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
>
> after creating the commit.  In the C implementation, we do have a
> number of "unlink(...)" calls:
> ...
>
> but no
>
>         unlink(git_path_commit_editmsg());
>
> and that *seems* to be an oversight.
>
> Similarly, builtin/tag,c leaves a stale TAG_EDITMSG file behind.
> Again, that actually did exist in the original shell script, which
> used to do
>
>   trap 'rm -f "$GIT_DIR"/TAG_TMP* "$GIT_DIR"/TAG_FINALMSG
> "$GIT_DIR"/TAG_EDITMSG' 0
>
> which caused that file to be removed at exit.

I do not think it was intentional---just a bug in the rewrite.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-08 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 22:09 Left-over COMMIT_EDITMSG file in gitdir Linus Torvalds
2018-02-08 22:18 ` Junio C Hamano

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