Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Define cd_to_toplevel shell function in git-sh-setup
author
Junio C Hamano
<junkio@cox.net>
Fri, 12 Jan 2007 20:44:08 +0000
(12:44 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Sat, 13 Jan 2007 00:54:38 +0000
(16:54 -0800)
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-sh-setup.sh
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
b60daf0
)
diff --git
a/git-sh-setup.sh
b/git-sh-setup.sh
index 57f7f7777602eadc79b6bb04e6652d81d14d770c..6b1c1423ebb7fde53aae566fa09211d331c422bc 100755
(executable)
--- a/
git-sh-setup.sh
+++ b/
git-sh-setup.sh
@@
-36,6
+36,17
@@
is_bare_repository () {
esac
}
+cd_to_toplevel () {
+ cdup=$(git-rev-parse --show-cdup)
+ if test ! -z "$cdup"
+ then
+ cd "$cdup" || {
+ echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
+ exit 1
+ }
+ fi
+}
+
require_work_tree () {
test $(is_bare_repository) = false ||
die "fatal: $0 cannot be used without a working tree."