git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase: new option to post edit a squashed or fixed up commit
@ 2014-03-09  3:12 Nguyễn Thái Ngọc Duy
  2014-03-10 19:47 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2014-03-09  3:12 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

After squashing or fixing up, you may want to have a final look at the
commit, edit some more if needed or even do some testing. --postedit
enables that. This is (to me) a paranoid mode so either I enable it
for all squashes and fixups, or none. Hence a new option, not new todo
commands that give finer selection.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/git-rebase.txt | 5 +++++
 git-rebase--interactive.sh   | 5 +++++
 git-rebase.sh                | 7 +++++++
 3 files changed, 17 insertions(+)

diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 2a93c64..dacb163 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -432,6 +432,11 @@ recreates the topic branch with fresh commits so it can be remerged
 successfully without needing to "revert the reversion" (see the
 link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for details).
 
+--[no-]postedit::
+	With --interactive, stop after performing the command "squash"
+	or "fixup". This gives the user a chance to look at the final
+	commit and update or test it if needed.
+
 include::merge-strategies.txt[]
 
 NOTES
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a1adae8..42061fc 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -571,6 +571,11 @@ do_next () {
 			;;
 		esac
 		record_in_rewritten $sha1
+		if test -n "$postedit"
+		then
+			warn "Stopped at $sha1... $rest"
+			exit_with_patch $sha1 0
+		fi
 		;;
 	x|"exec")
 		read -r command rest < "$todo"
diff --git a/git-rebase.sh b/git-rebase.sh
index 5f6732b..2d4beb7 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -32,6 +32,7 @@ verify             allow pre-rebase hook to run
 rerere-autoupdate  allow rerere to update index with resolved conflicts
 root!              rebase all reachable commits up to the root(s)
 autosquash         move commits that begin with squash!/fixup! under -i
+postedit           stop after squash or fixup commands
 committer-date-is-author-date! passed to 'git am'
 ignore-date!       passed to 'git am'
 whitespace=!       passed to 'git apply'
@@ -264,6 +265,12 @@ do
 	--no-autosquash)
 		autosquash=
 		;;
+	--postedit)
+		postedit=t
+		;;
+	--no-postedit)
+		postedit=
+		;;
 	--fork-point)
 		fork_point=t
 		;;
-- 
1.9.0.40.gaa8c3ea

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

* Re: [PATCH] rebase: new option to post edit a squashed or fixed up commit
  2014-03-09  3:12 [PATCH] rebase: new option to post edit a squashed or fixed up commit Nguyễn Thái Ngọc Duy
@ 2014-03-10 19:47 ` Junio C Hamano
  2014-03-11 10:01   ` Duy Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2014-03-10 19:47 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> After squashing or fixing up, you may want to have a final look at the
> commit, edit some more if needed or even do some testing. --postedit
> enables that. This is (to me) a paranoid mode so either I enable it
> for all squashes and fixups, or none. Hence a new option, not new todo
> commands that give finer selection.

If we were to adopt Michael's (?) idea of allowing flags to each
insn in the insn sheet, would this restriction be easily lifted?

That is, instead of saying "squash", you say "squash --stop" or
something.

> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index a1adae8..42061fc 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -571,6 +571,11 @@ do_next () {
>  			;;
>  		esac
>  		record_in_rewritten $sha1
> +		if test -n "$postedit"
> +		then
> +			warn "Stopped at $sha1... $rest"
> +			exit_with_patch $sha1 0
> +		fi
>  		;;

I would have expected that any new code would stop only at the last
squash (or fixup) in a series of squashes, but this appears to stop
even at an intermediate squashed result, which will not appear in
the final history.  Am I misreading the patch (or misunderstanding
the intent of the patch)?

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

* Re: [PATCH] rebase: new option to post edit a squashed or fixed up commit
  2014-03-10 19:47 ` Junio C Hamano
@ 2014-03-11 10:01   ` Duy Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Duy Nguyen @ 2014-03-11 10:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

On Tue, Mar 11, 2014 at 2:47 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> After squashing or fixing up, you may want to have a final look at the
>> commit, edit some more if needed or even do some testing. --postedit
>> enables that. This is (to me) a paranoid mode so either I enable it
>> for all squashes and fixups, or none. Hence a new option, not new todo
>> commands that give finer selection.
>
> If we were to adopt Michael's (?) idea of allowing flags to each
> insn in the insn sheet, would this restriction be easily lifted?
>
> That is, instead of saying "squash", you say "squash --stop" or
> something.

I think I still need something similar, otherwise I would need to
s/squash/squash --stop/ after "rebase -i --autosquash". --postedit
code could be simplified by generating "squash --stop" though.

>> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
>> index a1adae8..42061fc 100644
>> --- a/git-rebase--interactive.sh
>> +++ b/git-rebase--interactive.sh
>> @@ -571,6 +571,11 @@ do_next () {
>>                       ;;
>>               esac
>>               record_in_rewritten $sha1
>> +             if test -n "$postedit"
>> +             then
>> +                     warn "Stopped at $sha1... $rest"
>> +                     exit_with_patch $sha1 0
>> +             fi
>>               ;;
>
> I would have expected that any new code would stop only at the last
> squash (or fixup) in a series of squashes, but this appears to stop
> even at an intermediate squashed result, which will not appear in
> the final history.  Am I misreading the patch (or misunderstanding
> the intent of the patch)?

Never thought of that case. Yes it should only stop at the last squash/fixup.
-- 
Duy

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

end of thread, other threads:[~2014-03-11 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-09  3:12 [PATCH] rebase: new option to post edit a squashed or fixed up commit Nguyễn Thái Ngọc Duy
2014-03-10 19:47 ` Junio C Hamano
2014-03-11 10:01   ` Duy Nguyen

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 NNTP newsgroup(s).