diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-12-12 17:46:16 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-12-12 17:46:16 -0800 |
commit | 467f42cfa1d298dcaab40e06f8dfa8f80ee345f7 (patch) | |
tree | 8f8e4f458b0a74e2f827eaf746d26c008037bb67 /git-sh-setup.sh | |
parent | cd1bea918bde5b32cf29159acac067bd238825b3 (diff) | |
parent | 39bf13f2d6aaec6ff34bf367f2497fc9247c721f (diff) | |
download | git-467f42cfa1d298dcaab40e06f8dfa8f80ee345f7.tar.gz |
Merge branch 'cc/help'
* cc/help:
RPM spec: Adjust htmldir
git-help -w: do not require to be in git repository
git.spec.in: remove python_path
Documentation: rename git.texi to user-manual.texi
Add git-browse-help to .gitignore
git-help -i: show info documentation from matching version of git
git-help -i: invoke info with document and node name
Documentation: add gitman.info target
Documentation: describe -w/--web option to "git-help".
Use {web,instaweb,help}.browser config options.
git-help: add -w|--web option to display html man page in a browser.
Documentation: describe -i/--info option to "git-help"
git-help: add -i|--info option to display info page.
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-x | git-sh-setup.sh | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 5aa62dda15..b366761b97 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -122,26 +122,33 @@ get_author_ident_from_commit () { LANG=C LC_ALL=C sed -ne "$pick_author_script" } -# Make sure we are in a valid repository of a vintage we understand. -if [ -z "$SUBDIRECTORY_OK" ] +# Make sure we are in a valid repository of a vintage we understand, +# if we require to be in a git repository. +if test -n "$NONGIT_OK" then - : ${GIT_DIR=.git} - test -z "$(git rev-parse --show-cdup)" || { - exit=$? - echo >&2 "You need to run this command from the toplevel of the working tree." - exit $exit - } + if git rev-parse --git-dir >/dev/null 2>&1 + then + : ${GIT_DIR=.git} + fi else - GIT_DIR=$(git rev-parse --git-dir) || { - exit=$? - echo >&2 "Failed to find a valid git directory." - exit $exit + if [ -z "$SUBDIRECTORY_OK" ] + then + : ${GIT_DIR=.git} + test -z "$(git rev-parse --show-cdup)" || { + exit=$? + echo >&2 "You need to run this command from the toplevel of the working tree." + exit $exit + } + else + GIT_DIR=$(git rev-parse --git-dir) || { + exit=$? + echo >&2 "Failed to find a valid git directory." + exit $exit + } + fi + test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || { + echo >&2 "Unable to determine absolute path of git directory" + exit 1 } + : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} fi - -test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || { - echo >&2 "Unable to determine absolute path of git directory" - exit 1 -} - -: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} |