← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:fix/git-describe-specific-abbrev into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:fix/git-describe-specific-abbrev into cloud-init:master.

Commit message:
tools: Give specific --abbrev=8 to "git describe"

The tools that use "git describe" were just assuming a consisent
number of characters in the hash. It seems ubuntu 16.04 would use 7
and later versions use 8. To avoid that discrepency in developer
environments, set it to 8.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/331883
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:fix/git-describe-specific-abbrev into cloud-init:master.
diff --git a/tools/make-tarball b/tools/make-tarball
index 91c4562..3197689 100755
--- a/tools/make-tarball
+++ b/tools/make-tarball
@@ -35,7 +35,7 @@ while [ $# -ne 0 ]; do
 done
 
 rev=${1:-HEAD}
-version=$(git describe "--match=[0-9]*" ${long_opt} $rev)
+version=$(git describe --abbrev=8 "--match=[0-9]*" ${long_opt} $rev)
 
 archive_base="cloud-init-$version"
 if [ -z "$output" ]; then
diff --git a/tools/read-version b/tools/read-version
index ddb2838..d9ed30d 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -56,7 +56,7 @@ if os.path.isdir(os.path.join(_tdir, ".git")) and which("git"):
     flags = []
     if use_tags:
         flags = ['--tags']
-    cmd = ['git', 'describe', '--match=[0-9]*'] + flags
+    cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
 
     version = tiny_p(cmd).strip()
 

References