Re: [PATCH 2/3] sh-setup: add new peel_committish() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Ramkumar Ramachandra" <artagnon@xxxxxxxxx>
Sent: Friday, June 14, 2013 2:17 PM
The normal way to check whether a certain revision resolves to a valid
commit is:

 $ git rev-parse --verify $REV^0

Unfortunately, this does not work when $REV is of the type :/quuxery.

Is there a proper name for this style of revision specification? I've been letting this 'style' wash over me in the hope that I'd understand eventually, but it hasn't.

Loking at git-rev-parse I now see that it might be the 'Commit Message Regex' rev specifier.

If re-rolled, can this elucidation be included in the commit message?

Write a helper to work around this limitation.

Suggested-by: Junio C Hamano <gitster@xxxxxxxxx>
Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx>
---
git-sh-setup.sh | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 2f78359..7a964ad 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
+}
--
1.8.3.1.381.g12ca056.dirty

--
Philip
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]