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

[PATCH 1/2] rebase tests: test linear branch topology

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 21, 2019, 21:40 UTC
Message-ID
<20190221214059.9195-2-avarab@gmail.com>
In-Reply-To
<20190221151009.GA24309@sigill.intra.peff.net>

Add tests rebasing a linear branch topology to linear rebase tests added in 2aad7cace2 ("add simple tests of consistency across rebase types", 2013-06-06).

These tests are duplicates of two surrounding tests that do the same with tags pointing to the same objects. Right now there's no change in behavior being introduced, but as we'll see in a subsequent change rebase can have different behaviors when working implicitly with remote tracking branches.

While I'm at it add a --fork-point test, strictly speaking this is redundant to the existing '' test, as no argument to rebase implies --fork-point. But now it's easier to grep for tests that explicitly stress --fork-point.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t3421-rebase-topology-linear.sh | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff --git a/t/t3421-rebase-topology-linear.sh b/t/t3421-rebase-topology-linear.sh
index 7274dca40b..b847064f91 100755
--- a/t/t3421-rebase-topology-linear.sh
+++ b/t/t3421-rebase-topology-linear.sh
@@ -31,6 +31,16 @@ test_run_rebase success -m
 test_run_rebase success -i
 test_have_prereq !REBASE_P || test_run_rebase success -p
 
+test_expect_success 'setup branches and remote tracking' '
+	git tag -l >tags &&
+	for tag in $(cat tags)
+	do
+		git branch branch-$tag $tag || return 1
+	done &&
+	git remote add origin "file://$PWD" &&
+	git fetch origin
+'
+
 test_run_rebase () {
 	result=$1
 	shift
@@ -57,10 +67,28 @@ test_run_rebase () {
 	"
 }
 test_run_rebase success ''
+test_run_rebase success --fork-point
 test_run_rebase success -m
 test_run_rebase success -i
 test_have_prereq !REBASE_P || test_run_rebase failure -p
 
+test_run_rebase () {
+	result=$1
+	shift
+	test_expect_$result "rebase $* -f rewrites even if remote upstream is an ancestor" "
+		reset_rebase &&
+		git rebase $* -f branch-b branch-e &&
+		! test_cmp_rev branch-e origin/branch-e &&
+		test_cmp_rev branch-b HEAD~2 &&
+		test_linear_range 'd e' branch-b..
+	"
+}
+test_run_rebase success ''
+test_run_rebase success --fork-point
+test_run_rebase success -m
+test_run_rebase success -i
+test_have_prereq !REBASE_P || test_run_rebase success -p
+
 test_run_rebase () {
 	result=$1
 	shift
@@ -71,6 +99,7 @@ test_run_rebase () {
 	"
 }
 test_run_rebase success ''
+test_run_rebase success --fork-point
 test_run_rebase success -m
 test_run_rebase success -i
 test_have_prereq !REBASE_P || test_run_rebase success -p
-- 
2.21.0.rc0.258.g878e2cd30e
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 6 of 12 in “BUG: 2.11-era rebase regression when @{upstream} is implicitly used”
  1. Ævar Arnfjörð BjarmasonFeb 14, 2019
  2. Jeff KingFeb 21, 2019
  3. Ævar Arnfjörð BjarmasonFeb 21, 2019
  4. Jeff KingFeb 21, 2019
  5. 0/2 rebase: fix 2.11.0-era --fork-point regressionÆvar Arnfjörð Bjarmason, Feb 21, 2019
  6. 1/2 rebase tests: test linear branch topologyÆvar Arnfjörð Bjarmason, Feb 21, 2019
  7. Jeff KingFeb 22, 2019
  8. Junio C HamanoFeb 22, 2019
  9. 2/2 rebase: don't rebase linear topology with --fork-pointÆvar Arnfjörð Bjarmason, Feb 21, 2019
  10. Jeff KingFeb 22, 2019
  11. Ævar Arnfjörð BjarmasonFeb 22, 2019
  12. Jeff KingFeb 24, 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.