From 58b2ef265847d005300df4b6e908734bae1a7cb4 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Sat, 8 Jun 2024 09:49:33 +0200 Subject: allow `commit` to reset for references pointed to by HEAD --- src/Store/Store.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Store/Store.hs b/src/Store/Store.hs index 1f41d8a..d2c8a18 100644 --- a/src/Store/Store.hs +++ b/src/Store/Store.hs @@ -197,7 +197,9 @@ commit = do cid' <- G.commitOid <$> G.createCommit [cid] tid sig sig "auto-commit" (Just ref) - when (ref == "HEAD") $ reset cid' + cidHead <- G.resolveReference "HEAD" + cidRef <- G.resolveReference ref + when (cidRef == cidHead) $ reset cid' pure cid' modify $ \s -> s {cid = cid'} -- cgit v1.2.3