Skip to contentSkip to conversation

UI nitpick

PATCH In review Han-Wen Nienhuys 3 participants 5 messages Jun 15, 2016 – Aug 11, 2016

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 git-reset --hard: tell the user what the HEAD was reset to

In reply to Han-Wen Nienhuys

---

On Wed, 20 Dec 2006, Han-Wen Nienhuys wrote:

> It would be nice if git-reset printed
>
> HEAD is now <sha1> - <excerpt of commit message>

This patch does that, but only for --reset.

Without reset, HEAD is _not_ changed, just the contents of the working directory and/or the index.

 git-reset.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
git-reset.sh +6 -1
index 8d95e37..2379db0 100755
@@ -86,7 +86,12 @@ update_ref_status=$?
 
 case "$reset_type" in
 --hard )
-	;; # Nothing else to do
+	test $update_ref_status = 0 && {
+		echo -n "HEAD is now at "
+		GIT_PAGER= git log --max-count=1 --pretty=oneline \
+			--abbrev-commit HEAD
+	}
+	;;
 --soft )
 	;; # Nothing else to do
 --mixed )
Signature · 1 line
1.4.4.3.gdb8fb-dirty
#2 lore raw

Re: [PATCH] git-reset --hard: tell the user what the HEAD was reset to

Quoted 25 lines · Johannes Schindelin

---

On Wed, 20 Dec 2006, Han-Wen Nienhuys wrote:

> It would be nice if git-reset printed
>
> HEAD is now <sha1> - <excerpt of commit message>

This patch does that, but only for --reset.

Without reset, HEAD is _not_ changed, just the contents of the working directory and/or the index.

 git-reset.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
git-reset.sh +0 -0
index 8d95e37..2379db0 100755
@@ -86,7 +86,12 @@ update_ref_status=$?
 
 case "$reset_type" in
 --hard )

git-reset.sh update_ref_status=$? · line 97

Quoted 10 lines
git-reset.sh +6 -1
-	;; # Nothing else to do
+	test $update_ref_status = 0 && {
+		echo -n "HEAD is now at "
+		GIT_PAGER= git log --max-count=1 --pretty=oneline \
+			--abbrev-commit HEAD
+	}
+	;;
 --soft )
 	;; # Nothing else to do
 --mixed )

Ok, this sounds like a good change in principle, but the output format it introduces seems likely to cause confusion. For sure the first couple of times I saw it I though there was a bug and I was seeing an error from the plumbing. See below for an example where you would swear something bad had occured.

  apw@pinky$ git checkout -b bar master
  apw@pinky$ git reset --hard ac9c1108d8915f0937795e354ad72c4ae6890a3f
  HEAD is now at ac9c110... git-fetch: remove .keep file at the end.

Huh, fetch? Remove what .keep file? Did I do a fetch? What?

I think we need to delimit the name better, probabally we need to quote it. Perhaps something like:

HEAD is now at ac9c110: "git-fetch: remove .keep file at the end".

-apw

#3 lore raw

Re: [PATCH] git-reset --hard: tell the user what the HEAD was reset to

Hi,

Quoted 4 lines · Andy Whitcroft

I think we need to delimit the name better, probabally we need to quote it. Perhaps something like:

HEAD is now at ac9c110: "git-fetch: remove .keep file at the end".

Fine. But this is "git log --pretty=oneline --abbrev-commit". I don't know how many things break if you change _that_.

Alternatively, you could pipe that into a sed command adding the colon and the quotes.

Ciao,
Dscho

#4 lore raw

Re: [PATCH] git-reset --hard: tell the user what the HEAD was reset to

Quoted 7 lines · Johannes Schindelin

Hi,

Quoted 3 lines · Andy Whitcroft

I think we need to delimit the name better, probabally we need to quote it. Perhaps something like:

Quoted 7 lines
Quoted 1 line

HEAD is now at ac9c110: "git-fetch: remove .keep file at the end".

Fine. But this is "git log --pretty=oneline --abbrev-commit". I don't know how many things break if you change _that_.

Alternatively, you could pipe that into a sed command adding the colon and the quotes.

Quack, so it is.

apw@pinky$ git log --pretty=oneline --abbrev-commit | head -1
f4bf218... Update clone/fetch documentation with --depth (shallow clone)
option

Perhaps we could do something like:

Head is now at "f4bf218... Update clone/fetch documentation with --depth (shallow clone) option"

Hmmm ... oh well I guess I'll just get used to it.

-apw

#0 lore raw

Hi,

git-reset is really neat when you messed something up, but it spews messages.

[lilydev@haring lilypond]$ git-reset HEAD lily/accidental-engraver.cc: needs update lily/lyric-combine-music-iterator.cc: needs update

this makes me think that the reset was unsuccesful.

After a few more experiments with

git-reset <stuff> HEAD^

I started noticing that the list grew longer and longer.

It would be nice if git-reset printed

HEAD is now <sha1> - <excerpt of commit message>

Signature · 1 line
 Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen