Merge branch 'sb/branch-attributes'
[gitweb.git] / git-resolve.sh
index fcc5ad7349e3f77a6817e499b331b262c4a07b57..729ec65dc9e0ddebfe81fb4d837a5f9c83b537ee 100755 (executable)
@@ -4,11 +4,13 @@
 #
 # Resolve two trees.
 #
-. git-sh-setup
 
-usage () {
-       die "git-resolve <head> <remote> <merge-message>"
-}
+echo 'WARNING: This command is DEPRECATED and will be removed very soon.' >&2
+echo 'WARNING: Please use git-merge or git-pull instead.' >&2
+sleep 2
+
+USAGE='<head> <remote> <merge-message>'
+. git-sh-setup
 
 dropheads() {
        rm -f -- "$GIT_DIR/MERGE_HEAD" \
@@ -17,6 +19,7 @@ dropheads() {
 
 head=$(git-rev-parse --verify "$1"^0) &&
 merge=$(git-rev-parse --verify "$2"^0) &&
+merge_name="$2" &&
 merge_msg="$3" || usage
 
 #
@@ -43,15 +46,19 @@ case "$common" in
        exit 0
        ;;
 "$head")
-       echo "Updating from $head to $merge."
+       echo "Updating from $head to $merge"
        git-read-tree -u -m $head $merge || exit 1
-       git-update-ref HEAD "$merge" "$head"
+       git-update-ref -m "resolve $merge_name: Fast forward" \
+               HEAD "$merge" "$head"
        git-diff-tree -p $head $merge | git-apply --stat
        dropheads
        exit 0
        ;;
 esac
 
+# We are going to make a new commit.
+git var GIT_COMMITTER_IDENT >/dev/null || exit
+
 # Find an optimum merge base if there are more than one candidates.
 LF='
 '
@@ -99,6 +106,7 @@ if [ $? -ne 0 ]; then
 fi
 result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree -p $head -p $merge)
 echo "Committed merge $result_commit"
-git-update-ref HEAD "$result_commit" "$head"
+git-update-ref -m "resolve $merge_name: In-index merge" \
+       HEAD "$result_commit" "$head"
 git-diff-tree -p $head $result_commit | git-apply --stat
 dropheads