From 13b70e61350364fa2cb227ffab809fe5d6c2cda7 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 18 Oct 2018 09:12:02 +0200 Subject: [PATCH 1/3] create-test-repo: sleep between commits Sleep after creating each test commit, so that the commits all have distinct timestamps. --- t/create-test-repo | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t/create-test-repo b/t/create-test-repo index 2223cb0..1fd530a 100755 --- a/t/create-test-repo +++ b/t/create-test-repo @@ -4,6 +4,9 @@ set -e DESCRIPTION="git-imerge test repository" +# Sleep between commits to give commits distinct timestamps: +SLEEP="sleep 1" + modify() { filename="$1" text="$2" @@ -36,12 +39,14 @@ git config user.email 'luser@example.com' modify a.txt 0 git commit -m 'm⇒0' +$SLEEP git checkout -b a -- for i in $(seq 8) do modify a.txt $i git commit -m "a⇒$i" + $SLEEP done git checkout -b b master -- @@ -49,6 +54,7 @@ for i in $(seq 5) do modify b.txt $i git commit -m "b⇒$i" + $SLEEP done git checkout -b c master -- @@ -56,13 +62,16 @@ for i in $(seq 3) do modify c.txt $i git commit -m "c⇒$i" + $SLEEP done modify conflict.txt "c version" git commit -m "c conflict" +$SLEEP for i in $(seq 4 8) do modify c.txt $i git commit -m "c⇒$i" + $SLEEP done git checkout -b d master -- @@ -70,6 +79,7 @@ for i in $(seq 2) do modify d.txt $i git commit -m "d⇒$i" + $SLEEP done modify conflict.txt "d version" git commit -m "d conflict" @@ -77,6 +87,7 @@ for i in $(seq 3 5) do modify d.txt $i git commit -m "d⇒$i" + $SLEEP done git checkout master -- From 9726039a520aaff4849c335e130643b8b7f451be Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 18 Oct 2018 09:13:44 +0200 Subject: [PATCH 2/3] MergeState.simplify_to_rebase_with_history: retain authors Retain the author metadata (author name, email, and timestamp) when simplifying an incremental merge into a rebase-with-history. --- git-imerge | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git-imerge b/git-imerge index b903539..38e3be3 100755 --- a/git-imerge +++ b/git-imerge @@ -2863,7 +2863,11 @@ class MergeState(Block): self.git.get_log_message(orig).rstrip('\n') + '\n\n(rebased-with-history from commit %s)\n' % orig ) - commit = self.git.commit_tree(tree, [commit, orig], msg=msg) + commit = self.git.commit_tree( + tree, [commit, orig], + msg=msg, + metadata=self.git.get_author_info(orig), + ) self._set_refname(refname, commit, force=force) From 33b297b3f615711bfcb6355756d63cdade58bf27 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 18 Oct 2018 09:15:26 +0200 Subject: [PATCH 3/3] MergeState.simplify_to_border: retain authors Retain the author metadata (author name, email, and timestamp) when simplifying an incremental merge to `border`, `border-with-history`, or `border-with-history2`. --- git-imerge | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/git-imerge b/git-imerge index 38e3be3..743fa24 100755 --- a/git-imerge +++ b/git-imerge @@ -2913,7 +2913,11 @@ class MergeState(Block): + '\n\n(rebased from commit %s)\n' % (orig,) ) - commit = self.git.commit_tree(tree, parents, msg=msg) + commit = self.git.commit_tree( + tree, parents, + msg=msg, + metadata=self.git.get_author_info(orig), + ) commit1 = commit i2 = self.len2 - 1 @@ -2936,7 +2940,11 @@ class MergeState(Block): + '\n\n(rebased from commit %s)\n' % (orig,) ) - commit = self.git.commit_tree(tree, parents, msg=msg) + commit = self.git.commit_tree( + tree, parents, + msg=msg, + metadata=self.git.get_author_info(orig), + ) commit2 = commit # Construct the apex commit: