Jim Meyering <[EMAIL PROTECTED]> wrote: > "Dmitry V. Levin" <[EMAIL PROTECTED]> wrote: >> On Thu, Aug 30, 2007 at 05:50:31PM +0200, Jim Meyering wrote: >>> For example, now when I run "make dist", rather than getting the always >>> identically-named coreutils-6.9+.tar.gz, I get tarballs with more >>> meaningful names: >>> >>> coreutils-6.9.220.gdd469.tar.gz >>> coreutils-6.9.223.g624d1.tar.gz >>> >>> Similarly, --version output reflects the snapshot: >>> >>> $ src/cat --version| head -1 >>> cat (GNU coreutils) 6.9.223.g624d1 >> >> Since "g" is common prefix produced by git describe, maybe it could be >> omitted? Also, maybe 4 hexdigits is enough to distinguish snapshots? >> E.g. 6.9.223.624d instead of 6.9.223.g624d1. > > Removing the "g" sounds good -- one byte shorter. > Though it seems silly to have to manually truncate to length 4 the > string I already requested be truncated to 4 with > "git-describe --abbrev=4 HEAD". I wondered if that was somehow > deliberate, or a bug but haven't investigated.
git does that deliberately, to make the string _globally_ unambiguous. Since coreutils has over 24K change sets, it's not surprising that it'd need a longer prefix some of the time: $ for i in $(seq 20); do git-describe --abbrev=4 HEAD~$i; done COREUTILS-6_9-222-gbfe49 COREUTILS-6_9-221-g8138 COREUTILS-6_9-220-g4b11f2 COREUTILS-6_9-219-g58ddd COREUTILS-6_9-218-g357554 COREUTILS-6_9-217-gadfc COREUTILS-6_9-216-gd6d5 COREUTILS-6_9-215-gc370a COREUTILS-6_9-214-gcbdbb COREUTILS-6_9-213-g505eee COREUTILS-6_9-212-gddb02 COREUTILS-6_9-211-ga2f76 COREUTILS-6_9-210-geea7d8 COREUTILS-6_9-209-g6e3e8 COREUTILS-6_9-208-gec06 COREUTILS-6_9-207-gee8470 COREUTILS-6_9-206-gd7165 COREUTILS-6_9-205-g8f3cb COREUTILS-6_9-204-gbcc1 COREUTILS-6_9-203-g0ea19 I think it's worthwhile to keep this "feature". The "g" is now gone: * build-aux/git-version-gen: Remove git-describe's "g" that would always precede the abbreviated SHA1. Suggestion from Dmitry V. Levin. diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index 4a63111..0fe5f36 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -38,7 +38,8 @@ elif test -d .git \ *) (exit 1) ;; esac then - v=`echo "$v" | sed 's/-/./g'`; + # Remove the "g" in git-describe's output string; change each - to a '.' + v=`echo "$v" | sed 's/\(.*\)-g/\1-/;s/-/./g'`; else v=$default_version fi