iceberg icon indicating copy to clipboard operation
iceberg copied to clipboard

Changing the capitalization of a class name doesn’t change the name of the filetree directory in the commit

Open Rinzwind opened this issue 2 years ago • 2 comments
trafficstars

Scenario:

  • In Iceberg, add a new repository by cloning https://github.com/SeasideSt/Grease
  • Load the package ‘Grease-Core’
  • Rename the class GRInvalidUtf8Error to GRInvalidUTF8Error
  • Commit

In the commit, the name of the directory for the class is still ‘GRInvalidUtf8Error.class’ rather than ‘GRInvalidUTF8Error.class’, the following returns #('GRInvalidUtf8Error.class'):

(((IceRepository repositoryNamed: 'Grease') head commit
	entryByPath: 'repository/Grease-Core.package') entries collect: #name)
		select: [ :entryName | entryName includesSubstring: 'InvalidU' ]

Versions used:

  • Pharo-11.0.0+build.648.sha.a5c134f16fc5b88154ec9fe43c20b8dbf12295e3
  • VM v9.0.18 - Commit: 7249c170 - Date: 2022-09-02 14:31:12 +0200
  • macOS 12.6.3

Issue with a similar scenario (rename of MicroDownParser to MicrodownParser): https://github.com/pharo-vcs/iceberg/issues/1500.

Rinzwind avatar Mar 23 '23 22:03 Rinzwind

When I repeat the scenario in a new image after first applying the following changes, then the name of the directory in the commit is ‘GRInvalidUTF8Error.class’ as expected.

On IceGitIndex:

addToGitIndex

	repository removeFilesFromIndex: modifiedFilePaths.
	repository addFilesToIndex: modifiedFilePaths.

On IceLibgitRepository:

removeFilesFromIndex: aCollection

	self handleLibgitError: [
		| gitIndex |
		gitIndex := self repositoryHandle index.
		gitIndex
			removeAll:
				(aCollection
					collect: [ :each | 
						self assert: each asFileReference isRelative.
						each asFileReference path pathString ]
					as: Array).
		gitIndex
			writeToDisk;
			free ]

On LGitIndex:

removeAll: pathSpecs

	| pathspec |
	pathspec := LGitStringArray withAll: pathSpecs.
	self withReturnHandlerDo: [ 
		self
			index_remove_all: self
			pathspec: pathspec
			callback: (LGitIndexMatchedPathCallback on: [ :a :b :c | 0 ])
			payload: ExternalAddress null ]

Rinzwind avatar Mar 23 '23 22:03 Rinzwind

I posted a related issue with libgit2: https://github.com/libgit2/libgit2/issues/6537.

Rinzwind avatar Mar 23 '23 22:03 Rinzwind