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

Re: [PATCH v2 2/3] cherry-pick/revert: add scissors line on merge conflict

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 7, 2019, 07:52 UTC
Message-ID
<xmqqa7i7m886.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<8fdc5bfb151e4224eba01021c6f0be3e61e1f535.1551940635.git.liu.denton@gmail.com>
Denton Liu <liu.denton@gmail.com> writes:
Show 11 quoted lines
> Fix a bug where the scissors line is placed after the Conflicts:
> section, in the case where a merge conflict occurs and
> commit.cleanup = scissors.
>
> Note that the removal of the if-else tower in git_sequencer_config may
> appear to be a no-op refactor but it actually isn't. First of all, we
> now accept "default". More importantly, though, if
> commit.cleanup = scissors, the cleanup enum will be set to
> COMMIT_MSG_CLEANUP_SCISSORS instead of COMMIT_MSG_CLEANUP_SPACE when we
> are reverting or cherry-picking. This allows us to append scissors to
> MERGE_MSG in the case of a conflict.
Good thing to point out in the log message.
Show 16 quoted lines
> diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
> index d35d771fc8..5c086d78c8 100644
> diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
> index 837707a8fd..1894010e60 100644
> --- a/Documentation/git-revert.txt
> +++ b/Documentation/git-revert.txt
> @@ -66,6 +66,13 @@ more details.
>  	With this option, 'git revert' will not start the commit
>  	message editor.
>  
> +--cleanup=<mode>::
> +	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
> +	conflict.
These both say "prepended", but shouldn't the code
 - add the merge message proper, with the expectation that it would
   be used more or less intact in the final commit message; then
 - add the scissors; then
 - append informative cruft that would be removed, only to help
   human users.

in this order? I'd expect that most people would consider that the primary payload of MERGE_MSG file is the part that would become the commit message, so I would have expected the second step would be described as "appended to".

Another thing I notice is that this singles out "scissors" mode; doesn't the code do anything worth describing with other clean-up modes?

> +	sed "s/[a-f0-9]\{40\}/objid/" .git/MERGE_MSG >actual &&

Use $_x40 (or $OID_REGEX) to make it more readable and also future-proof?

Previous: Denton LiuNext: Denton Liu
Message 11 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.