<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Would it be possible to track the revision number in an automated way even in a git repo?  So store the r number, and automatically increment on commits.  Not sure if that's an option, but it seems like it might address the problem.</div></div></div></blockquote><div><br></div><div>In git you wouldn't need such thing, the way would be to track the forking point comparing the user history with the upstream master history, and describing the path. The oneliner I sent before (which I now realize I split in two), did (or will do) the following.</div><div><br></div><div>1) Go back in history and find the latest tag, save it as $tag</div><div>2) Find the forking point between upstream and user branch if any, save current commit if not such fork exists as $parent.</div><div>3) count how many commits are from $tag commit to $parent commit, save it as $parent_n</div><div>3) If fork exists, count how many commits from $parent to HEAD, save it as $commit_n</div><div>4) If tree is dirty, save $dirty='-dirty', else $dirty=''</div><div><br></div><div>compose the build version info as the following:</div><div><br></div><div>$tag-$parent_n-$parent-$commit_n-$parent$dirty</div></div></div>