convert srcref to a sha
This fixes pushing a new ref that is the same as something already pushed. In findotherprereq, it compares two shas, which didn't work when one is actually not a sha but a ref. This is one of those cases where Sha being an alias for Ref makes it hard to catch mistakes. One of these days those need to be differentiated at the type level, but not today..
This commit is contained in:
parent
96c66a7ca9
commit
6ccd09298b
2 changed files with 10 additions and 11 deletions
|
@ -238,14 +238,16 @@ push st rmt ls = do
|
|||
, trackingrefs
|
||||
)
|
||||
in calc rs =<< case srcRef r of
|
||||
Just srcref
|
||||
| forcedPush r -> okresp $
|
||||
M.insert tr srcref trackingrefs
|
||||
| otherwise -> ifM (isfastforward srcref tr)
|
||||
( okresp $
|
||||
M.insert tr srcref trackingrefs
|
||||
, errresp "non-fast-forward"
|
||||
)
|
||||
Just srcref -> inRepo (Git.Ref.sha srcref) >>= \case
|
||||
Just sha
|
||||
| forcedPush r -> okresp $
|
||||
M.insert tr sha trackingrefs
|
||||
| otherwise -> ifM (isfastforward sha tr)
|
||||
( okresp $
|
||||
M.insert tr sha trackingrefs
|
||||
, errresp "non-fast-forward"
|
||||
)
|
||||
Nothing -> errresp "unknown ref"
|
||||
Nothing -> okresp $ M.delete tr trackingrefs
|
||||
|
||||
-- Check if the push is a fast-forward that will not overwrite work
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue