{"thread":{"id":"2021","subject":"[PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.","startedAt":"2005-10-05T16:54:36Z","lastAt":"2005-10-06T20:19:45Z","messageCount":4,"participants":["Santi Béjar","Junio C Hamano","Santi Bejar"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"9713","messageId":"87achnq4z7.fsf@gmail.com","threadId":"2021","inReplyTo":null,"subject":"[PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2005-10-05T16:54:36Z","receivedAt":"2005-10-05T16:54:36Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"\nIt appears in the git-status output during a git-commit if you have\nsomething in info/exclude.\n\nAlso for .cmitmsg and .cmitchk to make git-commit work\nin read-only working trees.\n\nSigned-off-by: Santi Béjar <sbejar@gmail.com>\n\n\n---\n\n git-commit.sh |   24 ++++++++++++------------\n 1 files changed, 12 insertions(+), 12 deletions(-)\n\napplies-to: 9eec9ff9326032bca405a12a265918725edf4ac7\n4e61f41c1feed7345fc442747c82b9ea701fb59c\ndiff --git a/git-commit.sh b/git-commit.sh\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -129,7 +129,7 @@ then\n elif test \"$use_commit\" != \"\"\n then\n \tgit-cat-file commit \"$use_commit\" | sed -e '1,/^$/d'\n-fi | git-stripspace >.editmsg\n+fi | git-stripspace >\"$GIT_DIR\"/.editmsg \n \n case \"$signoff\" in\n t)\n@@ -139,7 +139,7 @@ t)\n \t\t\ts/>.*/>/\n \t\t\ts/^/Signed-off-by: /\n \t\t'\n-\t} >>.editmsg\n+\t} >>\"$GIT_DIR\"/.editmsg\n \t;;\n esac\n \n@@ -153,7 +153,7 @@ if [ -f \"$GIT_DIR/MERGE_HEAD\" ]; then\n \techo \"#\t$GIT_DIR/MERGE_HEAD\"\n \techo \"# and try again\"\n \techo \"#\"\n-fi >>.editmsg\n+fi >>\"$GIT_DIR\"/.editmsg\n \n PARENTS=\"-p HEAD\"\n if GIT_DIR=\"$GIT_DIR\" git-rev-parse --verify HEAD >/dev/null 2>&1\n@@ -197,16 +197,16 @@ else\n \tfi\n \tPARENTS=\"\"\n fi\n-git-status >>.editmsg\n+git-status >>\"$GIT_DIR\"/.editmsg\n if [ \"$?\" != \"0\" -a ! -f $GIT_DIR/MERGE_HEAD ]\n then\n-\trm -f .editmsg\n+\trm -f \"$GIT_DIR\"/.editmsg\n \tgit-status\n \texit 1\n fi\n case \"$no_edit\" in\n '')\n-\t${VISUAL:-${EDITOR:-vi}} .editmsg\n+\t${VISUAL:-${EDITOR:-vi}} \"$GIT_DIR\"/.editmsg\n \t;;\n esac\n \n@@ -214,16 +214,16 @@ case \"$verify\" in\n t)\n \tif test -x \"$GIT_DIR\"/hooks/commit-msg\n \tthen\n-\t\t\"$GIT_DIR\"/hooks/commit-msg .editmsg || exit\n+\t\t\"$GIT_DIR\"/hooks/commit-msg \"$GIT_DIR\"/.editmsg || exit\n \tfi\n esac\n \n-grep -v '^#' < .editmsg | git-stripspace > .cmitmsg\n-grep -v -i '^Signed-off-by' .cmitmsg >.cmitchk\n-if test -s .cmitchk\n+grep -v '^#' < \"$GIT_DIR\"/.editmsg | git-stripspace > \"$GIT_DIR\"/.cmitmsg\n+grep -v -i '^Signed-off-by' \"$GIT_DIR\"/.cmitmsg >\"$GIT_DIR\"/.cmitchk\n+if test -s \"$GIT_DIR\"/.cmitchk\n then\n \ttree=$(git-write-tree) &&\n-\tcommit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) &&\n+\tcommit=$(cat \"$GIT_DIR\"/.cmitmsg | git-commit-tree $tree $PARENTS) &&\n \tgit-update-ref HEAD $commit $current &&\n \trm -f -- \"$GIT_DIR/MERGE_HEAD\"\n else\n@@ -231,7 +231,7 @@ else\n \tfalse\n fi\n ret=\"$?\"\n-rm -f .cmitmsg .editmsg .cmitchk\n+rm -f \"$GIT_DIR\"/{.cmitmsg,.editmsg,.cmitchk}\n \n if test -x \"$GIT_DIR\"/hooks/post-commit && test \"$ret\" = 0\n then\n---\n0.99.8.GIT\n"},{"id":"9731","messageId":"7vk6griq8d.fsf@assigned-by-dhcp.cox.net","threadId":"2021","inReplyTo":"87achnq4z7.fsf@gmail.com","subject":"Re: [PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-05T21:54:58Z","receivedAt":"2005-10-05T21:54:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <sbejar@gmail.com> writes:\n\n> It appears in the git-status output during a git-commit if you have\n> something in info/exclude.\n\n... which does not worry me too much; you'll get used to it ;-).\n\n> Also for .cmitmsg and .cmitchk to make git-commit work\n> in read-only working trees.\n\nIf a working tree is read-only, I wonder what you are committing.\n\nIt might not be a bad idea to think about this a bit more before\nactually coding.  You are moving things out of the working tree\nroot level, which is a valid thing to do when worrying about a\nrepository (or working tree) that you do not have write access\nto.  We've had a fix similar to this for temporary files used by\ndiff commands, which moved them to $TMPDIR or something like\nthat.  If the working tree root level is not writable for you,\nis it valid/reasonable to assume that $GIT_DIR is?  Are there\nbetter places?  E.g. perhaps $HOME/.gittmp/?\n\n>  ret=\"$?\"\n> -rm -f .cmitmsg .editmsg .cmitchk\n> +rm -f \"$GIT_DIR\"/{.cmitmsg,.editmsg,.cmitchk}\n\nPlease do not do \"{a,b,c}\".  I think ksh can grok the rest of\nthe git-commit.sh code, but not this.\n"},{"id":"9761","messageId":"8aa486160510060630m2afb18ffx@mail.gmail.com","threadId":"2021","inReplyTo":"7vk6griq8d.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.","fromName":"Santi Bejar","fromEmail":"sbejar@gmail.com","sentAt":"2005-10-06T13:30:30Z","receivedAt":"2005-10-06T13:30:30Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2005/10/5, Junio C Hamano <junkio@cox.net>:\n> Santi B\u001b.A\u001bNijar <sbejar@gmail.com> writes:\n>\n> > It appears in the git-status output during a git-commit if you have\n> > something in info/exclude.\n>\n> ... which does not worry me too much; you'll get used to it ;-).\n>\n\nI'm used too, but I don't think it's a 1.0 thing.\n\n> > Also for .cmitmsg and .cmitchk to make git-commit work\n> > in read-only working trees.\n>\n> If a working tree is read-only, I wonder what you are committing.\n>\n\nI keep my /etc modifications in git, and I want to commit as a user not as root.\n\n> It might not be a bad idea to think about this a bit more before\n> actually coding.  You are moving things out of the working tree\n> root level, which is a valid thing to do when worrying about a\n> repository (or working tree) that you do not have write access\n> to.  We've had a fix similar to this for temporary files used by\n> diff commands, which moved them to $TMPDIR or something like\n> that.  If the working tree root level is not writable for you,\n> is it valid/reasonable to assume that $GIT_DIR is?  Are there\n> better places?  E.g. perhaps $HOME/.gittmp/?\n\nYes, it was just quick. I think the best way would be to write to /tmp\nbut honor $TMPDIR.\n\n>\n> >  ret=\"$?\"\n> > -rm -f .cmitmsg .editmsg .cmitchk\n> > +rm -f \"$GIT_DIR\"/{.cmitmsg,.editmsg,.cmitchk}\n>\n> Please do not do \"{a,b,c}\".  I think ksh can grok the rest of\n> the git-commit.sh code, but not this.\n\nOK.\n"},{"id":"9775","messageId":"7vpsqi8kke.fsf@assigned-by-dhcp.cox.net","threadId":"2021","inReplyTo":"8aa486160510060630m2afb18ffx@mail.gmail.com","subject":"Re: [PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-06T20:19:45Z","receivedAt":"2005-10-06T20:19:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Bejar <sbejar@gmail.com> writes:\n\n>> If a working tree is read-only, I wonder what you are committing.\n>\n> I keep my /etc modifications in git, and I want to commit as a\n> user not as root.\n\nOK.  Your /etc/.git is writable by you but /etc is not.\nAlthough I personally would do it a bit differently (my /etc\nsources would live in a different area which is a source tree\nand 'make install' as root would install the latest to /etc; no\nneed for anything user writable under /etc, including\n/etc/.git/), I do not think your set-up is wrong -- we should\nsupport it.\n\n>> ... If the working tree root level is not writable for you,\n>> is it valid/reasonable to assume that $GIT_DIR is?\n\nI changed my mind about this.  $GIT_DIR by definition should be\nwritable by you since we are talking about committing -- I think\nmoving them to $GIT_DIR/ is a good change.\n"}]}