aboutsummaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-06-24 13:48:40 -0700
committerJunio C Hamano <gitster@pobox.com>2013-06-24 13:48:40 -0700
commitbc918acf708a839bbc350e014d599fdd458319ca (patch)
tree3b93414f5146cf1e76ecfd005162feedc19f30e5 /git-sh-setup.sh
parent8d8975aca7c2b031a2386cd8f266109a8c6e1973 (diff)
parent2e6e276decde2a9f04fc29bce734a49d3ba8f484 (diff)
downloadgit-bc918acf708a839bbc350e014d599fdd458319ca.tar.xz
Merge branch 'rr/rebase-sha1-by-string-query'
Allow various commit objects to be given to "git rebase" by ':/look for this string' syntax, e.g. "git rebase --onto ':/there'". * rr/rebase-sha1-by-string-query: rebase: use peel_committish() where appropriate sh-setup: add new peel_committish() helper t/rebase: add failing tests for a peculiar revision
Diffstat (limited to 'git-sh-setup.sh')
-rw-r--r--git-sh-setup.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 2f7835941e..7a964ad2ff 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -313,3 +313,15 @@ then
}
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
fi
+
+peel_committish () {
+ case "$1" in
+ :/*)
+ peeltmp=$(git rev-parse --verify "$1") &&
+ git rev-parse --verify "${peeltmp}^0"
+ ;;
+ *)
+ git rev-parse --verify "${1}^0"
+ ;;
+ esac
+}