babashka / neil

A CLI to add common aliases and features to deps.edn-based projects
MIT License
367 stars 27 forks source link

Fix unexpected "Requires clean working directory" error in `neil version` commands #144

Closed rads closed 1 year ago

rads commented 1 year ago

If the :deps-file path isn't resolved to the absolute path in git-opts, the following error happens even with a clean working directory:

$ neil --version
neil 0.1.48

$ neil version patch
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Requires clean working directory unless --force is provided
Data:     {}

This wasn't caught by the tests since we pass in a different :deps-file which has the absolute path.

This PR fixes the problem by calling fs/canonicalize on the :deps-file path before passing it down to the helper functions.

borkdude commented 1 year ago

Could you also update the changelog? I really need to put a PR template in here as a reminder, I'll do that tomorrow

rads commented 1 year ago

@borkdude: It's already in the PR template, but don't worry, I won't forget next time. 😄