diff options
| author | Gavin Mak <gavinmak@google.com> | 2026-06-23 22:47:32 +0000 |
|---|---|---|
| committer | gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-06-26 15:40:55 -0700 |
| commit | c21a41c7ccc0350841cb57733f845dd2054bd285 (patch) | |
| tree | 588fdb46f7d4015925e513a6b141afacf3a7e953 /git_config.py | |
| parent | 6586efe79ab12e59466b67eaf59d19002abdf268 (diff) | |
| download | git-repo-c21a41c7ccc0350841cb57733f845dd2054bd285.tar.gz | |
git_config: Support SHA-256 object IDs
Update ID_RE to match both 40-char (SHA-1) and 64-char (SHA-256) IDs as
part of Git 3.0 support.
Bug: 483758905
Change-Id: Ie5d9a2a5df4c6e7adda7f1d89f1bfb7724846057
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/600341
Reviewed-by: Brian Gan <brgan@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'git_config.py')
| -rw-r--r-- | git_config.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/git_config.py b/git_config.py index 9b3188f1e..888ae888c 100644 --- a/git_config.py +++ b/git_config.py | |||
| @@ -40,7 +40,7 @@ from repo_trace import Trace | |||
| 40 | # that is saved in the config. | 40 | # that is saved in the config. |
| 41 | SYNC_STATE_PREFIX = "repo.syncstate." | 41 | SYNC_STATE_PREFIX = "repo.syncstate." |
| 42 | 42 | ||
| 43 | ID_RE = re.compile(r"^[0-9a-f]{40}$") | 43 | ID_RE = re.compile(r"^[0-9a-f]{40,64}$") |
| 44 | 44 | ||
| 45 | REVIEW_CACHE = {} | 45 | REVIEW_CACHE = {} |
| 46 | 46 | ||
| @@ -49,8 +49,8 @@ def IsChange(rev): | |||
| 49 | return rev.startswith(R_CHANGES) | 49 | return rev.startswith(R_CHANGES) |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | def IsId(rev): | 52 | def IsId(rev: str) -> bool: |
| 53 | return ID_RE.match(rev) | 53 | return bool(ID_RE.match(rev)) |
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | def IsTag(rev): | 56 | def IsTag(rev): |
