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

[PATCH] new test: rev-list --cherry-pick excludes an empty commit against a superseding merge

From
Uwe Kleine-König <uwe.kleine-koenig@digi.com>
Date
Feb 13, 2008, 10:10 UTC
Message-ID
<1202897413-7762-1-git-send-email-Uwe.Kleine-Koenig@digi.com>
In-Reply-To
<20080213092910.GA20219@digi.com>

Currently rev-list --cherry-pick kicks out two commits if they introduce the same change to their first parent and ignores other parents. This can be bad if both sides used the ours strategy to supersede old development branches.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
---
 t/t6007-rev-list-cherry-pick-file.sh |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
Hello,

I'm not sure if combined diff is the right term. I'm open for a better one.

Moreover I'm not happy with the shortlog, maybe someone has a better suggestion?

diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
index 4b8611c..26f62e1 100755
--- a/t/t6007-rev-list-cherry-pick-file.sh
+++ b/t/t6007-rev-list-cherry-pick-file.sh
@@ -29,7 +29,13 @@ test_expect_success setup '
 	git checkout branch foo &&
 	test_tick &&
 	git commit -m "B" &&
-	git tag B
+	git tag B &&
+	test_tick &&
+	git checkout -b emptymerge A &&
+	git merge --no-ff -s ours master branch &&
+	test_tick &&
+	git checkout -b empty A &&
+	git commit --allow-empty -m empty
 '
 
 test_expect_success '--cherry-pick foo comes up empty' '
@@ -54,4 +60,10 @@ test_expect_success '--cherry-pick with independent, but identical branches' '
 		HEAD...master -- foo)"
 '
 
+# don't kick out commits c1, c2 with diff c1 c1^ == diff c2 c2^ but 
+# with different combined diffs
+test_expect_failure '--cherry-pick with a superseding merge and an empty commit' '
+	test "4" == "$(git rev-list --cherry-pick empty...emptymerge | wc -l)"
+'
+
 test_done
-- 
1.5.4
Previous: Uwe Kleine-König
Message 4 of 4 in “problem with git rebase -i”
  1. Uwe Kleine-KönigFeb 11, 2008
  2. Uwe Kleine-KönigFeb 13, 2008
  3. Uwe Kleine-KönigFeb 13, 2008
  4. new test: rev-list --cherry-pick excludes an empty commit against a superseding mergeUwe Kleine-König, Feb 13, 2008

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.