Allow whole-tree operations to be started from a subdirectory
[gitweb.git] / git-merge.sh
index ba42260426296b63070a1fbdc22a9b77ea5ac412..7de83dc76c442e2187c66d32bc704a063ab83781 100755 (executable)
@@ -5,8 +5,14 @@
 
 USAGE='[-n] [--no-commit] [--squash] [-s <strategy>] [-m=<merge-message>] <commit>+'
 
+SUBDIRECTORY_OK=Yes
 . git-sh-setup
 set_reflog_action "merge $*"
+require_work_tree
+cd_to_toplevel
+
+test -z "$(git ls-files -u)" ||
+       die "You are in the middle of a conflicted merge."
 
 LF='
 '