diff mbox series

[20/30] subtree: use "^{commit}" instead of "^0"

Message ID 20210423194230.1388945-21-lukeshu@lukeshu.com (mailing list archive)
State Superseded
Headers show
Series subtree: clean up, improve UX | expand

Commit Message

Luke Shumaker April 23, 2021, 7:42 p.m. UTC
From: Luke Shumaker <lukeshu@datawire.io>

They are synonyms.  Both are used in the file.  ^{commit} is clearer, so
"standardize" on that.

Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
---
 contrib/subtree/git-subtree.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ævar Arnfjörð Bjarmason April 26, 2021, 7:43 a.m. UTC | #1
On Fri, Apr 23 2021, Luke Shumaker wrote:

> From: Luke Shumaker <lukeshu@datawire.io>
>
> They are synonyms.  Both are used in the file.  ^{commit} is clearer, so
> "standardize" on that.
>
> Signed-off-by: Luke Shumaker <lukeshu@datawire.io>
> ---
>  contrib/subtree/git-subtree.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 9d365c9f2f..d200fbfed7 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -302,7 +302,7 @@ find_latest_squash () {
>  			main="$b"
>  			;;
>  		git-subtree-split:)
> -			sub="$(git rev-parse "$b^0")" ||
> +			sub="$(git rev-parse "$b^{commit}")" ||
>  			die "could not rev-parse split hash $b from commit $sq"
>  			;;
>  		END)
> @@ -349,7 +349,7 @@ find_existing_splits () {
>  			main="$b"
>  			;;
>  		git-subtree-split:)
> -			sub="$(git rev-parse "$b^0")" ||
> +			sub="$(git rev-parse "$b^{commit}")" ||
>  			die "could not rev-parse split hash $b from commit $sq"
>  			;;
>  		END)

Not a new problem, but those error messages seem weird/bad, isn't that
message originally from find_existing_splits() and copied over to
find_latest_squash() where talking about "split hash" doesn't make
sense?

I'd expect something like "could not peel $b to commit" as the error for
both.
diff mbox series

Patch

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 9d365c9f2f..d200fbfed7 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -302,7 +302,7 @@  find_latest_squash () {
 			main="$b"
 			;;
 		git-subtree-split:)
-			sub="$(git rev-parse "$b^0")" ||
+			sub="$(git rev-parse "$b^{commit}")" ||
 			die "could not rev-parse split hash $b from commit $sq"
 			;;
 		END)
@@ -349,7 +349,7 @@  find_existing_splits () {
 			main="$b"
 			;;
 		git-subtree-split:)
-			sub="$(git rev-parse "$b^0")" ||
+			sub="$(git rev-parse "$b^{commit}")" ||
 			die "could not rev-parse split hash $b from commit $sq"
 			;;
 		END)