How can I use "git describe --match" sensibly in combination with a shallow clone? -


i using git describe driver versioning in application @ build time. looks like: git describe --always --dirty --match version*

i tag versions pattern version.1.2.3 , build figures out version of application based off last commit tagged version.* was. if haven't tagged given commit, version number ends version.1.14.3-24-ged66bf5, based of recent tag, how many commits since tag , git commit id.

this works me personally, i'm having problem doing builds off of shallow clone on ci server.

when using "shallow clone" option on git build in jenkins (i'm guessing it's doing "--depth=1"), "git describe" command no longer doing want do. version number ends being commit id - guess because there no tagged versions in shallow clone, --always parameter describe command ends spitting out commit id.

i can deal moment not doing shallow clone.

but driving versioning off of git describe - how can keep using shallow clones? think need able specify @ time of shallow clone, want depth "from tip of branch latest version has tag matching version.*".

is thing can git?

you can't: shallow clone missing tag objects , commits tag.

more precisely, depends on depth of clone , how far 1 must go in history find appropriate tags. making shallow clone --depth 1000 might suffice, instance. precise number depends on how many commits have between1 tags care about.

you correct if git provided "deepen until tagged", trick, git doesn't, , worse, deepening shallow clone not automatically bring on tags.

(it possible write script uses git ls-remote , git fetch --depth keep deepening clone until tagged commit(s) appear, have script apply tags manually, were. take few dozen lines of python or shell code, instance, depending on how robust wanted it. it's not included git itself.)


1the notion of "between" bit iffy in non-linear graph, general idea should clear enough here, think.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -