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

[PATCH 3/3] rebase: use peel_committish() where appropriate

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jun 13, 2013, 18:16 UTC
Message-ID
<1371147362-26962-4-git-send-email-artagnon@gmail.com>
In-Reply-To
<1371147362-26962-1-git-send-email-artagnon@gmail.com>
The failing tests in t/rebase and t/rebase-interactive pass as a result.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 git-rebase.sh                 | 6 +++---
 t/t3400-rebase.sh             | 2 +-
 t/t3404-rebase-interactive.sh | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index d0c11a9..28e8d47 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -434,7 +434,7 @@ then
 		shift
 		;;
 	esac
-	upstream=`git rev-parse --verify "${upstream_name}^0"` ||
+	upstream=$(peel_committish "${upstream_name}") ||
 	die "$(eval_gettext "invalid upstream \$upstream_name")"
 	upstream_arg="$upstream_name"
 else
@@ -470,7 +470,7 @@ case "$onto_name" in
 	fi
 	;;
 *)
-	onto=$(git rev-parse --verify "${onto_name}^0") ||
+	onto=$(peel_committish "$onto_name") ||
 	die "$(eval_gettext "Does not point to a valid commit: \$onto_name")"
 	;;
 esac
@@ -490,7 +490,7 @@ case "$#" in
 	   orig_head=$(git rev-parse -q --verify "refs/heads/$1")
 	then
 		head_name="refs/heads/$1"
-	elif orig_head=$(git rev-parse -q --verify "$1")
+	elif orig_head=$(peel_committish "$1" quiet)
 	then
 		head_name="detached HEAD"
 	else
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 890f159..272f0f5 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -88,7 +88,7 @@ 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' '
+test_expect_success 'rebase against revision specified as :/quuxery' '
 	git checkout my-topic-branch^ &&
 	sha1=$(git rev-parse ":/Add B") &&
 	git rebase $sha1 &&
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index ca4ee92..c9a5d56 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -947,7 +947,7 @@ 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' '
+test_expect_success 'rebase -i against revision specified as :/quuxery' '
 	git checkout branch1 &&
 	sha1=$(git rev-parse ":/J") &&
 	git rebase $sha1 &&
-- 
1.8.3.1.381.g31c8856.dirty
Previous: Ramkumar Ramachandra
Message 4 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.