environment.c: remove unused function
[gitweb.git] / git-merge.sh
index 1c123a37e6941b6727c6101bb29cbc485a380c20..5fc5f5201f8ea8e155a25795b93bfea86fc12d12 100755 (executable)
@@ -8,8 +8,10 @@ OPTIONS_SPEC="\
 git-merge [options] <remote>...
 git-merge [options] <msg> HEAD <remote>
 --
-summary              show a diffstat at the end of the merge
-n,no-summary         don't show a diffstat at the end of the merge
+stat                 show a diffstat at the end of the merge
+n                    don't show a diffstat at the end of the merge
+summary              (synonym to --stat)
+log                  add list of one-line log to merge commit message
 squash               create a single commit instead of doing a merge
 commit               perform a commit if the merge sucesses (default)
 ff                   allow fast forward (default)
@@ -37,6 +39,7 @@ use_strategies=
 
 allow_fast_forward=t
 allow_trivial_merge=t
+squash= no_commit= log_arg=
 
 dropsave() {
        rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
@@ -70,7 +73,7 @@ finish_up_to_date () {
 squash_message () {
        echo Squashed commit of the following:
        echo
-       git log --no-merges ^"$head" $remoteheads
+       git log --no-merges --pretty=medium ^"$head" $remoteheads
 }
 
 finish () {
@@ -147,22 +150,28 @@ merge_name () {
 parse_config () {
        while test $# != 0; do
                case "$1" in
-               -n|--no-summary)
+               -n|--no-stat|--no-summary)
                        show_diffstat=false ;;
-               --summary)
+               --stat|--summary)
                        show_diffstat=t ;;
+               --log|--no-log)
+                       log_arg=$1 ;;
                --squash)
-                       allow_fast_forward=t squash=t no_commit=t ;;
+                       test "$allow_fast_forward" = t ||
+                               die "You cannot combine --squash with --no-ff."
+                       squash=t no_commit=t ;;
                --no-squash)
-                       allow_fast_forward=t squash= no_commit= ;;
+                       squash= no_commit= ;;
                --commit)
-                       allow_fast_forward=t squash= no_commit= ;;
+                       no_commit= ;;
                --no-commit)
-                       allow_fast_forward=t squash= no_commit=t ;;
+                       no_commit=t ;;
                --ff)
-                       allow_fast_forward=t squash= no_commit= ;;
+                       allow_fast_forward=t ;;
                --no-ff)
-                       allow_fast_forward=false squash= no_commit= ;;
+                       test "$squash" != t ||
+                               die "You cannot combine --squash with --no-ff."
+                       allow_fast_forward=f ;;
                -s|--strategy)
                        shift
                        case " $all_strategies " in
@@ -205,6 +214,7 @@ while test $args_left -lt $#; do shift; done
 
 if test -z "$show_diffstat"; then
     test "$(git config --bool merge.diffstat)" = false && show_diffstat=false
+    test "$(git config --bool merge.stat)" = false && show_diffstat=false
     test -z "$show_diffstat" && show_diffstat=t
 fi
 
@@ -253,7 +263,7 @@ else
        merge_name=$(for remote
                do
                        merge_name "$remote"
-               done | git fmt-merge-msg
+               done | git fmt-merge-msg $log_arg
        )
        merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name"
 fi