git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Santi Béjar" <sbejar@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] Write .editmsg in GIT_DIR to avoid being in git-status.
Date: Wed, 05 Oct 2005 18:54:36 +0200	[thread overview]
Message-ID: <87achnq4z7.fsf@gmail.com> (raw)


It appears in the git-status output during a git-commit if you have
something in info/exclude.

Also for .cmitmsg and .cmitchk to make git-commit work
in read-only working trees.

Signed-off-by: Santi Béjar <sbejar@gmail.com>


---

 git-commit.sh |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

applies-to: 9eec9ff9326032bca405a12a265918725edf4ac7
4e61f41c1feed7345fc442747c82b9ea701fb59c
diff --git a/git-commit.sh b/git-commit.sh
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -129,7 +129,7 @@ then
 elif test "$use_commit" != ""
 then
 	git-cat-file commit "$use_commit" | sed -e '1,/^$/d'
-fi | git-stripspace >.editmsg
+fi | git-stripspace >"$GIT_DIR"/.editmsg 
 
 case "$signoff" in
 t)
@@ -139,7 +139,7 @@ t)
 			s/>.*/>/
 			s/^/Signed-off-by: /
 		'
-	} >>.editmsg
+	} >>"$GIT_DIR"/.editmsg
 	;;
 esac
 
@@ -153,7 +153,7 @@ if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
 	echo "#	$GIT_DIR/MERGE_HEAD"
 	echo "# and try again"
 	echo "#"
-fi >>.editmsg
+fi >>"$GIT_DIR"/.editmsg
 
 PARENTS="-p HEAD"
 if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1
@@ -197,16 +197,16 @@ else
 	fi
 	PARENTS=""
 fi
-git-status >>.editmsg
+git-status >>"$GIT_DIR"/.editmsg
 if [ "$?" != "0" -a ! -f $GIT_DIR/MERGE_HEAD ]
 then
-	rm -f .editmsg
+	rm -f "$GIT_DIR"/.editmsg
 	git-status
 	exit 1
 fi
 case "$no_edit" in
 '')
-	${VISUAL:-${EDITOR:-vi}} .editmsg
+	${VISUAL:-${EDITOR:-vi}} "$GIT_DIR"/.editmsg
 	;;
 esac
 
@@ -214,16 +214,16 @@ case "$verify" in
 t)
 	if test -x "$GIT_DIR"/hooks/commit-msg
 	then
-		"$GIT_DIR"/hooks/commit-msg .editmsg || exit
+		"$GIT_DIR"/hooks/commit-msg "$GIT_DIR"/.editmsg || exit
 	fi
 esac
 
-grep -v '^#' < .editmsg | git-stripspace > .cmitmsg
-grep -v -i '^Signed-off-by' .cmitmsg >.cmitchk
-if test -s .cmitchk
+grep -v '^#' < "$GIT_DIR"/.editmsg | git-stripspace > "$GIT_DIR"/.cmitmsg
+grep -v -i '^Signed-off-by' "$GIT_DIR"/.cmitmsg >"$GIT_DIR"/.cmitchk
+if test -s "$GIT_DIR"/.cmitchk
 then
 	tree=$(git-write-tree) &&
-	commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) &&
+	commit=$(cat "$GIT_DIR"/.cmitmsg | git-commit-tree $tree $PARENTS) &&
 	git-update-ref HEAD $commit $current &&
 	rm -f -- "$GIT_DIR/MERGE_HEAD"
 else
@@ -231,7 +231,7 @@ else
 	false
 fi
 ret="$?"
-rm -f .cmitmsg .editmsg .cmitchk
+rm -f "$GIT_DIR"/{.cmitmsg,.editmsg,.cmitchk}
 
 if test -x "$GIT_DIR"/hooks/post-commit && test "$ret" = 0
 then
---
0.99.8.GIT

             reply	other threads:[~2005-10-05 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05 16:54 Santi Béjar [this message]
2005-10-05 21:54 ` [PATCH] Write .editmsg in GIT_DIR to avoid being in git-status Junio C Hamano
2005-10-06 13:30   ` Santi Bejar
2005-10-06 20:19     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87achnq4z7.fsf@gmail.com \
    --to=sbejar@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).