Thread (16 messages) 16 messages, 2 authors, 2021-02-26

[PATCH v2 0/6][Outreachy] commit: Implementation of "amend!" commit

STALE2047d

From: Charvi Mendiratta <hidden>
Date: 2021-02-25 10:16:57

Revision v2 of 6 in this series.

Revisions (6)
  1. v1 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]
  6. v6 [diff vs current]
This patch series teaches `git commit --fixup` to create "amend!" commit
as an alternative that works with `git rebase --autosquash`. It allows to
fixup both the content and the commit message of the specified commit.
Here we add two suboptions to the `--fixup`, first `amend` suboption that
creates an "amend!" commit. It takes the staged changes and also allows to
edit the commit message of the commit we are fixing.
Example usuage:
git commit --fixup=amend:<commit>

Secondly, `reword` suboption that creates an empty "amend!" commit i.e it
ignores the staged changes and only allows to reword/edit the commit message
of the commit we are fixing.
Example usuage:
git commit --fixup=reword:<commit>

** This work is rebased on the top of cm/rebase-i-updates.

Changes from v1:
(Thanks Junio C Hamano for the reviews and pointing out the changes required in v1)

* (As `reword` and `amend` suboptions of `--fixup` uses apha
  characters only) add helper function that does strspn(alpha) to
  detect that suboptions are passed to `--fixup` instead of checking
  if ':' occurs before '^' or '@'.

* update the `check_fixup_reword_options()` function and disallow
  `reword` option with path(argc), interactive and patch_interactive.
  Also update the test script (t7500).

* make '-m' commit message option incompatible with `amend` and
  `reword` suboption, as it is more expected to edit the original
  commit message while preparing "amend!" commit and using `-m` for
  directly appending the commit message results in the confusion at
  the user end. So, error out when combined with `m` and update
  the respective tests.

* slight improvements in commit messages and update the documention
  (git-commit.txt) to include the above changes.

Charvi Mendiratta (6):
  sequencer: export subject_length()
  commit: add amend suboption to --fixup to create amend! commit
  commit: add a reword suboption to --fixup
  t7500: add tests for --fixup=[amend|reword] options
  t3437: use --fixup with options to create amend! commit
  doc/git-commit: add documentation for fixup=[amend|reword] options

 Documentation/git-commit.txt              |  39 ++++++-
 Documentation/git-rebase.txt              |  21 ++--
 builtin/commit.c                          | 117 +++++++++++++++++--
 commit.c                                  |  14 +++
 commit.h                                  |   3 +
 sequencer.c                               |  14 ---
 t/t3437-rebase-fixup-options.sh           |  30 +----
 t/t7500-commit-template-squash-signoff.sh | 134 ++++++++++++++++++++++
 8 files changed, 306 insertions(+), 66 deletions(-)

--
2.29.0.rc1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help