@@ -189,24 +189,25 @@ verifyMigration obDir = do
189 getMigrationGraph @Text obDir MigrationGraph_ObeliskUpgrade
189 getMigrationGraph @Text obDir MigrationGraph_ObeliskUpgrade
190 withSpinner "Checking graph integrity" $
190 withSpinner "Checking graph integrity" $
191 ensureGraphIntegrity upgradeGraph
191 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
202− liftIO (doesDirectoryExist $ obDir </> ".git") >>= \case
192+ headVertex <- liftIO (doesDirectoryExist $ obDir </> ".git") >>= \case
204 withSpinner "Checking existence of HEAD vertex" $
194 withSpinner "Checking existence of HEAD vertex" $
205− void $ getHeadVertex obDir
195+ getHeadVertex obDir
206 False -> do
196 False -> do
207 hash <- computeVertexHash obDir
197 hash <- computeVertexHash obDir
208 unless (hasVertex hash upgradeGraph) $
198 unless (hasVertex hash upgradeGraph) $
209 failWith $ "No vertex found for obelisk hash " <> hash
199 failWith $ "No vertex found for obelisk hash " <> 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 <> ")"
211-- | Create an edge from HEAD vertex to the hash corresponding to the Git
212-- | Create an edge from HEAD vertex to the hash corresponding to the Git
212-- working copy. The HEAD vertex must already exist.
213-- working copy. The HEAD vertex must already exist.