git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die, complaining that it is outside git repository. So move the code that dies from all callers to git-sh-setup script. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
e8cc80d039
commit
ae2b0f1518
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
echo >&2 "usage: $0 [--signoff] [--dotest=<dir>] [--utf8] [--binary] [--3way] <mbox>"
|
||||
|
@ -18,7 +18,7 @@
|
||||
##
|
||||
## git-am is supposed to be the newer and better tool for this job.
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
echo >&2 "applymbox [-u] [-k] [-q] [-m] (-c .dotest/<num> | mbox) [signoff]"
|
||||
|
@ -10,7 +10,7 @@
|
||||
## $3 - "info" file with Author, email and subject
|
||||
## $4 - optional file containing signoff to add
|
||||
##
|
||||
. git-sh-setup || die "Not a git archive."
|
||||
. git-sh-setup
|
||||
|
||||
final=.dotest/final-commit
|
||||
##
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
. git-sh-setup || dir "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage() {
|
||||
echo >&2 'usage: git bisect [start|bad|good|next|reset|visualize]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
echo >&2 "usage: $(basename $0)"' [-d <branch>] | [[-f] <branch> [start-point]]
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
die "usage: git checkout [-f] [-b <new_branch>] [<branch>] [<paths>...]"
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Junio C Hamano.
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git archive."
|
||||
. git-sh-setup
|
||||
|
||||
usage="usage: $0 "'[-v] <upstream> [<head>]
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Linus Torvalds
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
die 'git commit [-a] [-s] [-v | --no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-e] [<path>...]'
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Junio C Hamano
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git repository"
|
||||
. git-sh-setup
|
||||
|
||||
dc </dev/null 2>/dev/null || {
|
||||
# This is not a real DC at all -- it just knows how
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
. git-parse-remote
|
||||
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
|
||||
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Junio C Hamano
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git archive."
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
echo >&2 "usage: $0"' [-n] [-o dir | --stdout] [--keep-subject] [--mbox]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. git-sh-setup || die "Not a git archive."
|
||||
. git-sh-setup
|
||||
|
||||
laf="$GIT_DIR/lost-found"
|
||||
rm -fr "$laf" && mkdir -p "$laf/commit" "$laf/other" || exit
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Junio C Hamano
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
LF='
|
||||
'
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Resolve two or more trees recorded in $GIT_DIR/FETCH_HEAD.
|
||||
#
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
die "usage: git octopus"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
dryrun=
|
||||
echo=
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Fetch one or more remote refs and merge it/them into the current HEAD.
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
echo >&2 "usage: $0"' [-n] [--no-commit] [--no-summary] [--help]
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
die "Usage: git push [--all] [--force] <repository> [<refspec>]"
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Junio C Hamano.
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git archive."
|
||||
. git-sh-setup
|
||||
|
||||
# The other head is given
|
||||
other=$(git-rev-parse --verify "$1^0") || exit
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Linus Torvalds
|
||||
#
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
no_update_info= all_into_one= remove_redundant= local=
|
||||
while case "$#" in 0) break ;; esac
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
die 'Usage: git reset [--mixed | --soft | --hard] [<commit-ish>]'
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Resolve two trees.
|
||||
#
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
die "git-resolve <head> <remote> <merge-message>"
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2005 Linus Torvalds
|
||||
# Copyright (c) 2005 Junio C Hamano
|
||||
#
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
case "$0" in
|
||||
*-revert* )
|
||||
|
@ -1,10 +1,9 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Set up GIT_DIR and GIT_OBJECT_DIRECTORY
|
||||
# and return true if everything looks ok
|
||||
#
|
||||
: ${GIT_DIR=.git}
|
||||
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
|
||||
# This is included in commands that either have to be run from the toplevel
|
||||
# of the repository, or with GIT_DIR environment variable properly.
|
||||
# If the GIT_DIR does not look like the right correct git-repository,
|
||||
# it dies.
|
||||
|
||||
# Having this variable in your environment would break scripts because
|
||||
# you would cause "cd" to be be taken to unexpected places. If you
|
||||
@ -12,6 +11,9 @@
|
||||
# exporting it.
|
||||
unset CDPATH
|
||||
|
||||
: ${GIT_DIR=.git}
|
||||
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
|
||||
|
||||
die() {
|
||||
echo >&2 "$@"
|
||||
exit 1
|
||||
@ -22,4 +24,5 @@ refs/*) : ;;
|
||||
*) false ;;
|
||||
esac &&
|
||||
[ -d "$GIT_DIR/refs" ] &&
|
||||
[ -d "$GIT_OBJECT_DIRECTORY/" ]
|
||||
[ -d "$GIT_OBJECT_DIRECTORY/" ] ||
|
||||
die "Not a git repository."
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Copyright (c) 2005 Linus Torvalds
|
||||
#
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
GIT_DIR=$(git-rev-parse --git-dir) || exit
|
||||
|
||||
report () {
|
||||
header="#
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2005 Linus Torvalds
|
||||
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
usage () {
|
||||
echo >&2 "Usage: git-tag [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <tagname> [<head>]"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
. git-sh-setup || die "Not a git archive"
|
||||
. git-sh-setup
|
||||
|
||||
type="$(git-cat-file -t "$1" 2>/dev/null)" ||
|
||||
die "$1: no such object."
|
||||
|
Loading…
Reference in New Issue
Block a user