99'
1010
1111usage () {
12- die " git-merge [-n] [-s <strategy>]... <merge-message> <head> <remote>+"
12+ die " git-merge [-n] [--no-commit] [- s <strategy>]... <merge-message> <head> <remote>+"
1313}
1414
1515# all_strategies='resolve recursive stupid octopus'
6363 -n|--n|--no|--no-|--no-s|--no-su|--no-sum|--no-summ|\
6464 --no-summa|--no-summar|--no-summary)
6565 no_summary=t ;;
66+ --no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)
67+ no_commit=t ;;
6668 -s=* |--s=* |--st=* |--str=* |--stra=* |--strat=* |--strate=* |\
6769 --strateg=* |--strategy=* |\
6870 -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
@@ -111,18 +113,18 @@ done
111113common=$( git-show-branch --merge-base $head " $@ " )
112114echo " $head " > " $GIT_DIR /ORIG_HEAD"
113115
114- case " $# ,$common " in
115- * ,' ' )
116+ case " $# ,$common , $no_commit " in
117+ * ,' ' , * )
116118 # No common ancestors found. We need a real merge.
117119 ;;
118- 1," $1 " )
120+ 1," $1 " , * )
119121 # If head can reach all the merge then we are up to date.
120122 # but first the most common case of merging one remote
121123 echo " Already up-to-date."
122124 dropsave
123125 exit 0
124126 ;;
125- 1," $head " )
127+ 1," $head " , * )
126128 # Again the most common case of merging one remote.
127129 echo " Updating from $head to $1 ."
128130 git-update-index --refresh 2> /dev/null
@@ -132,11 +134,11 @@ case "$#,$common" in
132134 dropsave
133135 exit 0
134136 ;;
135- 1,?* " $LF " ?* )
137+ 1,?* " $LF " ?* , * )
136138 # We are not doing octopus and not fast forward. Need a
137139 # real merge.
138140 ;;
139- 1,* )
141+ 1,* , )
140142 # We are not doing octopus, not fast forward, and have only
141143 # one common. See if it is really trivial.
142144 echo " Trying really trivial in-index merge..."
210212 # Remember which strategy left the state in the working tree
211213 wt_strategy=$strategy
212214
213- git-merge-$strategy $common -- " $head_arg " " $@ " || {
215+ git-merge-$strategy $common -- " $head_arg " " $@ "
216+ exit=$?
217+ if test " $no_commit " = t && test " $exit " = 0
218+ then
219+ exit=1 ; # pretend it left conflicts.
220+ fi
221+
222+ test " $exit " = 0 || {
214223
215224 # The backend exits with 1 when conflicts are left to be resolved,
216225 # with 2 when it does not handle the given merge at all.
217226
218- exit=$?
219227 if test " $exit " -eq 1
220228 then
221229 cnt=` {
272280done > " $GIT_DIR /MERGE_HEAD"
273281echo $merge_msg > " $GIT_DIR /MERGE_MSG"
274282
275- die " Automatic merge failed; fix up by hand"
283+ die " Automatic merge failed/prevented ; fix up by hand"
0 commit comments