All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rebase: convert revert to squash on autosquash
@ 2016-04-07 15:12 Michael S. Tsirkin
  2016-04-07 15:23 ` Johannes Schindelin
  0 siblings, 1 reply; 10+ messages in thread
From: Michael S. Tsirkin @ 2016-04-07 15:12 UTC (permalink / raw)
  To: git

Reverts can typically be treated like squash.  Eliminating both the
original commit and the revert would be even nicer, but this seems a bit
harder to implement.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 git-rebase--interactive.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6a766ca..6fc1935 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -777,7 +777,7 @@ rearrange_squash () {
 	do
 		test -z "${format}" || message=$(git log -n 1 --format="%s" ${sha1})
 		case "$message" in
-		"squash! "*|"fixup! "*|"ack! "*)
+		"squash! "*|"fixup! "*|"ack! "*|"Revert \""*)
 			action="${message%%!*}"
 			rest=$message
 			prefix=
@@ -789,6 +789,12 @@ rearrange_squash () {
 					prefix="$prefix${rest%%!*},"
 					rest="${rest#*! }"
 					;;
+				"Revert \""*\")
+					action="squash"
+					prefix="Revert,"
+					rest="${rest#Revert \"}"
+					rest="${rest%%\"}"
+					;;
 				*)
 					break
 					;;
-- 
MST

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-07 15:12 [PATCH] rebase: convert revert to squash on autosquash Michael S. Tsirkin
@ 2016-04-07 15:23 ` Johannes Schindelin
  2016-04-07 15:51   ` Michael S. Tsirkin
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Schindelin @ 2016-04-07 15:23 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: git

Hi,

On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:

> Reverts can typically be treated like squash.  Eliminating both the
> original commit and the revert would be even nicer, but this seems a bit
> harder to implement.

Whoa. This rings a lot of alarm bells, very loudly. It seems you intend to
introduce a *major* change in behavior, and all we get to convince us that
this is a good change is this puny paragraph (which, by the way, does not
do half a good job of explaining to me what you think this patch is
supposed to do, let alone of convincing me that what you want is a good
change).

So. What is it again that you want to achieve? Please use plain English,
e.g. explaining how exactly reverts are typically to be treated like
squashes. And please make it convincing, because so far, I am far from
convinced.

Ciao,
Johannes

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-07 15:23 ` Johannes Schindelin
@ 2016-04-07 15:51   ` Michael S. Tsirkin
  2016-04-08 11:13     ` Johannes Schindelin
  2016-04-08 11:39     ` Matthieu Moy
  0 siblings, 2 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2016-04-07 15:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On Thu, Apr 07, 2016 at 05:23:09PM +0200, Johannes Schindelin wrote:
> Hi,
> 
> On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:
> 
> > Reverts can typically be treated like squash.  Eliminating both the
> > original commit and the revert would be even nicer, but this seems a bit
> > harder to implement.
> 
> Whoa. This rings a lot of alarm bells, very loudly.

Whoa don't be alarmed. It's just a patch :).
I've been using this patch for more than a year now, so I
thought I'd post it in case it's useful for others.


> It seems you intend to
> introduce a *major* change in behavior,

Doing this automatically for all users might be a bit too drastic for
the upstream git.  So there could be an option, or something - if
there's interest I can add that. I thought I'd test the waters before
I spend time on that.

> and all we get to convince us that
> this is a good change is this puny paragraph (which, by the way, does not
> do half a good job of explaining to me what you think this patch is
> supposed to do, let alone of convincing me that what you want is a good
> change).
> 
> So. What is it again that you want to achieve? Please use plain English,
> e.g. explaining how exactly reverts are typically to be treated like
> squashes. And please make it convincing, because so far, I am far from
> convinced.
> 
> Ciao,
> Johannes

It's rather simple.

If there's a commit later followed by a revert, history can be
simplified by squashing them, and if the result is empty, removing both.

The removal part is not automatic with my patch.  If someone wants to
implement it, that would be nice and useful for me.

squashing/fixing is similar in that they are also useful to keep history
clean.
-- 
MST

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-07 15:51   ` Michael S. Tsirkin
@ 2016-04-08 11:13     ` Johannes Schindelin
  2016-04-08 11:42       ` Matthieu Moy
                         ` (2 more replies)
  2016-04-08 11:39     ` Matthieu Moy
  1 sibling, 3 replies; 10+ messages in thread
From: Johannes Schindelin @ 2016-04-08 11:13 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: git

Hi Michael,

On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:

> On Thu, Apr 07, 2016 at 05:23:09PM +0200, Johannes Schindelin wrote:
> > 
> > On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:
> > 
> > > Reverts can typically be treated like squash.  Eliminating both the
> > > original commit and the revert would be even nicer, but this seems a bit
> > > harder to implement.
> > 
> > Whoa. This rings a lot of alarm bells, very loudly.
> 
> Whoa don't be alarmed. It's just a patch :).

It's just a patch. Like every major breakage would be. So: no, there is
reason to be alarmed if it is likely to disrupt normal usage.

> > It seems you intend to introduce a *major* change in behavior,
> 
> Doing this automatically for all users might be a bit too drastic for
> the upstream git.

That is a pretty safe thing to say, even without the subjunctive.

> If there's a commit later followed by a revert, history can be
> simplified by squashing them, and if the result is empty, removing both.

True. But that is not what the user told Git to do. If the user's
intention was to squash the reverting patch, she could have easily done
this:

	git revert -n deadbeef
	git commit --squash deadbeef

where "deadbeef" is the placeholder for the actual commit to revert.

And indeed, I use exactly this song and dance quite frequently, *iff* my
intention is to drop a patch.

A much better idea than co-opting the "Revert" commit message would be to
introduce a sibling to --fixup and --squash that you could call --drop.

Ciao,
Johannes

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-07 15:51   ` Michael S. Tsirkin
  2016-04-08 11:13     ` Johannes Schindelin
@ 2016-04-08 11:39     ` Matthieu Moy
  1 sibling, 0 replies; 10+ messages in thread
From: Matthieu Moy @ 2016-04-08 11:39 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Johannes Schindelin, git

"Michael S. Tsirkin" <mst@redhat.com> writes:

> Doing this automatically for all users might be a bit too drastic for
> the upstream git.  So there could be an option, or something - if
> there's interest I can add that. I thought I'd test the waters before
> I spend time on that.

If the goal is to test the waters, then adding an RFC tag to your
subject helps starting more constructive discussion and avoid alarm
bells ringing like Johannes' reaction. Having the content of this
paragraph as a comment below the --- part of the patch also helps.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-08 11:13     ` Johannes Schindelin
@ 2016-04-08 11:42       ` Matthieu Moy
  2016-04-08 14:09         ` Michael S. Tsirkin
  2016-04-08 11:43       ` Michael S. Tsirkin
  2016-04-09 17:17       ` Michael S. Tsirkin
  2 siblings, 1 reply; 10+ messages in thread
From: Matthieu Moy @ 2016-04-08 11:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Michael S. Tsirkin, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> 	git revert -n deadbeef
> 	git commit --squash deadbeef
>
> where "deadbeef" is the placeholder for the actual commit to revert.
>
> And indeed, I use exactly this song and dance quite frequently, *iff* my
> intention is to drop a patch.
>
> A much better idea than co-opting the "Revert" commit message would be to
> introduce a sibling to --fixup and --squash that you could call
> --drop.

One could also add --fixup and --squash to "git revert", so the above
would become

    git revert --squash deadbeef

In most cases, I find it simpler to just start a rebase -i and drop the
commit from rebase's todo-list.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-08 11:13     ` Johannes Schindelin
  2016-04-08 11:42       ` Matthieu Moy
@ 2016-04-08 11:43       ` Michael S. Tsirkin
  2016-04-09 17:17       ` Michael S. Tsirkin
  2 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2016-04-08 11:43 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On Fri, Apr 08, 2016 at 01:13:51PM +0200, Johannes Schindelin wrote:
> Hi Michael,
> 
> On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:
> 
> > On Thu, Apr 07, 2016 at 05:23:09PM +0200, Johannes Schindelin wrote:
> > > 
> > > On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:
> > > 
> > > > Reverts can typically be treated like squash.  Eliminating both the
> > > > original commit and the revert would be even nicer, but this seems a bit
> > > > harder to implement.
> > > 
> > > Whoa. This rings a lot of alarm bells, very loudly.
> > 
> > Whoa don't be alarmed. It's just a patch :).
> 
> It's just a patch. Like every major breakage would be. So: no, there is
> reason to be alarmed if it is likely to disrupt normal usage.
> 
> > > It seems you intend to introduce a *major* change in behavior,
> > 
> > Doing this automatically for all users might be a bit too drastic for
> > the upstream git.
> 
> That is a pretty safe thing to say, even without the subjunctive.
> 
> > If there's a commit later followed by a revert, history can be
> > simplified by squashing them, and if the result is empty, removing both.
> 
> True. But that is not what the user told Git to do. If the user's
> intention was to squash the reverting patch, she could have easily done
> this:
> 
> 	git revert -n deadbeef
> 	git commit --squash deadbeef
> 
> where "deadbeef" is the placeholder for the actual commit to revert.
> 
> And indeed, I use exactly this song and dance quite frequently, *iff* my
> intention is to drop a patch.
> 
> A much better idea than co-opting the "Revert" commit message would be to
> introduce a sibling to --fixup and --squash that you could call --drop.
> 
> Ciao,
> Johannes

Sounds rather cool. Or alternatively

git revert --squash deadbeef

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-08 11:42       ` Matthieu Moy
@ 2016-04-08 14:09         ` Michael S. Tsirkin
  0 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2016-04-08 14:09 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Johannes Schindelin, git

On Fri, Apr 08, 2016 at 01:42:12PM +0200, Matthieu Moy wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > 	git revert -n deadbeef
> > 	git commit --squash deadbeef
> >
> > where "deadbeef" is the placeholder for the actual commit to revert.
> >
> > And indeed, I use exactly this song and dance quite frequently, *iff* my
> > intention is to drop a patch.
> >
> > A much better idea than co-opting the "Revert" commit message would be to
> > introduce a sibling to --fixup and --squash that you could call
> > --drop.
> 
> One could also add --fixup and --squash to "git revert", so the above
> would become
> 
>     git revert --squash deadbeef
> 
> In most cases, I find it simpler to just start a rebase -i and drop the
> commit from rebase's todo-list.

Absolutely, but moving rebase to near the commit to drop also
makes it easier to spot where the commit is.
Thoughts?

> -- 
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] rebase: convert revert to squash on autosquash
  2016-04-08 11:13     ` Johannes Schindelin
  2016-04-08 11:42       ` Matthieu Moy
  2016-04-08 11:43       ` Michael S. Tsirkin
@ 2016-04-09 17:17       ` Michael S. Tsirkin
  2 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2016-04-09 17:17 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

On Fri, Apr 08, 2016 at 01:13:51PM +0200, Johannes Schindelin wrote:
> Hi Michael,
> 
> On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:
> 
> > On Thu, Apr 07, 2016 at 05:23:09PM +0200, Johannes Schindelin wrote:
> > > 
> > > On Thu, 7 Apr 2016, Michael S. Tsirkin wrote:
> > > 
> > > > Reverts can typically be treated like squash.  Eliminating both the
> > > > original commit and the revert would be even nicer, but this seems a bit
> > > > harder to implement.
> > > 
> > > Whoa. This rings a lot of alarm bells, very loudly.
> > 
> > Whoa don't be alarmed. It's just a patch :).
> 
> It's just a patch. Like every major breakage would be. So: no, there is
> reason to be alarmed if it is likely to disrupt normal usage.
> 
> > > It seems you intend to introduce a *major* change in behavior,
> > 
> > Doing this automatically for all users might be a bit too drastic for
> > the upstream git.
> 
> That is a pretty safe thing to say, even without the subjunctive.
> 
> > If there's a commit later followed by a revert, history can be
> > simplified by squashing them, and if the result is empty, removing both.
> 
> True. But that is not what the user told Git to do. If the user's
> intention was to squash the reverting patch, she could have easily done
> this:
> 
> 	git revert -n deadbeef
> 	git commit --squash deadbeef
> 
> where "deadbeef" is the placeholder for the actual commit to revert.
> 
> And indeed, I use exactly this song and dance quite frequently, *iff* my
> intention is to drop a patch.

Well then you have to decide whether you want to drop it
when you commit.
If *I* want do drop the patch when I commit, I just do
git rebase.

> A much better idea than co-opting the "Revert" commit message would be to
> introduce a sibling to --fixup and --squash that you could call --drop.
> 
> Ciao,
> Johannes

Maybe but it's a different usecase.

What this addresses is a case where you first wanted to
avoid rebases, so you reverted.
But then you rebased after all.
Now finding what was reverted automatically is helpful.

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

* [PATCH] rebase: convert revert to squash on autosquash
@ 2014-10-22  6:57 Michael S. Tsirkin
  0 siblings, 0 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2014-10-22  6:57 UTC (permalink / raw)
  To: git

Reverts can typically be treated like squash.  Eliminating both the
original commit and the revert would be even nicer, but this seems a bit
harder to implement.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 git-rebase--interactive.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 86edac7..a82bbdf 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -745,7 +745,7 @@ rearrange_squash () {
 	while read -r pick sha1 message
 	do
 		case "$message" in
-		"squash! "*|"fixup! "*|"ack! "*)
+		"squash! "*|"fixup! "*|"ack! "*|"Revert \""*)
 			action="${message%%!*}"
 			rest=$message
 			prefix=
@@ -757,6 +757,12 @@ rearrange_squash () {
 					prefix="$prefix${rest%%!*},"
 					rest="${rest#*! }"
 					;;
+				"Revert \""*\")
+					action="squash"
+					prefix="Revert,"
+					rest="${rest#Revert \"}"
+					rest="${rest%%\"}"
+					;;
 				*)
 					break
 					;;
-- 
MST

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

end of thread, other threads:[~2016-04-09 17:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-07 15:12 [PATCH] rebase: convert revert to squash on autosquash Michael S. Tsirkin
2016-04-07 15:23 ` Johannes Schindelin
2016-04-07 15:51   ` Michael S. Tsirkin
2016-04-08 11:13     ` Johannes Schindelin
2016-04-08 11:42       ` Matthieu Moy
2016-04-08 14:09         ` Michael S. Tsirkin
2016-04-08 11:43       ` Michael S. Tsirkin
2016-04-09 17:17       ` Michael S. Tsirkin
2016-04-08 11:39     ` Matthieu Moy
  -- strict thread matches above, loose matches on Subject: below --
2014-10-22  6:57 Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.