projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finish git-am documentation.
[git.git]
/
git-commit.sh
diff --git
a/git-commit.sh
b/git-commit.sh
index
9412840
..
96a884f
100755
(executable)
--- a/
git-commit.sh
+++ b/
git-commit.sh
@@
-94,13
+94,13
@@
esac
case "$all,$#" in
t,*)
git-diff-files --name-only -z |
case "$all,$#" in
t,*)
git-diff-files --name-only -z |
- xargs -0 git-update-index -q --remove --
+ git-update-index --remove -z --stdin
;;
,0)
;;
*)
;;
,0)
;;
*)
- git-diff-files --name-only -z "$@" |
- xargs -0 git-update-index -q --remove --
+ git-diff-files --name-only -z
--
"$@" |
+ git-update-index --remove -z --stdin
;;
esac || exit 1
git-update-index -q --refresh || exit 1
;;
esac || exit 1
git-update-index -q --refresh || exit 1
@@
-129,14
+129,17
@@
then
elif test "$use_commit" != ""
then
git-cat-file commit "$use_commit" | sed -e '1,/^$/d'
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)
case "$signoff" in
t)
- git-var GIT_COMMITTER_IDENT | sed -e '
- s/>.*/>/
- s/^/Signed-off-by: /
- ' >>.editmsg
+ {
+ echo
+ git-var GIT_COMMITTER_IDENT | sed -e '
+ s/>.*/>/
+ s/^/Signed-off-by: /
+ '
+ } >>"$GIT_DIR"/COMMIT_EDITMSG
;;
esac
;;
esac
@@
-150,16
+153,11
@@
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
echo "# $GIT_DIR/MERGE_HEAD"
echo "# and try again"
echo "#"
echo "# $GIT_DIR/MERGE_HEAD"
echo "# and try again"
echo "#"
-fi >>
.editmsg
+fi >>
"$GIT_DIR"/COMMIT_EDITMSG
PARENTS="-p HEAD"
PARENTS="-p HEAD"
-if [ ! -r "$GIT_DIR/HEAD" ]; then
- if [ -z "$(git-ls-files)" ]; then
- echo Nothing to commit 1>&2
- exit 1
- fi
- PARENTS=""
-else
+if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1
+then
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
fi
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
fi
@@
-192,17
+190,23
@@
else
export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE
fi
export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE
fi
+else
+ if [ -z "$(git-ls-files)" ]; then
+ echo Nothing to commit 1>&2
+ exit 1
+ fi
+ PARENTS=""
fi
fi
-git-status >>
.editmsg
-if [ "$?" != "0" -a ! -f
$GIT_DIR/MERGE_HEAD
]
+git-status >>
"$GIT_DIR"/COMMIT_EDITMSG
+if [ "$?" != "0" -a ! -f
"$GIT_DIR/MERGE_HEAD"
]
then
then
- rm -f
.editmsg
+ rm -f
"$GIT_DIR/COMMIT_EDITMSG"
git-status
exit 1
fi
case "$no_edit" in
'')
git-status
exit 1
fi
case "$no_edit" in
'')
- ${VISUAL:-${EDITOR:-vi}}
.editmsg
+ ${VISUAL:-${EDITOR:-vi}}
"$GIT_DIR/COMMIT_EDITMSG"
;;
esac
;;
esac
@@
-210,24
+214,28
@@
case "$verify" in
t)
if test -x "$GIT_DIR"/hooks/commit-msg
then
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
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) &&
then
tree=$(git-write-tree) &&
- commit=$(cat
.cmitmsg
| git-commit-tree $tree $PARENTS) &&
-
echo $commit > "$GIT_DIR/HEAD"
&&
+ commit=$(cat
"$GIT_DIR"/COMMIT_MSG
| git-commit-tree $tree $PARENTS) &&
+
git-update-ref HEAD $commit $current
&&
rm -f -- "$GIT_DIR/MERGE_HEAD"
else
echo >&2 "* no commit message? aborting commit."
false
fi
ret="$?"
rm -f -- "$GIT_DIR/MERGE_HEAD"
else
echo >&2 "* no commit message? aborting commit."
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
if test -x "$GIT_DIR"/hooks/post-commit && test "$ret" = 0
then