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

[PATCH 1/3] t/rebase: add failing tests for a peculiar revision

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jun 13, 2013, 18:16 UTC
Message-ID
<1371147362-26962-2-git-send-email-artagnon@gmail.com>
In-Reply-To
<1371147362-26962-1-git-send-email-artagnon@gmail.com>

The following commands fail, even if :/quuxery resolves to a perfectly valid commit:

  $ git rebase :/quuxery
  $ git rebase -i :/quuxery

This is because rebase [-i] attempts to rev-parse ${REV}^0 to verify that the given revision resolves to a commit. Add tests to document these failures.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t3400-rebase.sh             | 8 ++++++++
 t/t3404-rebase-interactive.sh | 8 ++++++++
 2 files changed, 16 insertions(+)
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index b58fa1a..890f159 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -88,6 +88,14 @@ test_expect_success 'rebase fast-forward to master' '
 	test_i18ngrep "Fast-forwarded HEAD to my-topic-branch" out
 '
 
+test_expect_failure 'rebase against revision specified as :/quuxery' '
+	git checkout my-topic-branch^ &&
+	sha1=$(git rev-parse ":/Add B") &&
+	git rebase $sha1 &&
+	git checkout my-topic-branch^ &&
+	git rebase ":/Add B"
+'
+
 test_expect_success 'the rebase operation should not have destroyed author information' '
 	! (git log | grep "Author:" | grep "<>")
 '
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 79e8d3c..ca4ee92 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -947,4 +947,12 @@ test_expect_success 'rebase -i respects core.commentchar' '
 	test B = $(git cat-file commit HEAD^ | sed -ne \$p)
 '
 
+test_expect_failure 'rebase -i against revision specified as :/quuxery' '
+	git checkout branch1 &&
+	sha1=$(git rev-parse ":/J") &&
+	git rebase $sha1 &&
+	git checkout branch1 &&
+	git rebase ":/J"
+'
+
 test_done
-- 
1.8.3.1.381.g31c8856.dirty
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 2 of 4 in “Support :/quuxery in rebase (early preview)”
  1. 0/3 Support :/quuxery in rebase (early preview)Ramkumar Ramachandra, Jun 13, 2013
  2. 1/3 t/rebase: add failing tests for a peculiar revisionRamkumar Ramachandra, Jun 13, 2013
  3. 2/3 sh-setup: add new peel_committish() helperRamkumar Ramachandra, Jun 13, 2013
  4. 3/3 rebase: use peel_committish() where appropriateRamkumar Ramachandra, Jun 13, 2013

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.