diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2006-12-30 23:32:38 -0500 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-10 15:03:09 -0800 |
commit | 7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9 (patch) | |
tree | c22c8cf02e3b09568198fa405ba7322aafe328ae /git-sh-setup.sh | |
parent | 4b441f47cefe7f4861167a151a395606e1a16745 (diff) | |
download | git-7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9.tar.gz |
Disallow working directory commands in a bare repository.
If the user tries to run a porcelainish command which requires
a working directory in a bare repository they may get unexpected
results which are difficult to predict and may differ from command
to command.
Instead we should detect that the current repository is a bare
repository and refuse to run the command there, as there is no
working directory associated with it.
[jc: updated Shawn's original somewhat -- bugs are mine.]
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-x | git-sh-setup.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 7fdc912167..4a02b3825e 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -36,6 +36,11 @@ is_bare_repository () { esac } +require_work_tree () { + test $(is_bare_repository) = false || + die "fatal: $0 cannot be used without a working tree." +} + if [ -z "$LONG_USAGE" ] then LONG_USAGE="Usage: $0 $USAGE" |