projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Document git-ls-files --directory
[git.git]
/
git-merge.sh
diff --git
a/git-merge.sh
b/git-merge.sh
index
d352a3c
..
0a158ef
100755
(executable)
--- a/
git-merge.sh
+++ b/
git-merge.sh
@@
-3,15
+3,13
@@
# Copyright (c) 2005 Junio C Hamano
#
# Copyright (c) 2005 Junio C Hamano
#
+
+USAGE='[-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+'
. git-sh-setup
LF='
'
. git-sh-setup
LF='
'
-usage () {
- die "git-merge [-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+"
-}
-
all_strategies='recursive octopus resolve stupid ours'
default_strategies='recursive'
use_strategies=
all_strategies='recursive octopus resolve stupid ours'
default_strategies='recursive'
use_strategies=
@@
-97,11
+95,14
@@
head=$(git-rev-parse --verify "$1"^0) || usage
shift
# All the rest are remote heads
shift
# All the rest are remote heads
+remoteheads=
for remote
do
for remote
do
-
git-rev-parse --verify "$remote"^0 >/dev/null
||
+
remotehead=$(git-rev-parse --verify "$remote"^0)
||
die "$remote - not something we can merge"
die "$remote - not something we can merge"
+ remoteheads="${remoteheads}$remotehead "
done
done
+set x $remoteheads ; shift
case "$#" in
1)
case "$#" in
1)
@@
-208,6
+209,7
@@
case "$use_strategies" in
esac
result_tree= best_cnt=-1 best_strategy= wt_strategy=
esac
result_tree= best_cnt=-1 best_strategy= wt_strategy=
+merge_was_ok=
for strategy in $use_strategies
do
test "$wt_strategy" = '' || {
for strategy in $use_strategies
do
test "$wt_strategy" = '' || {
@@
-227,6
+229,7
@@
do
exit=$?
if test "$no_commit" = t && test "$exit" = 0
then
exit=$?
if test "$no_commit" = t && test "$exit" = 0
then
+ merge_was_ok=t
exit=1 ;# pretend it left conflicts.
fi
exit=1 ;# pretend it left conflicts.
fi
@@
-273,7
+276,8
@@
fi
case "$best_strategy" in
'')
restorestate
case "$best_strategy" in
'')
restorestate
- die "No merge strategy handled the merge."
+ echo >&2 "No merge strategy handled the merge."
+ exit 2
;;
"$wt_strategy")
# We already have its result in the working tree.
;;
"$wt_strategy")
# We already have its result in the working tree.
@@
-291,4
+295,11
@@
do
done >"$GIT_DIR/MERGE_HEAD"
echo $merge_msg >"$GIT_DIR/MERGE_MSG"
done >"$GIT_DIR/MERGE_HEAD"
echo $merge_msg >"$GIT_DIR/MERGE_MSG"
-die "Automatic merge failed/prevented; fix up by hand"
+if test "$merge_was_ok" = t
+then
+ echo >&2 \
+ "Automatic merge went well; stopped before committing as requested"
+ exit 0
+else
+ die "Automatic merge failed; fix up by hand"
+fi