threads / patch / 41814

patchrebase-i: print abbreviated hash when stop for editing

Subject: [PATCH] rebase-i: print abbreviated hash when stop for editing

## tl;dr

5 messages between Mar 24, 2016 and Mar 28, 2016. Diffs are folded; open one to read it.

replies: 4people: 2as markdown or json

Ralf Thielow· Mar 24, 2016, 18:31 UTC · lore
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 git-rebase--interactive.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to git-rebase--interactive.sh +2 −1
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4cde685..9ea3075 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -548,7 +548,8 @@ do_next () {
 
 		mark_action_done
 		do_pick $sha1 "$rest"
-		warn "Stopped at $sha1... $rest"
+		sha1_abbrev=$(git rev-parse --short $sha1)
+		warn "Stopped at $sha1_abbrev... $rest"
 		exit_with_patch $sha1 0
 		;;
 	squash|s|fixup|f)
-- 
2.8.0.rc4.7.g35d7ca9.dirty
Junio C Hamano· Mar 24, 2016, 19:56 UTC · re: Ralf Thielow · lore

Re: [PATCH] rebase-i: print abbreviated hash when stop for editing

Ralf Thielow <ralf.thielow@gmail.com> writes:
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---

Hmph, the reason why this is a good thing to do is because an overlong $sha1 would push $rest too far to the right (possibly making it overflow to the next line)?

Show 17 quoted lines
>  git-rebase--interactive.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 4cde685..9ea3075 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -548,7 +548,8 @@ do_next () {
>  
>  		mark_action_done
>  		do_pick $sha1 "$rest"
> -		warn "Stopped at $sha1... $rest"
> +		sha1_abbrev=$(git rev-parse --short $sha1)
> +		warn "Stopped at $sha1_abbrev... $rest"
>  		exit_with_patch $sha1 0
>  		;;
>  	squash|s|fixup|f)
Ralf Thielow· Mar 24, 2016, 21:06 UTC · re: Junio C Hamano · lore

Re: [PATCH] rebase-i: print abbreviated hash when stop for editing

2016-03-24 20:56 GMT+01:00 Junio C Hamano <gitster@pobox.com>:
Show 9 quoted lines
> Ralf Thielow <ralf.thielow@gmail.com> writes:
>
>> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
>> ---
>
> Hmph, the reason why this is a good thing to do is because an
> overlong $sha1 would push $rest too far to the right (possibly
> making it overflow to the next line)?
>

Yes. Another solution would have been to remove the "..." at the end, but I prefer to see a shorter message rather than having the full sha1 for whatever reason.

Show 18 quoted lines
>
>>  git-rebase--interactive.sh | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
>> index 4cde685..9ea3075 100644
>> --- a/git-rebase--interactive.sh
>> +++ b/git-rebase--interactive.sh
>> @@ -548,7 +548,8 @@ do_next () {
>>
>>               mark_action_done
>>               do_pick $sha1 "$rest"
>> -             warn "Stopped at $sha1... $rest"
>> +             sha1_abbrev=$(git rev-parse --short $sha1)
>> +             warn "Stopped at $sha1_abbrev... $rest"
>>               exit_with_patch $sha1 0
>>               ;;
>>       squash|s|fixup|f)
Ralf Thielow· Mar 28, 2016, 16:00 UTC · re: Ralf Thielow · lore

[PATCH v2] rebase-i: print an abbreviated hash when stop for editing

The message that is shown when rebase-i stops for editing prints the full hash of the commit where it stopped which makes the message overflow to the next line on smaller terminal windows. Print an abbreviated hash instead.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 git-rebase--interactive.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Show changes to git-rebase--interactive.sh +2 −1
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 4cde685..9ea3075 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -548,7 +548,8 @@ do_next () {
 
 		mark_action_done
 		do_pick $sha1 "$rest"
-		warn "Stopped at $sha1... $rest"
+		sha1_abbrev=$(git rev-parse --short $sha1)
+		warn "Stopped at $sha1_abbrev... $rest"
 		exit_with_patch $sha1 0
 		;;
 	squash|s|fixup|f)
-- 
2.8.0.rc4.285.gc3ac548
Junio C Hamano· Mar 28, 2016, 18:43 UTC · re: Ralf Thielow · lore

Re: [PATCH v2] rebase-i: print an abbreviated hash when stop for editing

Ralf Thielow <ralf.thielow@gmail.com> writes:
Show 7 quoted lines
> The message that is shown when rebase-i stops for editing prints
> the full hash of the commit where it stopped which makes the message
> overflow to the next line on smaller terminal windows.  Print an
> abbreviated hash instead.
>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
Thanks, will queue.
Show 17 quoted lines
>  git-rebase--interactive.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 4cde685..9ea3075 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -548,7 +548,8 @@ do_next () {
>  
>  		mark_action_done
>  		do_pick $sha1 "$rest"
> -		warn "Stopped at $sha1... $rest"
> +		sha1_abbrev=$(git rev-parse --short $sha1)
> +		warn "Stopped at $sha1_abbrev... $rest"
>  		exit_with_patch $sha1 0
>  		;;
>  	squash|s|fixup|f)

← back to recent threads