Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: git_number.py

Issue 222103006: git-number cannot commit-tree without user config (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: use -c instead of environment variables Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_number.py
diff --git a/git_number.py b/git_number.py
index 6c11cee23433332d2ddd748570efa6d2bec8badc..7fa0398af775abfafa33caa1e803ffe508fcbf23 100755
--- a/git_number.py
+++ b/git_number.py
@@ -37,6 +37,8 @@ CHUNK_FMT = '!20sL'
CHUNK_SIZE = struct.calcsize(CHUNK_FMT)
DIRTY_TREES = collections.defaultdict(int)
REF = 'refs/number/commits'
+AUTHOR_NAME = 'git-number'
+AUTHOR_EMAIL = 'chrome-infrastructure-team@google.com'
# Number of bytes to use for the prefix on our internal number structure.
# 0 is slow to deserialize. 2 creates way too much bookeeping overhead (would
@@ -153,7 +155,14 @@ def finalize(targets):
assert updater.returncode == 0
tree_id = git.run('write-tree', env=env)
- commit_cmd = ['commit-tree', '-m', msg, '-p'] + git.hash_multi(REF)
+ commit_cmd = [
+ # Git user.name and/or user.email may not be configured, so specifying
+ # them explicitly. They are not used, but requried by Git.
+ '-c', 'user.name=%s' % AUTHOR_NAME,
+ '-c', 'user.email=%s' % AUTHOR_EMAIL,
+ 'commit-tree',
+ '-m', msg,
+ '-p'] + git.hash_multi(REF)
for t in targets:
commit_cmd.extend(['-p', binascii.hexlify(t)])
commit_cmd.append(tree_id)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698