From f8e2c54c9a17af3319e96db1d9e97ace36ae6831 Mon Sep 17 00:00:00 2001 From: Santi_Béjar Date: Sun, 9 Oct 2005 17:30:19 -0700 Subject: Write .editmsg in GIT_DIR to avoid being in git-status. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. [jc: while we are at it, I removed the use of .cmitchk temporary file which was not necessary, and renamed them -- they are out of way now and do not have to be dotfiles anymore.] Signed-off-by: Santi Béjar Signed-off-by: Junio C Hamano --- git-commit.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'git-commit.sh') diff --git a/git-commit.sh b/git-commit.sh index 591fcdceb1..5bdee54a46 100755 --- 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"/COMMIT_EDITMSG case "$signoff" in t) @@ -139,7 +139,7 @@ t) s/>.*/>/ s/^/Signed-off-by: / ' - } >>.editmsg + } >>"$GIT_DIR"/COMMIT_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"/COMMIT_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"/COMMIT_EDITMSG if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" ] then - rm -f .editmsg + rm -f "$GIT_DIR/COMMIT_EDITMSG" git-status exit 1 fi case "$no_edit" in '') - ${VISUAL:-${EDITOR:-vi}} .editmsg + ${VISUAL:-${EDITOR:-vi}} "$GIT_DIR/COMMIT_EDITMSG" ;; esac @@ -214,16 +214,20 @@ 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"/COMMIT_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"/COMMIT_EDITMSG | +git-stripspace > "$GIT_DIR"/COMMIT_MSG + +if cnt=`grep -v -i '^Signed-off-by' "$GIT_DIR"/COMMIT_MSG | + git-stripspace | + wc -l` && + test 0 -lt $cnt then tree=$(git-write-tree) && - commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) && + commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) && git-update-ref HEAD $commit $current && rm -f -- "$GIT_DIR/MERGE_HEAD" else @@ -231,7 +235,7 @@ else false fi ret="$?" -rm -f .cmitmsg .editmsg .cmitchk +rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" if test -x "$GIT_DIR"/hooks/post-commit && test "$ret" = 0 then -- cgit v1.3 From 4bfe1199eabb41eb1f1d67f4ee24df028eb21300 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 18 Oct 2005 00:27:50 -0700 Subject: Teach git-add and git-commit to handle filenames starting with '-'. Recent '--' fixes to "git diff" by Linus made it possible to specify filenames that start with '-'. But in order to do that, you need to be able to add and commit such file to begin with. Teach git-add and git-commit to honor the same '--' convention. Signed-off-by: Junio C Hamano --- git-add.sh | 4 ++-- git-commit.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'git-commit.sh') diff --git a/git-add.sh b/git-add.sh index a8498c729a..4bf41281d5 100755 --- a/git-add.sh +++ b/git-add.sh @@ -23,10 +23,10 @@ if test -f "$GIT_DIR/info/exclude" then git-ls-files -z \ --exclude-from="$GIT_DIR/info/exclude" \ - --others --exclude-per-directory=.gitignore "$@" + --others --exclude-per-directory=.gitignore -- "$@" else git-ls-files -z \ - --others --exclude-per-directory=.gitignore "$@" + --others --exclude-per-directory=.gitignore -- "$@" fi | case "$show_only" in true) diff --git a/git-commit.sh b/git-commit.sh index 5bdee54a46..96a884f3bc 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -99,7 +99,7 @@ t,*) ,0) ;; *) - git-diff-files --name-only -z "$@" | + git-diff-files --name-only -z -- "$@" | git-update-index --remove -z --stdin ;; esac || exit 1 -- cgit v1.3 From 0363ecf6414e75d4423814ba930f67edaef91683 Mon Sep 17 00:00:00 2001 From: "c.shoemaker@cox.net" Date: Sat, 29 Oct 2005 00:16:12 -0400 Subject: update usage string for git-commit.sh Signed-off-by: Chris Shoemaker Signed-off-by: Junio C Hamano --- git-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-commit.sh') diff --git a/git-commit.sh b/git-commit.sh index 96a884f3bc..10651d87d0 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -6,7 +6,7 @@ . git-sh-setup || die "Not a git archive" usage () { - die 'git commit [-a] [-v | --no-verify] [-m ] [-F ] [(-C|-c) ] [...]' + die 'git commit [-a] [-s] [-v | --no-verify] [-m | -F | (-C|-c) ] [-e] [...]' } all= logfile= use_commit= no_edit= log_given= log_message= verify=t signoff= -- cgit v1.3