[PATCH] git-reset: make the output as the fetch output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



... and only when HEAD is changed.

Signed-off-by: Santi Béjar <sbejar@xxxxxxxxx>
---
 git-reset.sh |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/git-reset.sh b/git-reset.sh
index bf2a058..acefddc 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -24,6 +24,7 @@ do
 		usage
 		;;
 	*)
+		commit="$1"
 		rev=$(git-rev-parse --verify "$1") || exit
 		shift
 		break
@@ -84,14 +85,20 @@ fi
 git-update-ref -m "$GIT_REFLOG_ACTION" HEAD "$rev"
 update_ref_status=$?
 
+if test $update_ref_status = 0 && test "$orig" != "$rev"
+then
+    revshort=$(git-rev-parse --short $rev)
+    echo "* HEAD: reset to $commit"
+    if test "$orig" ; then
+	echo "  old..new: $(git-rev-parse --short $orig)..$revshort"
+    else
+	echo "  commit: $revshort"
+    fi
+fi
+
 case "$reset_type" in
 --hard )
-	test $update_ref_status = 0 && {
-		printf "HEAD is now at "
-		GIT_PAGER= git log --max-count=1 --pretty=oneline \
-			--abbrev-commit HEAD
-	}
-	;;
+	;; # Nothing else to do
 --soft )
 	;; # Nothing else to do
 --mixed )
-- 
1.5.0.rc1.g0dee5

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]