git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.

From
Junio C Hamano <junkio@cox.net>
Date
Oct 5, 2005, 21:54 UTC
Message-ID
<7vk6griq8d.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<87achnq4z7.fsf@gmail.com>
Santi Béjar <sbejar@gmail.com> writes:
> It appears in the git-status output during a git-commit if you have
> something in info/exclude.
... which does not worry me too much; you'll get used to it ;-).
> Also for .cmitmsg and .cmitchk to make git-commit work
> in read-only working trees.
If a working tree is read-only, I wonder what you are committing.

It might not be a bad idea to think about this a bit more before actually coding. You are moving things out of the working tree root level, which is a valid thing to do when worrying about a repository (or working tree) that you do not have write access to. We've had a fix similar to this for temporary files used by diff commands, which moved them to $TMPDIR or something like that. If the working tree root level is not writable for you, is it valid/reasonable to assume that $GIT_DIR is? Are there better places? E.g. perhaps $HOME/.gittmp/?

>  ret="$?"
> -rm -f .cmitmsg .editmsg .cmitchk
> +rm -f "$GIT_DIR"/{.cmitmsg,.editmsg,.cmitchk}

Please do not do "{a,b,c}". I think ksh can grok the rest of the git-commit.sh code, but not this.

Previous: Santi BéjarNext: Santi Bejar
Message 2 of 4 in “Write .editmsg in GIT_DIR to avoid being in git-status.”
  1. Write .editmsg in GIT_DIR to avoid being in git-status.Santi Béjar, Oct 5, 2005
  2. Junio C HamanoOct 5, 2005
  3. Santi BejarOct 6, 2005
  4. Junio C HamanoOct 6, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.