iceberg icon indicating copy to clipboard operation
iceberg copied to clipboard

Commits through Iceberg unstage changes to ‘README.md’ and other files

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

Scenario:

  • In a Pharo 10 image, load PTerm:
    Metacello new
      repository: 'github://lxsang/PTerm';
      baseline: 'PTerm';
      load
    
  • Using a Terminal window, add a line to ‘README.md’ and add this to the index: 1
  • In a System Browser window, add a method to the class PTerm:
    printString
      ^ super printString
    
  • Commit the changes to the PTerm repository through Iceberg
  • Using another Terminal window, check git status again: 2

The change to ‘README.md’ has been unstaged rather than included in the commit.

I used Pharo 10 here because PTerm doesn’t work in Pharo 11 yet, but the issue applies to Pharo 11 as well.

Rinzwind avatar Mar 24 '23 00:03 Rinzwind

This can be easily fixed by making IceLibgitRepository>>#addFilesToIndex: send #refresh to gitIndex before the send of #addAll:, with LGitIndex>>#refresh implemented as:

refresh

	self withReturnHandlerDo: [ 
		self
			index_read: self
			force: false ]

Then the commit done through Iceberg will include the change to ‘README.md’. It would be nice if the change would also appear in the diff that’s shown before committing. A similar request was made in another issue: https://github.com/pharo-vcs/iceberg/issues/805.

Rinzwind avatar Mar 24 '23 00:03 Rinzwind