Skip to content

Commit

Permalink
Merge bitcoin#16201: devtools: Always use unabbreviated commit IDs in…
Browse files Browse the repository at this point in the history
… github-merge.py

067fba5 devtools: Always use unabbreviated commit IDs in github-merge.py (Wladimir J. van der Laan)

Pull request description:

  Always put the unabbreviated commit IDs in the generated commit messages and other places. This prevents the developer's `core.abbrev` git setting from leaking through and is better against ambiguity too.

ACKs for commit 067fba:
  MarcoFalke:
    ACK 067fba5 (replaces `h` with `H`, didn't test)
  promag:
    ACK 067fba5, from the documentation https://git-scm.com/docs/pretty-formats:
  fanquake:
    ACK bitcoin@067fba5. Tested by merging this PR into master, then merging a second PR ontop and checking that full commit hashes were being used. Also checked documentation linked to above. Did not check that this works when a different `core.abbrev` is set locally.

Tree-SHA512: a851d10490cd8bcd8bca29094b08a6b9f883cfe1b0767ccda7ca789e4c8eff6260a4d82c33cb3d9bab01dd30ac8c9100cb7adbcb1911bb399d9385c1e1f15ecd
  • Loading branch information
fanquake authored and PastaPastaPasta committed Jul 1, 2021
1 parent bb6bdaa commit c4a9af8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contrib/devtools/github-merge.py
Expand Up @@ -35,11 +35,11 @@
# OS specific configuration for terminal attributes
ATTR_RESET = ''
ATTR_PR = ''
COMMIT_FORMAT = '%h %s (%an)%d'
COMMIT_FORMAT = '%H %s (%an)%d'
if os.name == 'posix': # if posix, assume we can use basic terminal escapes
ATTR_RESET = '\033[0m'
ATTR_PR = '\033[1;36m'
COMMIT_FORMAT = '%C(bold blue)%h%Creset %s %C(cyan)(%an)%Creset%C(green)%d%Creset'
COMMIT_FORMAT = '%C(bold blue)%H%Creset %s %C(cyan)(%an)%Creset%C(green)%d%Creset'

def git_config_get(option, default=None):
'''
Expand Down Expand Up @@ -227,7 +227,7 @@ def main():
else:
firstline = 'Merge #%s' % (pull,)
message = firstline + '\n\n'
message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%h %s (%an)',base_branch+'..'+head_branch]).decode('utf-8')
message += subprocess.check_output([GIT,'log','--no-merges','--topo-order','--pretty=format:%H %s (%an)',base_branch+'..'+head_branch]).decode('utf-8')
message += '\n\nPull request description:\n\n ' + body.replace('\n', '\n ') + '\n'
try:
subprocess.check_call([GIT,'merge','-q','--commit','--no-edit','--no-ff','--no-gpg-sign','-m',message.encode('utf-8'),head_branch])
Expand Down

0 comments on commit c4a9af8

Please sign in to comment.