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

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

 



Johannes Schindelin wrote:
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
> ---
> 
> 	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(-)
> 
> diff --git a/git-reset.sh b/git-reset.sh
> index 8d95e37..2379db0 100755
> --- a/git-reset.sh
> +++ b/git-reset.sh
> @@ -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 )

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
-
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]