# [PATCH] git-reset --hard: use quotes when we tell the user what HEAD was reset to

5 messages from 2007-01-06 to 2007-01-08. Participants: Fredrik Kuivinen, Junio C Hamano, Andy Whitcroft.
Thread: https://gitlist.dev/t/6250

## Fredrik Kuivinen, 2007-01-06 10:23

Subject: [PATCH] git-reset --hard: use quotes when we tell the user what HEAD was reset to
Message-ID: <20070106102322.7468.57615.stgit@c165>
URL: https://gitlist.dev/e/20070106102322.7468.57615.stgit%40c165

```

Idea and motivating example from Andy Whitcroft:

    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".

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>

---

 git-reset.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-reset.sh b/git-reset.sh
index a969370..9b49883 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -90,7 +90,8 @@ case "$reset_type" in
 	test $update_ref_status = 0 && {
 		echo -n "HEAD is now at "
 		GIT_PAGER= git log --max-count=1 --pretty=oneline \
-			--abbrev-commit HEAD
+			--abbrev-commit HEAD |
+		    sed 's/\([0-9a-f.]*\) \(.*\)/\1: "\2"/'
 	}
 	;;
 --soft )

```

## Junio C Hamano, 2007-01-06 19:26

Subject: Re: [PATCH] git-reset --hard: use quotes when we tell the user what HEAD was reset to
Message-ID: <7v8xgg553u.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v8xgg553u.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070106102322.7468.57615.stgit@c165>

```
Fredrik Kuivinen <freku045@student.liu.se> writes:

> Idea and motivating example from Andy Whitcroft:
>
>     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".

I've also considered something along that line, but:

 (1) I think this 'confusion' is only because you are futzing
     with a project that deals with git-fetch and friends and
     not a general problem.

 (2) With "HEAD is now at xxxxx..."  prefix, even two characters
     are precious to fit the title of the commit on a single
     line.

With these in mind, do you still want to do this?

```

## Fredrik Kuivinen, 2007-01-07 12:56

Subject: Re: [PATCH] git-reset --hard: use quotes when we tell the user what HEAD was reset to
Message-ID: <4c8ef70701070456k2f0585f4ga6c35bd77c939c59@mail.gmail.com>
URL: https://gitlist.dev/e/4c8ef70701070456k2f0585f4ga6c35bd77c939c59%40mail.gmail.com
In-Reply-To: <7v8xgg553u.fsf@assigned-by-dhcp.cox.net>

```
On 1/6/07, Junio C Hamano <junkio@cox.net> wrote:
> Fredrik Kuivinen <freku045@student.liu.se> writes:
>
> > Idea and motivating example from Andy Whitcroft:
> >
> >     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".
>
> I've also considered something along that line, but:
>
>  (1) I think this 'confusion' is only because you are futzing
>      with a project that deals with git-fetch and friends and
>      not a general problem.
>
>  (2) With "HEAD is now at xxxxx..."  prefix, even two characters
>      are precious to fit the title of the commit on a single
>      line.
>
> With these in mind, do you still want to do this?

I don't think the second point is much of an issue. Is it really that
irritating to
read a word-wrapped line of text? I agree with the first point though, in most
cases it will not be a problem in other projects.

I still think it is worth doing it, but it certainly isn't super
important. Feel free
to drop the patch if you want to.

- Fredrik

```

## Junio C Hamano, 2007-01-07 21:10

Subject: Re: [PATCH] git-reset --hard: use quotes when we tell the user what HEAD was reset to
Message-ID: <7vfyam1r18.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vfyam1r18.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <4c8ef70701070456k2f0585f4ga6c35bd77c939c59@mail.gmail.com>

```
"Fredrik Kuivinen" <frekui@gmail.com> writes:

>> >     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".
>> ...
> I don't think the second point is much of an issue. Is it really that
> irritating to
> read a word-wrapped line of text? I agree with the first point though, in most
> cases it will not be a problem in other projects.
>
> I still think it is worth doing it, but it certainly isn't super
> important. Feel free
> to drop the patch if you want to.

I do not care much either way, but the third point is that the
quoted output would look "interesting" if the original title
text has double-quoted words.  I.e.

    HEAD is now at 9945d98: "Add "--cacheinfo" option to update-cache."

Notice also your hand-wrapped example has the final full-stop
outside the quote, which your patch would not produce ;-).

```

## Andy Whitcroft, 2007-01-08 08:33

Subject: Re: [PATCH] git-reset --hard: use quotes when we tell the user what HEAD was reset to
Message-ID: <45A201ED.8030003@shadowen.org>
URL: https://gitlist.dev/e/45A201ED.8030003%40shadowen.org
In-Reply-To: <7vfyam1r18.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:
> "Fredrik Kuivinen" <frekui@gmail.com> writes:
> 
>>>>     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".
>>> ...
>> I don't think the second point is much of an issue. Is it really that
>> irritating to
>> read a word-wrapped line of text? I agree with the first point though, in most
>> cases it will not be a problem in other projects.
>>
>> I still think it is worth doing it, but it certainly isn't super
>> important. Feel free
>> to drop the patch if you want to.
> 
> I do not care much either way, but the third point is that the
> quoted output would look "interesting" if the original title
> text has double-quoted words.  I.e.
> 
>     HEAD is now at 9945d98: "Add "--cacheinfo" option to update-cache."
> 
> Notice also your hand-wrapped example has the final full-stop
> outside the quote, which your patch would not produce ;-).

Heh, well perhaps I should use the original for a while longer and see
if I get used to it.  Of course I mostly use git on git and linux which
both tend to have "error" in their titles :).

-apw

```
