Running lein install on a Leiningen project that has an initialised git repository with zero commits fails with an error like
/MY-PROJECT/.git/refs/heads/master (No such file or directory)
I can't reproduce this error. I created a noir project using lein new noir simpleapp. I didn't make a single commit. I can successfully run the lein install command. Can you provide a slimmed down version of your application that shows the issue?
lein new noir simpleapp
Did you try staging something?
Lein retrieves current HEAD commit to add it to the SCM information in pom.xml. The edge case with HEAD not resolving because there are no commits is probably not handled.
I can reproduce:
λ /tmp/ lein new superlib
Generating a project called superlib based on the 'default' template.
To see other templates (app, lein plugin, etc), try `lein help new`.
λ /tmp/ cd superlib
λ /tmp/superlib/ git init
Initialized empty Git repository in /private/tmp/superlib/.git/
λ /tmp/superlib/ master* git add src/
λ /tmp/superlib/ master* lein install
/private/tmp/superlib/.git/refs/heads/master (No such file or directory)
Here's what Leiningen does:
"Reads the value of HEAD and returns a commit SHA1."
(let [head (.trim (slurp (str (io/file git-dir "HEAD"))))]
(if-let [ref-path (second (re-find #"ref: (\S+)" head))]
(read-git-ref git-dir ref-path)
(defn- make-git-scm [git-dir]
(let [origin (read-git-origin git-dir)
head (read-git-head git-dir)
urls (github-urls origin)]
(and (:public-clone urls)
[:connection (str "scm:git:" (:public-clone urls))])
(and (:dev-clone urls)
[:developerConnection (str "scm:git:" (:dev-clone urls))])
[:url (:browse urls)]])
(catch java.io.FileNotFoundException _)))
Not sure what a proper fix should look like. Checking if tag is nil and not including the information?
This is fixed in 80cf398