mbox series

[v3,0/9,Outreachy] rebase -i: add options to fixup command

Message ID 20210124170405.30583-1-charvi077@gmail.com (mailing list archive)
Headers show
Series rebase -i: add options to fixup command | expand

Message

Charvi Mendiratta Jan. 24, 2021, 5:03 p.m. UTC
This patch series adds fixup [-C|-c] options to interactive rebase. In
addition to amending the contents of the commit as the `fixup` command
does now, `fixup -C` replaces the commit message of the original commit
which we are fixing up with the message of the fixup commit.
And to edit the fixup commit message before committing, `fixup -c`
command is used instead of `fixup -C`. This convention is similar to
the existing `merge` command in the interactive rebase, that also supports
`-c` and `-C` options with similar meanings.

This patch series also changes `rebase -i --autosquash` to rearrange
commits whose message starts with "amend!" and replaces the pick
command with `fixup -C`. The creation of "amend!" commits will be
rebase -i: add options to fixup command added in another patch series.

This is done in reference to the issue opened by Dscho as here[1] and
further discussed briefly[2]. Also, there is discussion[3] regarding the
implementation of reword! commit. The past patches of Phillip Wood’s
work[4], implements 'reword!' as 'amend!' in git rebase and these patches
uses those as the initial base.
And to avoid the extra command in the interactive rebase, this patch
series instead add options to the current fixup command in interactive
rebase (fixup [-C | -c]) as discussed earlier[5].

Changes from v2 :

(Thanks to Junio C Hamano, Marc Branchaud, Christian Couder, Phillip Wood
and Taylor Blau for the reviews and suggestions)

* Updated the Documentation/git-rebase.txt
* Added tests(t3437-rebase-fixup-options.sh) to check working of multiple
  fixup -c in rebase -i and related changes in sequencer.c
* Updated subject_length() function in sequencer.c and some corrections in
  t3415-rebase-autosquash.sh

[1] https://github.com/gitgitgadget/git/issues/259
[2] https://public-inbox.org/git/alpine.DEB.2.21.1.1710151754070.40514@virtualbox/
[3] https://lore.kernel.org/git/95cc6fb2-d1bc-11de-febe-c2b5c78a6850@gmail.com/
[4] https://github.com/phillipwood/git/commits/wip/rebase-amend
[5] https://lore.kernel.org/git/29fc2f59-1cca-a3db-5586-bbd7b2e4806d@gmail.com/


Charvi Mendiratta (6):
  sequencer: pass todo_item to do_pick_commit()
  sequencer: use const variable for commit message comments
  rebase -i: add fixup [-C | -c] command
  t3437: test script for fixup [-C|-c] options in interactive rebase
  rebase -i: teach --autosquash to work with amend!
  doc/git-rebase: add documentation for fixup [-C|-c] options

Phillip Wood (3):
  rebase -i: only write fixup-message when it's needed
  sequencer: factor out code to append squash message
  rebase -i: comment out squash!/fixup! subjects from squash message

 Documentation/git-rebase.txt      |  14 +-
 rebase-interactive.c              |   4 +-
 sequencer.c                       | 295 ++++++++++++++++++++++++++----
 t/lib-rebase.sh                   |   4 +
 t/t3415-rebase-autosquash.sh      |  30 +--
 t/t3437-rebase-fixup-options.sh   | 225 +++++++++++++++++++++++
 t/t3437/expected-combined-message |  21 +++
 t/t3437/expected-squash-message   |  51 ++++++
 t/t3900-i18n-commit.sh            |   4 -
 9 files changed, 587 insertions(+), 61 deletions(-)
 create mode 100755 t/t3437-rebase-fixup-options.sh
 create mode 100644 t/t3437/expected-combined-message
 create mode 100644 t/t3437/expected-squash-message

--
2.29.0.rc1