diff mbox series

[7/9] git-sh-setup: move peel_committish() function to git-subtree.sh

Message ID patch-7.9-a3047b93f7d-20210902T155758Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series remove dead shell code | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 2, 2021, 4:01 p.m. UTC
Move the peel_committish() function out of git-sh-setup to its only
user, contrib/subtree/git-subtree.sh. Since d03ebd411c6 (rebase:
remove the rebase.useBuiltin setting, 2019-03-18) when
git-legacy-rebase.sh was removed, it has only been used in
git-subtree.sh.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 contrib/subtree/git-subtree.sh | 12 ++++++++++++
 git-sh-setup.sh                | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 7f767b5c38f..a6deb57bcae 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -818,6 +818,18 @@  cmd_add_repository () {
 	cmd_add_commit FETCH_HEAD
 }
 
+peel_committish () {
+	case "$1" in
+	:/*)
+		peeltmp=$(git rev-parse --verify "$1") &&
+		git rev-parse --verify "${peeltmp}^0"
+		;;
+	*)
+		git rev-parse --verify "${1}^0"
+		;;
+	esac
+}
+
 # Usage: cmd_add_commit REV
 cmd_add_commit () {
 	# The rev has already been validated by cmd_add(), we just
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 6a21238dc0e..9243353bc21 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -294,15 +294,3 @@  if test -z "$NONGIT_OK"
 then
 	git_dir_init
 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
-}