Skip to contentSkip to conversation

git-reset: make the output as the fetch output

PATCH In review Santi Béjar 4 participants 6 messages Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-reset: make the output as the fetch output

... and only when HEAD is changed.

---
 git-reset.sh |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
git-reset.sh +13 -6
index bf2a058..acefddc 100755
@@ -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 )
Signature · 1 line
1.5.0.rc1.g0dee5
#1 lore raw

Hi *,

Quoted 1 line
(quoted diff) +0 -0
@@ -84,14 +85,20 @@ fi

[...]

Quoted 1 line

+ echo "* HEAD: reset to $commit"

[...]

perhaps?
echo "* HEAD: resetted to $commit"

Santi

#2 lore raw

In article <[email protected]> (at Wed, 17 Jan 2007 14:27:15 +0100), "Santi Béjar" <[email protected]> says:

Quoted 7 lines
Quoted 1 line
(quoted diff) +0 -0
@@ -84,14 +85,20 @@ fi

[...]

Quoted 1 line

+ echo "* HEAD: reset to $commit"

[...]

perhaps?
echo "* HEAD: resetted to $commit"

Of course, not. Past (and past participle) of "reset" is "reset".

--yoshfuji

#3 lore raw
In reply to Santi Béjar
Quoted 6 lines · Santi Béjar
Quoted 1 line

+ echo "* HEAD: reset to $commit"

[...]

perhaps?
echo "* HEAD: resetted to $commit"

You were right the first time; "reset" is the correct past-tense form. If anything, I'd lose the colon...

HEAD reset to $commit

is a perfectly acceptable sentence.

Andy

Signature · 2 lines
Dr Andy Parkins, M Eng (hons), MIEE
[email protected]
#4 lore raw
In reply to Santi Béjar

Hi,

IMHO your version is less helpful than the current behaviour: now it shows the oneline (which your version doesn't), and in most cases you reset from a dirty state (at least I _exclusively_ use reset in such situations), where "from..to" does not make any sense.

Ciao,
Dscho

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Hi,

[reCc'ing list]

Quoted 12 lines · Santi Béjar
Quoted 6 lines · Johannes Schindelin

Hi,

IMHO your version is less helpful than the current behaviour: now it shows the oneline (which your version doesn't), and in most cases you reset from a dirty state (at least I _exclusively_ use reset in such situations), where "from..to" does not make any sense.

My motivation is to have a coherent output. I recognize that the .. notation in fetch (fastforwarding) does not generally make sense in reset. Could be better

Quoted 5 lines

* HEAD: reset to ...
old: $hash
new: $hash

If I want to see the commit title I do a "git branch -v".

The whole point of tags/v1.5.0-rc0~44 was to _avoid_ "git branch -v", or "git show HEAD".

Ciao,
Dscho