OSDN Git Service
(root)
/
git-core
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b60daf0
)
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
diff --git
a/git-sh-setup.sh
b/git-sh-setup.sh
index
57f7f77
..
6b1c142
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."