aboutsummaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-12 12:49:05 -0800
committerJunio C Hamano <junkio@cox.net>2007-01-12 16:54:38 -0800
commit514c09fdcfef6385f1a61ee52344794356c99986 (patch)
tree54aae1aa9262a75465bfb093761e85308a5164b0 /git-commit.sh
parent9fde9401a9c3974a407f302d60a1b75e8787f715 (diff)
downloadgit-514c09fdcfef6385f1a61ee52344794356c99986.tar.gz
git-514c09fdcfef6385f1a61ee52344794356c99986.tar.xz
Use cd_to_toplevel in scripts that implement it by hand.
This converts scripts that do "cd $(rev-parse --show-cdup)" by hand to use cd_to_toplevel. I think git-fetch does not have to go to the toplevel, but that should be dealt with in a separate patch. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh22
1 files changed, 8 insertions, 14 deletions
diff --git a/git-commit.sh b/git-commit.sh
index eddd86301..9fdf234b5 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -316,22 +316,16 @@ esac
################################################################
# Prepare index to have a tree to be committed
-TOP=`git-rev-parse --show-cdup`
-if test -z "$TOP"
-then
- TOP=./
-fi
-
case "$all,$also" in
t,)
save_index &&
(
- cd "$TOP"
- GIT_INDEX_FILE="$NEXT_INDEX"
- export GIT_INDEX_FILE
+ cd_to_toplevel &&
+ GIT_INDEX_FILE="$NEXT_INDEX" &&
+ export GIT_INDEX_FILE &&
git-diff-files --name-only -z |
git-update-index --remove -z --stdin
- )
+ ) || exit
;;
,t)
save_index &&
@@ -339,11 +333,11 @@ t,)
git-diff-files --name-only -z -- "$@" |
(
- cd "$TOP"
- GIT_INDEX_FILE="$NEXT_INDEX"
- export GIT_INDEX_FILE
+ cd_to_toplevel &&
+ GIT_INDEX_FILE="$NEXT_INDEX" &&
+ export GIT_INDEX_FILE &&
git-update-index --remove -z --stdin
- )
+ ) || exit
;;
,)
case "$#" in