git-commit-id / git-commit-id-maven-plugin

Maven plugin which includes build-time git repository information into an POJO / *.properties). Make your apps tell you which version exactly they were built from! Priceless in large distributed deployments... :-)
http://www.kto.so
GNU Lesser General Public License v3.0
1.62k stars 299 forks source link

Question: what min subset of .git folder is enough for this pllugin? #637

Closed paulvi closed 1 year ago

paulvi commented 1 year ago

Describe the question / problem (required)

We are building Java maven project inside docker. So there are line in 'Dockerfile'

COPY src src
# for git-commit-id-maven-plugin
COPY .git .git

As some git repositories have large history, I wonder is it possible to copy some part of .git that would be enough for this plugin work.

Context (optional)

Most projects are Spring Boot 2.x microservices.

TheSnoozer commented 1 year ago

This highly depends what you ask the plugin. In general you'd need a valid git repository. I don't know the inner working of a git repository and thus do not know what files are the "minimum" requirement.

Again depending on your use-case you might get away with a shallow-clone (git clone --depth 1 ...) to get the information you want.