All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Phillip Wood <phillip.wood123@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v3 0/4] cherry-pick/revert cleanup scissors fix
Date: Thu, 7 Mar 2019 01:58:24 -0800	[thread overview]
Message-ID: <cover.1551951770.git.liu.denton@gmail.com> (raw)
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


  parent reply	other threads:[~2019-03-07  9:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 10:30 [PATCH 0/2] cherry-pick/revert cleanup scissors fix Denton Liu
2019-03-06 10:30 ` [PATCH 1/2] t3507: cleanup space after redirection operators Denton Liu
2019-03-06 10:30 ` [PATCH 2/2] cherry-pick/revert: add scissors line on merge conflict Denton Liu
2019-03-06 16:29   ` Phillip Wood
2019-03-07  0:04     ` Denton Liu
2019-03-07  0:16     ` Denton Liu
2019-03-07  6:44 ` [PATCH v2 0/3] cherry-pick/revert cleanup scissors fix Denton Liu
2019-03-07  6:44   ` [PATCH v2 1/3] t3507: cleanup space after redirection operators Denton Liu
2019-03-07  7:34     ` Junio C Hamano
2019-03-07  6:44   ` [PATCH v2 2/3] cherry-pick/revert: add scissors line on merge conflict Denton Liu
2019-03-07  7:52     ` Junio C Hamano
2019-03-07  9:19       ` Denton Liu
2019-03-07  6:44   ` [PATCH v2 3/3] sequencer.c: don't die on invalid cleanup_arg Denton Liu
2019-03-07  8:01     ` Junio C Hamano
2019-03-07  9:58   ` Denton Liu [this message]
2019-03-07  9:58     ` [PATCH v3 1/4] merge-options.txt: correct typo Denton Liu
2019-03-08  3:40       ` Junio C Hamano
2019-03-07  9:58     ` [PATCH v3 2/4] t3507: cleanup space after redirection operators Denton Liu
2019-03-07  9:58     ` [PATCH v3 3/4] cherry-pick/revert: add scissors line on merge conflict Denton Liu
2019-03-07 15:24       ` Phillip Wood
2019-03-07 17:56         ` Denton Liu
2019-03-07 18:36           ` Phillip Wood
2019-03-08  0:09             ` Junio C Hamano
2019-03-07  9:58     ` [PATCH v3 4/4] sequencer.c: don't die on invalid cleanup_arg Denton Liu
2019-03-07 15:21       ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1551951770.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood123@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.