git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [RFC/PATCH] rebase -i: use full onto sha1 in reflog
@ 2012-08-09 16:05 Michael J Gruber
  2012-08-09 17:04 ` Martin von Zweigbergk
  2012-08-09 17:08 ` [RFC/PATCH] " Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Michael J Gruber @ 2012-08-09 16:05 UTC (permalink / raw
  To: git

'git rebase' uses the full onto sha1 for the reflog message whereas 'git
rebase -i' uses the short sha1. This is not only inconsistent, but can
lead to problems when the reflog is inspected at a later time at which
that abbreviation may have become ambiguous.

Make 'rebase -i' use the full onto sha1, as well.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
I don't remember having sent this out before but have been running with
it since (including tests). I don't see it on the list either.

While not for 1.7.12 obviously, it might still be good to have.

 git-rebase--interactive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 0d2056f..dbc9de6 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -573,7 +573,7 @@ do_next () {
 	newhead=$(git rev-parse HEAD) &&
 	case $head_name in
 	refs/*)
-		message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
+		message="$GIT_REFLOG_ACTION: $head_name onto $onto" &&
 		git update-ref -m "$message" $head_name $newhead $orig_head &&
 		git symbolic-ref \
 		  -m "$GIT_REFLOG_ACTION: returning to $head_name" \
-- 
1.7.12.rc2.245.g4f94e02

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH] rebase -i: use full onto sha1 in reflog
  2012-08-09 16:05 [RFC/PATCH] rebase -i: use full onto sha1 in reflog Michael J Gruber
@ 2012-08-09 17:04 ` Martin von Zweigbergk
  2012-08-09 17:48   ` Junio C Hamano
  2012-08-09 17:08 ` [RFC/PATCH] " Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Martin von Zweigbergk @ 2012-08-09 17:04 UTC (permalink / raw
  To: Michael J Gruber; +Cc: git

On Thu, Aug 9, 2012 at 9:05 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 0d2056f..dbc9de6 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -573,7 +573,7 @@ do_next () {
>         newhead=$(git rev-parse HEAD) &&
>         case $head_name in
>         refs/*)
> -               message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
> +               message="$GIT_REFLOG_ACTION: $head_name onto $onto" &&

After this patch, is there any point in the

 shortonto=$(git rev-parse --short $onto) &&

line just before the context? (I can't see any.)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH] rebase -i: use full onto sha1 in reflog
  2012-08-09 16:05 [RFC/PATCH] rebase -i: use full onto sha1 in reflog Michael J Gruber
  2012-08-09 17:04 ` Martin von Zweigbergk
@ 2012-08-09 17:08 ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2012-08-09 17:08 UTC (permalink / raw
  To: Michael J Gruber; +Cc: git

Michael J Gruber <git@drmicha.warpmail.net> writes:

> 'git rebase' uses the full onto sha1 for the reflog message whereas 'git
> rebase -i' uses the short sha1. This is not only inconsistent, but can
> lead to problems when the reflog is inspected at a later time at which
> that abbreviation may have become ambiguous.
>
> Make 'rebase -i' use the full onto sha1, as well.
>
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
> I don't remember having sent this out before but have been running with
> it since (including tests). I don't see it on the list either.
>
> While not for 1.7.12 obviously, it might still be good to have.

Makes sense, I agree it is not that urgent to include it in 1.7.12,
and I think it is not just "good to have" but "we should have done
so from day one and it cannot break anybody who is reading the
reflog".

Thanks.

>
>  git-rebase--interactive.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 0d2056f..dbc9de6 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -573,7 +573,7 @@ do_next () {
>  	newhead=$(git rev-parse HEAD) &&
>  	case $head_name in
>  	refs/*)
> -		message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
> +		message="$GIT_REFLOG_ACTION: $head_name onto $onto" &&
>  		git update-ref -m "$message" $head_name $newhead $orig_head &&
>  		git symbolic-ref \
>  		  -m "$GIT_REFLOG_ACTION: returning to $head_name" \

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC/PATCH] rebase -i: use full onto sha1 in reflog
  2012-08-09 17:04 ` Martin von Zweigbergk
@ 2012-08-09 17:48   ` Junio C Hamano
  2012-08-10  6:51     ` [PATCHv2] " Michael J Gruber
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2012-08-09 17:48 UTC (permalink / raw
  To: Martin von Zweigbergk; +Cc: Michael J Gruber, git

Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> writes:

> On Thu, Aug 9, 2012 at 9:05 AM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
>> index 0d2056f..dbc9de6 100644
>> --- a/git-rebase--interactive.sh
>> +++ b/git-rebase--interactive.sh
>> @@ -573,7 +573,7 @@ do_next () {
>>         newhead=$(git rev-parse HEAD) &&
>>         case $head_name in
>>         refs/*)
>> -               message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
>> +               message="$GIT_REFLOG_ACTION: $head_name onto $onto" &&
>
> After this patch, is there any point in the
>
>  shortonto=$(git rev-parse --short $onto) &&
>
> line just before the context? (I can't see any.)

Good point; the function always exits after reaching this point, so
it should be safe to omit it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2] rebase -i: use full onto sha1 in reflog
  2012-08-09 17:48   ` Junio C Hamano
@ 2012-08-10  6:51     ` Michael J Gruber
  0 siblings, 0 replies; 5+ messages in thread
From: Michael J Gruber @ 2012-08-10  6:51 UTC (permalink / raw
  To: git; +Cc: Junio C Hamano, martin.von.zweigbergk

'git rebase' uses the full onto sha1 for the reflog message whereas 'git
rebase -i' uses the short sha1. This is not only inconsistent, but can
lead to problems when the reflog is inspected at a later time at which
that abbreviation may have become ambiguous.

Make 'rebase -i' use the full onto sha1, as well.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
So, this is without the now superfluous shortonto definition.

The other place where shortonto is defined is still needed.

 git-rebase--interactive.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 0d2056f..a09e842 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -569,11 +569,10 @@ do_next () {
 	test -s "$todo" && return
 
 	comment_for_reflog finish &&
-	shortonto=$(git rev-parse --short $onto) &&
 	newhead=$(git rev-parse HEAD) &&
 	case $head_name in
 	refs/*)
-		message="$GIT_REFLOG_ACTION: $head_name onto $shortonto" &&
+		message="$GIT_REFLOG_ACTION: $head_name onto $onto" &&
 		git update-ref -m "$message" $head_name $newhead $orig_head &&
 		git symbolic-ref \
 		  -m "$GIT_REFLOG_ACTION: returning to $head_name" \
-- 
1.7.12.rc2.245.g4f94e02

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-10  6:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09 16:05 [RFC/PATCH] rebase -i: use full onto sha1 in reflog Michael J Gruber
2012-08-09 17:04 ` Martin von Zweigbergk
2012-08-09 17:48   ` Junio C Hamano
2012-08-10  6:51     ` [PATCHv2] " Michael J Gruber
2012-08-09 17:08 ` [RFC/PATCH] " Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).