Dmitry Ponyatov
Dmitry Ponyatov

Reputation: 346

Pharo gitFileTree: how to block commit (stage only)

How can I config gitFileTree/Monticello don't commit on project save ?

I have some out-of-tree files in local git repo (autogenerated sources) and I want to do commit manually:

Upvotes: 1

Views: 70

Answers (2)

codefrau
codefrau

Reputation: 4623

You could simply add a filetree repository which will just store the package to disk and not do any git versioning. Then you commit that manually. This actually used to be the workflow before GitFileTree.

Upvotes: 1

Peter Uhnak
Peter Uhnak

Reputation: 10217

Say you want to "export" package called Somewhere to GitFileTree repository called breaking-mcz.

"get the package"
package := 'Somewhere' asPackage.

"find the repo"
repo := MCRepositoryGroup default repositories detect: [ :each | (each isKindOf: MCFileTreeGitRepository) and: [ each location includesSubstring: 'breaking-mcz' ] ].

"working copy is the current in-image state"
workingCopy := package mcWorkingCopy.

"this will create an in-memory only version; the message doesn't matter"
pseudoVersion := workingCopy newVersionWithMessage: 'Message will not be used' in: repo.

"this will file-out the current state to disk, and `git add` it to git index (no commit)"
repo internalStoreVersion: pseudoVersion.

Note 1: keep in mind that the way GitFileTree works is that it clears the old code on the disk and dumps everything again, so if you already have some uncommitted modifications in the code (on the disk), you should git stash them first.

Note 2: I am assuming you are using metadata-less GitFileTree (which has been the default for a year or so), otherwise I am not sure what would happen to history/ancestry

Note 3: This is not a typical use case, so there's no GUI for this, but we could consider in Iceberg at some point

Upvotes: 1

Related Questions