aboutsummaryrefslogtreecommitdiff
path: root/git-pull.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-20 14:42:59 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-20 14:42:59 -0800
commit71b3ef11fa0aade4a514c51b83438858a4a3c03b (patch)
tree6cea8215ecc0e70c8f19e04c51327deda93672d3 /git-pull.sh
parentf922df8655675aafaea96f3715c9473c63d2ca47 (diff)
parentd38a30df7dd54c5c6883af1de1a03ec7d523cee5 (diff)
downloadgit-71b3ef11fa0aade4a514c51b83438858a4a3c03b.tar.xz
Merge branch 'mm/conflict-advice'
* mm/conflict-advice: Be more user-friendly when refusing to do something because of conflict. Conflicts: Documentation/config.txt advice.c advice.h
Diffstat (limited to 'git-pull.sh')
-rwxr-xr-xgit-pull.sh25
1 files changed, 23 insertions, 2 deletions
diff --git a/git-pull.sh b/git-pull.sh
index 9e69ada413..54ce0af2d4 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -13,8 +13,29 @@ set_reflog_action "pull $*"
require_work_tree
cd_to_toplevel
-test -z "$(git ls-files -u)" ||
- die "You are in the middle of a conflicted merge."
+
+die_conflict () {
+ git diff-index --cached --name-status -r --ignore-submodules HEAD --
+ if [ $(git config --bool --get advice.resolveConflict || echo true) = "true" ]; then
+ die "Pull is not possible because you have unmerged files.
+Please, fix them up in the work tree, and then use 'git add/rm <file>'
+as appropriate to mark resolution, or use 'git commit -a'."
+ else
+ die "Pull is not possible because you have unmerged files."
+ fi
+}
+
+die_merge () {
+ if [ $(git config --bool --get advice.resolveConflict || echo true) = "true" ]; then
+ die "You have not concluded your merge (MERGE_HEAD exists).
+Please, commit your changes before you can merge."
+ else
+ die "You have not concluded your merge (MERGE_HEAD exists)."
+ fi
+}
+
+test -z "$(git ls-files -u)" || die_conflict
+test -f "$GIT_DIR/MERGE_HEAD" && die_merge
strategy_args= diffstat= no_commit= squash= no_ff= ff_only=
log_arg= verbosity=