aboutsummaryrefslogtreecommitdiff
path: root/refs.go
diff options
context:
space:
mode:
Diffstat (limited to 'refs.go')
-rw-r--r--refs.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/refs.go b/refs.go
index 258f06df..59621b40 100644
--- a/refs.go
+++ b/refs.go
@@ -156,6 +156,14 @@ func (repo *Repository) ResolveRef(path string) (Ref, error) {
"HEAD", "ORIG_HEAD", "FETCH_HEAD", "MERGE_HEAD",
"CHERRY_PICK_HEAD", "REVERT_HEAD", "REBASE_HEAD", "BISECT_HEAD",
}, path) {
+ id, err := repo.ParseHash(path)
+ if err == nil {
+ return Ref{
+ Kind: RefKindDetached,
+ Hash: id,
+ }, nil
+ }
+
// For now let's keep this to prevent e.g., random users from
// specifying something crazy like objects/... or ./config.
// There may be other legal pseudo-refs in the future,