nimble icon indicating copy to clipboard operation
nimble copied to clipboard

Nimble commands fail after `git init`

Open narimiran opened this issue 1 year ago • 0 comments

I've tried to run nimble lock on a directory which wasn't under version control, and I got this message:

    Error:  Sync file require current working directory to be under some supported type of version control.
     Hint:  Put package's working directory under version control.

(and this still created nimble.lock file, btw)


After that, I've run git init, and now nimble lock produces:

$ nimble lock
       Tip: 2 messages have been suppressed, use --verbose to show them.
tools.nim(62)            tryDoCmdEx

    Error:  Execution of 'git -C /home/miran/code/nim-lang/tests/myPackage rev-parse HEAD' failed with an exit code 128.
        ... Details: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
        ... Use '--' to separate paths from revisions, like this:
        ... 'git <command> [<revision>...] -- [<file>...]'
        ... HEAD

The same error appears on some other commands (e.g. nimble check, nimble test, or non-existing commands such as nimble foobar), but not on others (e.g. nimble tasks or nimble list -i).


The issue is resolved after one makes a first commit. But then the original hint ("Put package's working directory under version control.") should be changed to reflect that just initializing git isn't enough.

narimiran avatar Jan 29 '24 15:01 narimiran