aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-08 09:49:33 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-08 09:53:12 +0200
commit58b2ef265847d005300df4b6e908734bae1a7cb4 (patch)
treeebf2d518c18ff0409ff72e8f59616177d69f1029
parent906d9ebba1ae08ea73acb55b536ff2f49e1b55c0 (diff)
allow `commit` to reset for references pointed to by HEAD
-rw-r--r--src/Store/Store.hs4
1 files changed, 3 insertions, 1 deletions
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'}