Commits

Junio C Hamano  committed b9718d4 Merge

Merge branch 'sp/reflog'

* sp/reflog:
Record rebase changes as 'rebase' in the reflog.
Log ref changes made by resolve.
Log ref changes made by quiltimport.
Log ref changes made by git-merge and git-pull.

  • Participants
  • Parent commits 7b520e6, 8ef1c7c
  • Tags v1.4.2-rc1

Comments (0)

Files changed (6)

 }
 
 prec=4
+rloga=am
 dotest=.dotest sign= utf8= keep= skip= interactive= resolved= binary= ws= resolvemsg=
 
 while case "$#" in 0) break;; esac
 	--resolvemsg=*)
 	resolvemsg=$(echo "$1" | sed -e "s/^--resolvemsg=//"); shift ;;
 
+	--reflog-action=*)
+	rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`; shift ;;
+
 	--)
 	shift; break ;;
 	-*)
 	parent=$(git-rev-parse --verify HEAD) &&
 	commit=$(git-commit-tree $tree -p $parent <"$dotest/final-commit") &&
 	echo Committed: $commit &&
-	git-update-ref -m "am: $SUBJECT" HEAD $commit $parent ||
+	git-update-ref -m "$rloga: $SUBJECT" HEAD $commit $parent ||
 	stop_here $this
 
 	if test -x "$GIT_DIR"/hooks/post-applypatch

File git-merge.sh

 }
 
 finish () {
-	test '' = "$2" || echo "$2"
+	if test '' = "$2"
+	then
+		rlogm="$rloga"
+	else
+		echo "$2"
+		rlogm="$rloga: $2"
+	fi
 	case "$squash" in
 	t)
 		echo "Squash commit -- not updating HEAD"
 			echo "No merge message -- not updating HEAD"
 			;;
 		*)
-			git-update-ref HEAD "$1" "$head" || exit 1
+			git-update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
 			;;
 		esac
 		;;
 	esac
 }
 
+rloga=
 while case "$#" in 0) break ;; esac
 do
 	case "$1" in
 			die "available strategies are: $all_strategies" ;;
 		esac
 		;;
+	--reflog-action=*)
+		rloga=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+		;;
 	-*)	usage ;;
 	*)	break ;;
 	esac
 
 # All the rest are remote heads
 test "$#" = 0 && usage ;# we need at least one remote head.
+test "$rloga" = '' && rloga="merge: $@"
 
 remoteheads=
 for remote
 then
     parents=$(git-show-branch --independent "$head" "$@" | sed -e 's/^/-p /')
     result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit
-    finish "$result_commit" "Merge $result_commit, made by $wt_strategy."
+    finish "$result_commit" "Merge made by $wt_strategy."
     dropsave
     exit 0
 fi
 esac
 
 merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit
-git-merge $no_summary $no_commit $squash $strategy_args \
+git-merge "--reflog-action=pull $*" \
+	$no_summary $no_commit $squash $strategy_args \
 	"$merge_name" HEAD $merge_head

File git-quiltimport.sh

 		git-apply --index -C1 "$tmp_patch" &&
 		tree=$(git-write-tree) &&
 		commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
-		git-update-ref HEAD $commit || exit 4
+		git-update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
 	fi
 done
 rm -rf $tmp_dir || exit 5

File git-rebase.sh

 			finish_rb_merge
 			exit
 		fi
-		git am --resolved --3way --resolvemsg="$RESOLVEMSG"
+		git am --resolved --3way --resolvemsg="$RESOLVEMSG" \
+			--reflog-action=rebase
 		exit
 		;;
 	--skip)
 			finish_rb_merge
 			exit
 		fi
-		git am -3 --skip --resolvemsg="$RESOLVEMSG"
+		git am -3 --skip --resolvemsg="$RESOLVEMSG" \
+			--reflog-action=rebase
 		exit
 		;;
 	--abort)
 if test -z "$do_merge"
 then
 	git-format-patch -k --stdout --full-index "$upstream"..ORIG_HEAD |
-	git am --binary -3 -k --resolvemsg="$RESOLVEMSG"
+	git am --binary -3 -k --resolvemsg="$RESOLVEMSG" \
+		--reflog-action=rebase
 	exit $?
 fi
 

File git-resolve.sh

 
 head=$(git-rev-parse --verify "$1"^0) &&
 merge=$(git-rev-parse --verify "$2"^0) &&
+merge_name="$2" &&
 merge_msg="$3" || usage
 
 #
 "$head")
 	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
 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