Closed mikkoi closed 2 years ago
Hi Mikko. These warnings are really annoying. I noticed that they are produced in other places in the code.
Fortunately, there is a simpler and more general solution to all of them, which I implemented in commit 416f2ed6a.
What do you think?
It's better solution than mine because now we only need to run git
once.
In my solution, in most circumstances, git
needs to be run twice.
When executing
git rev-parse --verify HEAD
in a repo which has no commits, it prints error to STDERR:This happens in method
Git::Repository::Plugin::GitHooks::get_head_or_empty_tree()
.We can avoid this error by first checking if there is commits in the repo. The method
Git::Repository::Plugin::GitHooks::has_any_commits()
does this.Signed-off-by: Mikko Johannes Koivunalho mikko.koivunalho@iki.fi