summaryrefslogtreecommitdiff
path: root/git-merge.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-12-31 04:32:38 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-10 23:03:09 (GMT)
commit7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9 (patch)
treec22c8cf02e3b09568198fa405ba7322aafe328ae /git-merge.sh
parent4b441f47cefe7f4861167a151a395606e1a16745 (diff)
downloadgit-7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9.zip
git-7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9.tar.gz
git-7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9.tar.bz2
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-merge.sh')
-rwxr-xr-xgit-merge.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-merge.sh b/git-merge.sh
index 4770029..3eef048 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -7,6 +7,7 @@ USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commi
. git-sh-setup
set_reflog_action "merge $*"
+require_work_tree
test -z "$(git ls-files -u)" ||
die "You are in a middle of conflicted merge."