unannex: Refuse to unannex when repo is too new to have a HEAD
In this case there must be staged changes in the index (if there is anything to unannex), and the unannex code path needs to run with a clean index.
This commit is contained in:
parent
80aa7e3571
commit
8a3e2b302a
4 changed files with 45 additions and 5 deletions
|
@ -53,11 +53,14 @@ wrapUnannex a = ifM isDirect
|
|||
, Param "--no-verify"
|
||||
, Param "-m", Param "content removed from git annex"
|
||||
]
|
||||
cleanindex = do
|
||||
(diff, cleanup) <- inRepo $ DiffTree.diffIndex Git.Ref.headRef
|
||||
if null diff
|
||||
then void (liftIO cleanup) >> return True
|
||||
else void (liftIO cleanup) >> return False
|
||||
cleanindex = ifM (inRepo Git.Ref.headExists)
|
||||
( do
|
||||
(diff, cleanup) <- inRepo $ DiffTree.diffIndex Git.Ref.headRef
|
||||
if null diff
|
||||
then void (liftIO cleanup) >> return True
|
||||
else void (liftIO cleanup) >> return False
|
||||
, return False
|
||||
)
|
||||
|
||||
start :: FilePath -> Key -> CommandStart
|
||||
start file key = stopUnless (inAnnex key) $ do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue