Jonathan Nieder <jrnieder@xxxxxxxxx> writes: >> We need to be careful, though, to report when the current commit cannot be >> determined, e.g. when building from a tarball without any associated Git >> repository. > > This means that on Debian, it would always print > > built from commit: (unknown) > > Maybe I shouldn't care, but I wonder if there's a way to improve on > that. E.g. should there be a makefile knob to allow Debian to specify > what to put there? Another "interesting" possibility is to build from a tarball extracted into a directory hierarchy that is controlled by an unrelated Git repository. E.g. "my $HOME is under $HOME/.git repository, and then I have a tarball extract in $HOME/src/git". We shouldn't embed the HEAD commit of that $HOME directory project in the resulting executable in such a case. We should be able to do this by being a bit more careful than the presented patch. Make sure that the toplevel is at the same directory as we assumed to be (i.e. where we found that Makefile) and trust rev-parse output only when that is the case, or something like that.