upgrade: Support an edge case upgrading a v5 direct mode repo where nothing had ever been committed to the head branch
This commit was sponsored by Jack Hill on Patreon.
This commit is contained in:
parent
14155bcebe
commit
88cef18fac
4 changed files with 29 additions and 12 deletions
|
@ -26,6 +26,7 @@ module Annex.AdjustedBranch (
|
|||
adjustBranch,
|
||||
adjustTree,
|
||||
adjustToCrippledFileSystem,
|
||||
commitForAdjustedBranch,
|
||||
propigateAdjustedCommits,
|
||||
propigateAdjustedCommits',
|
||||
commitAdjustedTree,
|
||||
|
@ -334,14 +335,8 @@ adjustToCrippledFileSystem :: Annex ()
|
|||
adjustToCrippledFileSystem = do
|
||||
warning "Entering an adjusted branch where files are unlocked as this filesystem does not support locked files."
|
||||
checkVersionSupported
|
||||
whenM (isNothing <$> inRepo Git.Branch.current) $ do
|
||||
cmode <- annexCommitMode <$> Annex.getGitConfig
|
||||
void $ inRepo $ Git.Branch.commitCommand cmode
|
||||
[ Param "--quiet"
|
||||
, Param "--allow-empty"
|
||||
, Param "-m"
|
||||
, Param "commit before entering adjusted unlocked branch"
|
||||
]
|
||||
whenM (isNothing <$> inRepo Git.Branch.current) $
|
||||
commitForAdjustedBranch []
|
||||
inRepo Git.Branch.current >>= \case
|
||||
Just currbranch -> case getAdjustment currbranch of
|
||||
Just curradj | curradj == adj -> return ()
|
||||
|
@ -358,6 +353,22 @@ adjustToCrippledFileSystem = do
|
|||
adj = LinkAdjustment UnlockAdjustment
|
||||
failedenter = warning "Failed to enter adjusted branch!"
|
||||
|
||||
{- Commit before entering adjusted branch. Only needs to be done
|
||||
- when the current branch does not have any commits yet.
|
||||
-
|
||||
- If something is already staged, it will be committed, but otherwise
|
||||
- an empty commit will be made.
|
||||
-}
|
||||
commitForAdjustedBranch :: [CommandParam] -> Annex ()
|
||||
commitForAdjustedBranch ps = do
|
||||
cmode <- annexCommitMode <$> Annex.getGitConfig
|
||||
void $ inRepo $ Git.Branch.commitCommand cmode $
|
||||
[ Param "--quiet"
|
||||
, Param "--allow-empty"
|
||||
, Param "-m"
|
||||
, Param "commit before entering adjusted branch"
|
||||
] ++ ps
|
||||
|
||||
setBasisBranch :: BasisBranch -> Ref -> Annex ()
|
||||
setBasisBranch (BasisBranch basis) new =
|
||||
inRepo $ Git.Branch.update' basis new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue