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
|
||||
|
|
|
@ -10,9 +10,6 @@ will be available to users who don't use datalad.
|
|||
|
||||
This is implememented and working. Remaining todo list for it:
|
||||
|
||||
* Pushing a branch that has the same sha as another branch that has already
|
||||
been pushed fails with "Refusing to create empty bundle".
|
||||
|
||||
* Cloning from an annex:: url with importtree=yes doesn't work
|
||||
(with or without exporttree=yes). This is because the ContentIdentifier
|
||||
db is not populated. It should be possible to work around this.
|
||||
|
|
Loading…
Add table
Reference in a new issue