git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rebase --preserve-merges: ignore "merge.log" config
@ 2013-08-21 18:48 Ralf Thielow
  2013-08-21 20:22 ` Eric Sunshine
  2013-08-21 22:44 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Ralf Thielow @ 2013-08-21 18:48 UTC (permalink / raw)
  To: git; +Cc: gitster, Ralf Thielow

When "merge.log" config is set, "rebase --preserve-merges"
will add the log lines to the message of the rebased merge
commit.

A rebase should not modify a commit message automatically.

Teach "git-rebase" to ignore that configuration by passing "--no-log"
to the git-merge call.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
---
 git-rebase--interactive.sh        |  3 ++-
 t/t3409-rebase-preserve-merges.sh | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 83d6d46..4743c59 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -352,8 +352,9 @@ pick_one_preserving_merges () {
 			msg_content="$(commit_message $sha1)"
 			# No point in merging the first parent, that's HEAD
 			new_parents=${new_parents# $first_parent}
+			merge_args="--no-log --no-ff"
 			if ! do_with_author output eval \
-			'git merge --no-ff $strategy_args -m "$msg_content" $new_parents'
+			'git merge $merge_args $strategy_args -m "$msg_content" $new_parents'
 			then
 				printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
 				die_with_patch $sha1 "Error redoing merge $sha1"
diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
index 2e0c364..2454811 100755
--- a/t/t3409-rebase-preserve-merges.sh
+++ b/t/t3409-rebase-preserve-merges.sh
@@ -28,6 +28,8 @@ export GIT_AUTHOR_EMAIL
 #     \--A3    <-- topic2
 #      \
 #       B2     <-- origin/topic
+#
+# Clone 4 (same as Clone 3)
 
 test_expect_success 'setup for merge-preserving rebase' \
 	'echo First > A &&
@@ -64,6 +66,16 @@ test_expect_success 'setup for merge-preserving rebase' \
 		git merge --no-ff topic2
 	) &&
 
+	git clone ./. clone4 &&
+	(
+		cd clone4 &&
+		git checkout -b topic2 origin/topic &&
+		echo Sixth > A &&
+		git commit -a -m "Modify A3" &&
+		git checkout -b topic origin/topic &&
+		git merge --no-ff topic2
+	) &&
+
 	git checkout topic &&
 	echo Fourth >> B &&
 	git commit -a -m "Modify B2"
@@ -96,4 +108,17 @@ test_expect_success 'rebase -p preserves no-ff merges' '
 	)
 '
 
+test_expect_success 'rebase -p ignores merge.log config' '
+	(
+	cd clone4 &&
+	git fetch &&
+	git -c merge.log=1 rebase -p origin/topic &&
+	cat >expected <<-\EOF &&
+
+	EOF
+	git log --format="%b" -1 >current
+	test_cmp expected current
+	)
+'
+
 test_done
-- 
1.8.4.rc4.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rebase --preserve-merges: ignore "merge.log" config
  2013-08-21 18:48 [PATCH] rebase --preserve-merges: ignore "merge.log" config Ralf Thielow
@ 2013-08-21 20:22 ` Eric Sunshine
  2013-08-21 22:44 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Sunshine @ 2013-08-21 20:22 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: Git List, Junio C Hamano

On Wed, Aug 21, 2013 at 2:48 PM, Ralf Thielow <ralf.thielow@gmail.com> wrote:
> When "merge.log" config is set, "rebase --preserve-merges"
> will add the log lines to the message of the rebased merge
> commit.
>
> A rebase should not modify a commit message automatically.
>
> Teach "git-rebase" to ignore that configuration by passing "--no-log"
> to the git-merge call.
>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---
> diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
> index 2e0c364..2454811 100755
> --- a/t/t3409-rebase-preserve-merges.sh
> +++ b/t/t3409-rebase-preserve-merges.sh
> @@ -96,4 +108,17 @@ test_expect_success 'rebase -p preserves no-ff merges' '
>         )
>  '
>
> +test_expect_success 'rebase -p ignores merge.log config' '
> +       (
> +       cd clone4 &&
> +       git fetch &&
> +       git -c merge.log=1 rebase -p origin/topic &&
> +       cat >expected <<-\EOF &&
> +
> +       EOF

This might be clearer with a simple 'echo' instead of 'cat' with heredoc:

  echo >expected &&

> +       git log --format="%b" -1 >current
> +       test_cmp expected current
> +       )
> +'
> +
>  test_done
> --
> 1.8.4.rc4.dirty

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rebase --preserve-merges: ignore "merge.log" config
  2013-08-21 18:48 [PATCH] rebase --preserve-merges: ignore "merge.log" config Ralf Thielow
  2013-08-21 20:22 ` Eric Sunshine
@ 2013-08-21 22:44 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2013-08-21 22:44 UTC (permalink / raw)
  To: Ralf Thielow; +Cc: git

Ralf Thielow <ralf.thielow@gmail.com> writes:

> When "merge.log" config is set, "rebase --preserve-merges"
> will add the log lines to the message of the rebased merge
> commit.
>
> A rebase should not modify a commit message automatically.
>
> Teach "git-rebase" to ignore that configuration by passing "--no-log"
> to the git-merge call.
>
> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
> ---

Thanks; will queue with the following squashed-in.

 t/t3409-rebase-preserve-merges.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh
index 2454811..8c251c5 100755
--- a/t/t3409-rebase-preserve-merges.sh
+++ b/t/t3409-rebase-preserve-merges.sh
@@ -113,10 +113,8 @@ test_expect_success 'rebase -p ignores merge.log config' '
 	cd clone4 &&
 	git fetch &&
 	git -c merge.log=1 rebase -p origin/topic &&
-	cat >expected <<-\EOF &&
-
-	EOF
-	git log --format="%b" -1 >current
+	echo >expected &&
+	git log --format="%b" -1 >current &&
 	test_cmp expected current
 	)
 '

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-21 22:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21 18:48 [PATCH] rebase --preserve-merges: ignore "merge.log" config Ralf Thielow
2013-08-21 20:22 ` Eric Sunshine
2013-08-21 22:44 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).