Command Palette
Search for a command to run...

Disambiguating the sha suffix

A ref is [alias:]path[#fragment][:sha]. The alias separator is the first colon, the sha suffix the last, and fragments cannot contain colons, so the two never collide: the parser proves which is which.

export function splitShaSuffix(part: string): { ref: string; sha?: string } {
	const { bare, sha } = parseRefWithSha(part);
	return sha !== undefined ? { ref: bare, sha } : { ref: bare };
}