简体   繁体   中英

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 :

  • first stage all changes in Smalltalk system, then
  • stage all external files and
  • commit all changes at once

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM