-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git: ensure that pin matches checked-out commit
Previously, it was very possible for the CacheKey function to return a sha key that was *not* the checked out commit. There are two cases that I've encountered where this can happen: - An annotated tag will have the pin of the tag, and not the underlying commit, which will be HEAD after the checkout. - If multiple tags have the same path component (e.g. "mytag" and "abc/mytag") then the first alphabetical tag will be selected when (in this case "abc/mytag"). To avoid this kind of case, we can't just search for a single match in the results for ls-remote. There's no way to filter for just an exact match, so we need to scan through the output ourselves. Additionally, we need to dereference the annotated tags by also selecting refs ending in "^{}" - which have the commit that the tag points at. Finally, I've improved the test suite around this to check that: - The cache-key pin is equivalent to the checked out commit - We can check out non-master branches - That full ref syntax like "refs/heads/<branch-name>" and "refs/tags/<tag-name>" can be used. Signed-off-by: Justin Chadwell <me@jedevc.com>
- Loading branch information
Showing
2 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters