build/gen.py: Make LAST_COMMIT_POSITION reproducible

Abbreviated hashes can vary in length depending on the number of objects
in the Git repository. This frequently breaks reproducibility for distro
packages. Address this by adding --abbrev=12 to the 'git describe' call.

Change-Id: I2fff11ff5a8e54e437a2186ea1f7c0ec17924437
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/14260
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
diff --git a/AUTHORS b/AUTHORS
index 45cedd7..5e1e5e6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,6 +26,7 @@
 Andrew Boyarshin <andrew.boyarshin@gmail.com>
 Anuj Kumar Sharma <anujk.sharma@samsung.com>
 DanCraft99 <simputest@gmail.com>
+Evangelos Foutras <evangelos@foutrelis.com>
 Gergely Nagy <ngg@ngg.hu>
 Ilia K <ki.stfu@gmail.com>
 Ivan Naydonov <samogot@gmail.com>
diff --git a/build/gen.py b/build/gen.py
index fe56186..f877cc2 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -218,8 +218,8 @@
 def GenerateLastCommitPosition(host, header):
   ROOT_TAG = 'initial-commit'
   describe_output = subprocess.check_output(
-      ['git', 'describe', 'HEAD', '--match', ROOT_TAG], shell=host.is_windows(),
-      cwd=REPO_ROOT)
+      ['git', 'describe', 'HEAD', '--abbrev=12', '--match', ROOT_TAG],
+      shell=host.is_windows(), cwd=REPO_ROOT)
   mo = re.match(ROOT_TAG + '-(\d+)-g([0-9a-f]+)', describe_output.decode())
   if not mo:
     raise ValueError(