(In reply to Byron Jones ‹:glob› 🎈 from comment #1) > We probably need a `short_node` function which only shortens strings that look like a commit SHA (`/^[0-9a-f]{40}$/`) Maybe use `{12,40}` instead of `40`. But maybe better is to use git commands to know if some revision info is a reference or a sha git revhash. For example: ``` # This errors if ref isn't a valid reference. With --quiet it doesn't output anything. git show-ref --verify --quiet <ref> # This errors if ref-or-sha isn't a valid reference or a valid sha in this repository # Otherwise it prints the sha for this ref. git rev-parse --verify <ref-or-sha> ``` Maybe there are others I don't know, or some attributes for these commands that could be more useful. Hope this helps!
Bug 1595104 Comment 4 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Byron Jones ‹:glob› 🎈 from comment #1) > We probably need a `short_node` function which only shortens strings that look like a commit SHA (`/^[0-9a-f]{40}$/`) Maybe use `{12,40}` instead of `40`. But maybe better is to use git commands to know if some revision info is a reference or a sha. For example: ``` # This errors if ref isn't a valid reference. With --quiet it doesn't output anything. git show-ref --verify --quiet <ref> # This errors if ref-or-sha isn't a valid reference or a valid sha in this repository # Otherwise it prints the sha for this ref. git rev-parse --verify <ref-or-sha> ``` Maybe there are others I don't know, or some attributes for these commands that could be more useful. Hope this helps!