@@ -189,24 +189,25 @@ verifyMigration obDir = do
189189 getMigrationGraph @Text obDir MigrationGraph_ObeliskUpgrade
190190 withSpinner "Checking graph integrity" $
191191 ensureGraphIntegrity upgradeGraph
192− withSpinner "Checking graph is linear" $
193− -- We don't support merge commits (i.e., diamonds in a graph) yet.
194− -- Until we do, ensure that the graph is a linear list.
195− try (ensureGraphLinearity upgradeGraph) >>= \case
196− Left (NonLinearGraph_MultipleAdjacents vertex) ->
197− failWith $ "Graph is not linear; branches at vertex: " <> tshow vertex
198− Left (NonLinearGraph_NotConnected isolatedVertices) ->
199− failWith $ "Graph is partly linear, but with isolated vertices: " <> tshow isolatedVertices
200− Right () ->
201− pure ()
202− liftIO (doesDirectoryExist $ obDir </> ".git") >>= \case
192+ headVertex <- liftIO (doesDirectoryExist $ obDir </> ".git") >>= \case
203193 True ->
204194 withSpinner "Checking existence of HEAD vertex" $
205− void $ getHeadVertex obDir
195+ getHeadVertex obDir
206196 False -> do
207197 hash <- computeVertexHash obDir
208198 unless (hasVertex hash upgradeGraph) $
209199 failWith $ "No vertex found for obelisk hash " <> hash
200+ pure hash
201+ withSpinner "Checking graph linearity" $
202+ -- NOTE: We don't support merge commits (i.e., diamonds in a graph) yet.
203+ -- Until we do, ensure that the graph is a fully connected linear list.
204+ try (ensureGraphLinearity upgradeGraph) >>= \case
205+ Left (NonLinearGraph_MultipleAdjacents vertex) ->
206+ failWith $ "Graph is not linear; branches at vertex: " <> tshow vertex
207+ Left (NonLinearGraph_NotConnected isolatedVertices) ->
208+ failWith $ "Graph is partly linear, with isolated vertices: " <> tshow isolatedVertices
209+ Right lastVertex -> unless (lastVertex == headVertex) $
210+ failWith $ "Graph is linear, but its last vertex (" <> lastVertex <> ") is different from head vertex (" <> headVertex <> ")"
210211
211212-- | Create an edge from HEAD vertex to the hash corresponding to the Git
212213-- working copy. The HEAD vertex must already exist.