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

Proposed by Scott Moser
Status: Merged
Approved by: Chad Smith
Approved revision: 6eb4dc24fe314ce5c98b05b21988402cda95afce
Merged at revision: 6eb4dc24fe314ce5c98b05b21988402cda95afce
Proposed branch: ~smoser/cloud-init:fix/git-describe-specific-abbrev
Merge into: cloud-init:master
Diff against target: 25 lines (+2/-2)
2 files modified
tools/make-tarball (+1/-1)
tools/read-version (+1/-1)
Reviewer Review Type Date Requested Status
Chad Smith Approve
Ryan Harper Approve
Review via email: mp+331883@code.launchpad.net

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.

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

+1

Ran into this on my Xenial setup when preparing an upload to arful. This fixes this.

review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/make-tarball b/tools/make-tarball
2index 91c4562..3197689 100755
3--- a/tools/make-tarball
4+++ b/tools/make-tarball
5@@ -35,7 +35,7 @@ while [ $# -ne 0 ]; do
6 done
7
8 rev=${1:-HEAD}
9-version=$(git describe "--match=[0-9]*" ${long_opt} $rev)
10+version=$(git describe --abbrev=8 "--match=[0-9]*" ${long_opt} $rev)
11
12 archive_base="cloud-init-$version"
13 if [ -z "$output" ]; then
14diff --git a/tools/read-version b/tools/read-version
15index ddb2838..d9ed30d 100755
16--- a/tools/read-version
17+++ b/tools/read-version
18@@ -56,7 +56,7 @@ if os.path.isdir(os.path.join(_tdir, ".git")) and which("git"):
19 flags = []
20 if use_tags:
21 flags = ['--tags']
22- cmd = ['git', 'describe', '--match=[0-9]*'] + flags
23+ cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
24
25 version = tiny_p(cmd).strip()
26

Subscribers

People subscribed via source and target branches