question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opt out of git commit from SpmDependencyManager?

See original GitHub issue

Hi team, would it make sense to make the git commit something I can opt out with SpmDependencyManager?

I’d like to manage my own workflow for adding changes, committing and pushing and I’m not sure how else to work around these lines https://github.com/touchlab/KMMBridge/blob/7acb53bcdfbc0fc8790378b07259580ab96f4f1b/kmmbridge/src/main/kotlin/dependencymanager/SpmDependencyManager.kt#L52-L54

Thank you!

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
gobetticommented, Oct 27, 2022

yeah, there are a bunch of reasons, personally I’d put “separation of responsibilities” more broadly as the first one. On a first thought, I wouldn’t expect this library to do more than the 3 things I mentioned (build xcframework, upload and edit Package.swift). It’s nice that it goes beyond that, but those would ideally be opt-in imho. Making them opt-out works too, but to my initial point, I wouldn’t expect to have to look into how to disable things I didn’t expect this tool would do for me.

Now, being more specific, referencing this block again: https://github.com/touchlab/KMMBridge/blob/7acb53bcdfbc0fc8790378b07259580ab96f4f1b/kmmbridge/src/main/kotlin/dependencymanager/SpmDependencyManager.kt#L52-L54

  1. it stages all files. I may not want that if my workflow for whatever reason makes other changes. This could be fixed by adding just Package.swift, but then it’s just the other side of the coin where my workflow might intentionally change other files that should be part of a release and this is now left out, or 2 commits have to be made for each release.
  2. it uses a specific commit message that may not be the best especially with existing projects that already have a standard for their releases. This could be fixed by introducing a configurable parameter.
  3. there are other implicit assumptions here, e.g. that I’m already in the branch that I want to commit to, that this branch has an upstream branch, that my git user name and email are set as needed, etc. These are very simple git commands that I may want to control myself so that I have all sorts of customizations available.
  4. there may be additional steps I want to run after kmmBridgePublish that should fail the entire build and not push/tag anything, but given that always happens from inside the task, either the task would have to fit a particular position in my workflow (which may not always be possible) or require workarounds that have to carry on knowledge on how kmmBridgePublish works internally regarding the git commands. So it’d seem a generally cleaner solution if I could skip the whole git manipulation and control it myself, explicitly without assumed external knowledge.

I think that’s about it for SpmDependencyManager specifically. I had similar issues with the available VersionManagers, but that was super easy to fix given I was able to implement the interface myself and customize the way I want in a couple of lines. In short, I didn’t want the version manager to be responsible for inferring my next release version and pushing a tag.

Thanks @russhwolf !

0reactions
russhwolfcommented, Dec 13, 2022

We don’t have it well documented yet, but you can now do spm(commitManually = true) to suppress the git operations for SPM publishing. You’re then responsible for commiting package file updates and tagging the release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git-commit Documentation - Git
git -commit - Record changes to the repository ... The content to be committed can be specified in several ways: by using git-add[1]...
Read more >
Explicitly opt-in instead of opt-out #468 - typicode/husky - GitHub
I expect a Git commit to take in the order of 10s of milliseconds (maybe ... There should be a way to set...
Read more >
How (and why!) to keep your Git commit history clean - GitLab
Command breakdown: Here, we're asking the git commit command to amend whatever changes are present in stage to the most recent commit.
Read more >
git commit --amend -F option help
We are using git commit -F option to commit in git. when we use git commit --amend option with -F it is ......
Read more >
Highlights from Git 2.24 | The GitHub Blog
Now in Git 2.24, commit graphs are enabled by default, meaning that your repository will see an improvement the next time you run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found