summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-14 19:41:36 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-14 19:41:36 (GMT)
commit3681d40b965258f7559235642c75f2117476765e (patch)
tree61247899bdc5cd8a5109a568251e6ab3ffd1cf44 /git-commit.sh
parente6e2bd6201d32342df7a713c847161ab296885ea (diff)
parent533b70390e540de4e0faed4823ee561c8368e5ec (diff)
downloadgit-3681d40b965258f7559235642c75f2117476765e.zip
git-3681d40b965258f7559235642c75f2117476765e.tar.gz
git-3681d40b965258f7559235642c75f2117476765e.tar.bz2
Merge branch 'jc/subdir'
* jc/subdir: Allow whole-tree operations to be started from a subdirectory Use cd_to_toplevel in scripts that implement it by hand. Define cd_to_toplevel shell function in git-sh-setup
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 eddd863..9fdf234 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