Skip to content

Commit

Permalink
Added PureGitFile>>#validateIncrementalHistoryContentsReconstruction …
Browse files Browse the repository at this point in the history
…sanity check
  • Loading branch information
svenvc committed Oct 31, 2024
1 parent 0d66a05 commit bd2af1d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Iceberg-Git-CLI/PureGitFile.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PureGitFile >> children [
^ #()
]

{ #category : #'as yet unclassified' }
{ #category : #accessing }
PureGitFile >> contents [
^ self fileReference contents
]
Expand Down Expand Up @@ -189,3 +189,18 @@ PureGitFile >> unstage [
self repository operations unstage: self path.
self resetStatus
]

{ #category : #private }
PureGitFile >> validateIncrementalHistoryContentsReconstruction [
| commitHistory previousContents |
commitHistory := self logPatchReverse toArray wait.
previousContents := String empty.
commitHistory do: [ :extendedFileCommit |
| newContents expectedContents |
newContents := extendedFileCommit changesToParent applyTo: previousContents.
expectedContents := String streamContents: [ :out |
extendedFileCommit commit contents
linesDo: [ :line | out nextPutAll: line; cr ] ].
self assert: newContents equals: expectedContents.
previousContents := newContents ]
]

0 comments on commit bd2af1d

Please sign in to comment.