git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 0/4] cherry-pick/revert cleanup scissors fix

From
Denton Liu <liu.denton@gmail.com>
Date
Mar 7, 2019, 09:58 UTC
Message-ID
<cover.1551951770.git.liu.denton@gmail.com>
In-Reply-To
<cover.1551940635.git.liu.denton@gmail.com>

As I stated earlier[1], I discovered today that git revert (and thus, git cherry-pick as well) do not place the scissors line properly as well. This patchset adds a scissors line when conflicts arise in both cherry-pick and revert, which fixes the same bug present in git-merge earlier.

This patchset should apply on top of dl/merge-cleanup-scissors-fix.
Changes since v1:
* Address Phillip's concern of calling get_cleanup_mode with use_editor = 1;
  only set to 1 if we are calling for revert or cherry-pick, else 0 to maintain
  original behaviour (for rebasing).
* Do not die if provided an invalid cleanup option, instead just warn and
  fallback to default option.
Changes since v2:
* s/prepended/appended/
* Use $OID_REGEX instead of self-made regex
* Don't die if bad config option is given, otherwise die if a bad
  command-line argument is given
[1]: https://public-inbox.org/git/20190306014143.GA2580@dev-l/
Denton Liu (4):
  merge-options.txt: correct typo
  t3507: cleanup space after redirection operators
  cherry-pick/revert: add scissors line on merge conflict
  sequencer.c: don't die on invalid cleanup_arg
 Documentation/git-cherry-pick.txt |   7 ++
 Documentation/git-revert.txt      |   7 ++
 Documentation/merge-options.txt   |   4 +-
 builtin/commit.c                  |   2 +-
 builtin/merge.c                   |  15 +---
 builtin/rebase--helper.c          |   2 +-
 builtin/revert.c                  |   5 ++
 sequencer.c                       |  40 +++++-----
 sequencer.h                       |   5 +-
 t/t3507-cherry-pick-conflict.sh   | 120 +++++++++++++++++++++++++-----
 10 files changed, 153 insertions(+), 54 deletions(-)
Range-diff against v2:
-:  ---------- > 1:  1076d4c451 merge-options.txt: correct typo
1:  4eee16cc5a = 2:  6bce4d4722 t3507: cleanup space after redirection operators
2:  8fdc5bfb15 ! 3:  14672ce10c cherry-pick/revert: add scissors line on merge conflict
    @@ -27,7 +27,7 @@
     +	This option determines how the commit message will be cleaned up before
     +	being passed on. See linkgit:git-commit[1] for more details. In
     +	addition, if the '<mode>' is given a value of `scissors`, scissors will
    -+	be prepended to MERGE_MSG before being passed on in the case of a
    ++	be appended to MERGE_MSG before being passed on in the case of a
     +	conflict.
     +
      -x::
    @@ -45,7 +45,7 @@
     +	This option determines how the commit message will be cleaned up before
     +	being passed on. See linkgit:git-commit[1] for more details. In
     +	addition, if the '<mode>' is given a value of `scissors`, scissors will
    -+	be prepended to MERGE_MSG before being passed on in the case of a
    ++	be appended to MERGE_MSG before being passed on in the case of a
     +	conflict.
     +
      -n::
    @@ -233,8 +233,7 @@
     +
     +	test_must_fail git cherry-pick picked &&
     +
    -+	sed "s/[a-f0-9]\{40\}/objid/" .git/MERGE_MSG >actual &&
    -+	test_i18ncmp expected actual
    ++	test_i18ncmp expected .git/MERGE_MSG
     +'
     +
     +test_expect_success \
    @@ -254,8 +253,7 @@
     +
     +	test_must_fail git cherry-pick --cleanup=scissors picked &&
     +
    -+	sed "s/[a-f0-9]\{40\}/objid/" .git/MERGE_MSG >actual &&
    -+	test_i18ncmp expected actual
    ++	test_i18ncmp expected .git/MERGE_MSG
     +'
     +
      test_expect_success 'failed cherry-pick describes conflict in work tree' '
    @@ -272,7 +270,7 @@
     +	cat >expected <<-EOF &&
     +		Revert "picked"
     +
    -+		This reverts commit objid.
    ++		This reverts commit OBJID.
     +
     +		# ------------------------ >8 ------------------------
     +		# Do not modify or remove the line above.
    @@ -284,7 +282,7 @@
     +
     +	test_must_fail git revert picked &&
     +
    -+	sed "s/[a-f0-9]\{40\}/objid/" .git/MERGE_MSG >actual &&
    ++	sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
     +	test_i18ncmp expected actual
     +'
     +
    @@ -295,7 +293,7 @@
     +	cat >expected <<-EOF &&
     +		Revert "picked"
     +
    -+		This reverts commit objid.
    ++		This reverts commit OBJID.
     +
     +		# ------------------------ >8 ------------------------
     +		# Do not modify or remove the line above.
    @@ -307,7 +305,7 @@
     +
     +	test_must_fail git revert --cleanup=scissors picked &&
     +
    -+	sed "s/[a-f0-9]\{40\}/objid/" .git/MERGE_MSG >actual &&
    ++	sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
     +	test_i18ncmp expected actual
     +'
     +
3:  f3af8000ae < -:  ---------- sequencer.c: don't die on invalid cleanup_arg
-:  ---------- > 4:  68ec2b7cd7 sequencer.c: don't die on invalid cleanup_arg
-- 
2.21.0.370.g4fdb13b891
Previous: Junio C HamanoNext: Denton Liu
Message 15 of 25 in “cherry-pick/revert cleanup scissors fix”
  1. 0/2 cherry-pick/revert cleanup scissors fixDenton Liu, Mar 6, 2019
  2. 1/2 t3507: cleanup space after redirection operatorsDenton Liu, Mar 6, 2019
  3. 2/2 cherry-pick/revert: add scissors line on merge conflictDenton Liu, Mar 6, 2019
  4. Phillip WoodMar 6, 2019
  5. Denton LiuMar 7, 2019
  6. Denton LiuMar 7, 2019
  7. 0/3 cherry-pick/revert cleanup scissors fixDenton Liu, Mar 7, 2019
  8. 1/3 t3507: cleanup space after redirection operatorsDenton Liu, Mar 7, 2019
  9. Junio C HamanoMar 7, 2019
  10. 2/3 cherry-pick/revert: add scissors line on merge conflictDenton Liu, Mar 7, 2019
  11. Junio C HamanoMar 7, 2019
  12. Denton LiuMar 7, 2019
  13. 3/3 sequencer.c: don't die on invalid cleanup_argDenton Liu, Mar 7, 2019
  14. Junio C HamanoMar 7, 2019
  15. 0/4 cherry-pick/revert cleanup scissors fixDenton Liu, Mar 7, 2019
  16. 1/4 merge-options.txt: correct typoDenton Liu, Mar 7, 2019
  17. Junio C HamanoMar 8, 2019
  18. 2/4 t3507: cleanup space after redirection operatorsDenton Liu, Mar 7, 2019
  19. 3/4 cherry-pick/revert: add scissors line on merge conflictDenton Liu, Mar 7, 2019
  20. Phillip WoodMar 7, 2019
  21. Denton LiuMar 7, 2019
  22. Phillip WoodMar 7, 2019
  23. Junio C HamanoMar 8, 2019
  24. 4/4 sequencer.c: don't die on invalid cleanup_argDenton Liu, Mar 7, 2019
  25. Phillip WoodMar 7, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.