diff options
author | 2022-01-13 15:25:06 +0000 | |
---|---|---|
committer | 2022-01-13 17:30:18 +0000 | |
commit | 2f51277ebfda930cac17b77df52a0dd2b222500f (patch) | |
tree | d441e08e392d0d9dbe9943ba90bbaf55329c2fc9 | |
parent | 2453899e69324c4c80d2a1deae248f224e8af6d6 (diff) |
Improve how "likely an AOSP change" is detected
git branch -vv can be incredibly slow (over 5s on my machine/repo), so
when aosp_sha.sh is called multiple times per commit, the repo upload
hook can take a very long time to run (>2 mins for my stack of changes).
The only output used from git branch -vv was the upstream of the current
branch, which can be determined in a much faster/simpler way via
printing the ref name of @{u} (git lingo for the upstream HEAD).
Test: $ { aosp_sha.sh HEAD && echo ok || echo no } in aosp and internal
Change-Id: I993496d8ec9e55c13803590bbb6c5d9d49cde158
-rwxr-xr-x | tools/aosp/aosp_sha.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/aosp/aosp_sha.sh b/tools/aosp/aosp_sha.sh index 36bea57b710f..95b43cdf253d 100755 --- a/tools/aosp/aosp_sha.sh +++ b/tools/aosp/aosp_sha.sh @@ -1,7 +1,7 @@ #!/bin/bash LOCAL_DIR="$( dirname "${BASH_SOURCE}" )" -if git branch -vv | grep -q -E "^\*[^\[]+\[aosp/"; then +if git log -n 1 --format='%D' HEAD@{upstream} | grep -q aosp/; then # Change appears to be in AOSP exit 0 elif git log -n 1 --format='%B' $1 | grep -q -E "^Ignore-AOSP-First: .+" ; then |