<feed xmlns='http://www.w3.org/2005/Atom'>
<title>tools/git-repo.git/hooks.py, branch v2.68.1</title>
<subtitle>Mirror of gerrit.googlesource.com/git-repo</subtitle>
<id>https://git.enea.com/cgit/tools/git-repo.git/atom?h=v2.68.1</id>
<link rel='self' href='https://git.enea.com/cgit/tools/git-repo.git/atom?h=v2.68.1'/>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/'/>
<updated>2026-08-27T10:28:58+00:00</updated>
<entry>
<title>hooks: add --fix option to auto-apply hook fixes</title>
<updated>2026-08-27T10:28:58+00:00</updated>
<author>
<name>Rahul Yadav</name>
<email>yadavrah@google.com</email>
</author>
<published>2026-08-14T15:09:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=e6ad7080098a0db0cb304812c8603856da2bebf2'/>
<id>urn:sha1:e6ad7080098a0db0cb304812c8603856da2bebf2</id>
<content type='text'>
Pass the --fix flag as a keyword argument "fix" to the hook main
function. This allows hooks (such as git-repohooks) to decouple
automated fix application from the -y/--yes flag so that -y can
answer yes to upload confirmation prompts without triggering file
mutations.

Companion change in git-repohooks:
https://gerrit-review.googlesource.com/c/git-repohooks/+/621761

Bug: 546510319
Test: python3 -m pytest tests/test_hooks.py

Change-Id: If0288d4791fc0a2aba6e88854e3aa81b0923b664
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/619281
Commit-Queue: Rahul Yadav &lt;yadavrah@google.com&gt;
Tested-by: Rahul Yadav &lt;yadavrah@google.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>hooks: pass yes flag when available</title>
<updated>2026-07-20T14:56:03+00:00</updated>
<author>
<name>Rahul Yadav</name>
<email>yadavrah@google.com</email>
</author>
<published>2026-07-10T15:39:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=eeba6f268d0220bc928ed7af41d310dfbe215205'/>
<id>urn:sha1:eeba6f268d0220bc928ed7af41d310dfbe215205</id>
<content type='text'>
Pass the -y flag as a keyword argument "yes" to the hook main function.
This allows upload hooks (such as auto-fixers) to automatically
apply fixes when the -y flag is passed, rather than prompting the user.

Bug: 498893733
Change-Id: I12096029aa3af471ba9175314d749deb0ebd1007
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/605261
Commit-Queue: Rahul Yadav &lt;yadavrah@google.com&gt;
Reviewed-by: Mike Frysinger &lt;vapier@google.com&gt;
Tested-by: Rahul Yadav &lt;yadavrah@google.com&gt;
</content>
</entry>
<entry>
<title>Add timing keyword argument for hooks</title>
<updated>2026-04-22T00:10:07+00:00</updated>
<author>
<name>Ram Peri</name>
<email>ramperi@google.com</email>
</author>
<published>2026-04-21T00:02:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=5af71ce907848a546199f0d64a5dfba1db8adca0'/>
<id>urn:sha1:5af71ce907848a546199f0d64a5dfba1db8adca0</id>
<content type='text'>
Measure the duration of the sync operation in the Execute method of the
Sync command and pass it to post-sync hooks as a standard keyword
argument (`sync_duration_seconds`).

Updates based on code review:
- Update _API_ARGS in hooks.py to allow sync_duration_seconds for post-sync hooks.
- Do not cast sync_duration_seconds to int for better granularity.
- Update docs/repo-hooks.md to document sync_duration_seconds.
- Add unit test for argument validation in test_hooks.py.

Test: Ran run_tests using venv python, all 554 tests passed.
Bug: TBD
Change-Id: Ie29e002a5d283460d993ad96c224dbf4b6d7985c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/575021
Tested-by: Arif Kasim &lt;arifkasim@google.com&gt;
Commit-Queue: Ram Peri &lt;ramperi@google.com&gt;
Reviewed-by: Arif Kasim &lt;arifkasim@google.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>hooks: verify hooks project has worktree before running</title>
<updated>2025-07-28T15:37:08+00:00</updated>
<author>
<name>Gavin Mak</name>
<email>gavinmak@google.com</email>
</author>
<published>2025-07-25T23:20:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=239fad7146e04c631825c340f23d6e69947aac50'/>
<id>urn:sha1:239fad7146e04c631825c340f23d6e69947aac50</id>
<content type='text'>
Skip hook if its project is not present on disk.

Bug: 434232630
Change-Id: I09a8b412d078af7a068d533f7be320d5b02327be
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/494441
Reviewed-by: Scott Lee &lt;ddoman@google.com&gt;
Tested-by: Gavin Mak &lt;gavinmak@google.com&gt;
Commit-Queue: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>sync: support post-sync hook in &lt;repo-hooks&gt;</title>
<updated>2025-07-01T23:11:50+00:00</updated>
<author>
<name>Kenny Cheng</name>
<email>chao.shun.cheng.tw@gmail.com</email>
</author>
<published>2025-06-02T13:55:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=82d500eb7aa93f9bff66a4358a08d2ba2d599550'/>
<id>urn:sha1:82d500eb7aa93f9bff66a4358a08d2ba2d599550</id>
<content type='text'>
Add support for a new hook type "post-sync" declared in the manifest using
&lt;repo-hooks&gt;. This allows executing a script automatically after a successful
`repo sync`.

This is useful for initializing developer environments, installing project-wide
Git hooks, generating configs, and other post-sync automation tasks.

Example manifest usage:

  &lt;project name="myorg/repo-hooks" path="hooks" revision="main" /&gt;
  &lt;repo-hooks in-project="myorg/repo-hooks" enabled-list="post-sync"&gt;
    &lt;hook name="post-sync" /&gt;
  &lt;/repo-hooks&gt;

The hook script must be named `post-sync.py` and located at the root of the
hook project.

The post-sync hook does not block `repo sync`; if the script fails, the sync
still completes successfully with a warning.

Test: Added `post-sync.py` in hook project and verified it runs after `repo sync`

Bug: b/421694721
Change-Id: I69f3158f0fc319d73a85028d6e90fea02c1dc8c8
Signed-off-by: Kenny Cheng &lt;chao.shun.cheng.tw@gmail.com&gt;
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/480581
Reviewed-by: Scott Lee &lt;ddoman@google.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
<entry>
<title>hooks: add internal check for external hook API</title>
<updated>2025-06-06T18:12:13+00:00</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@google.com</email>
</author>
<published>2025-06-05T20:53:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=044e52e23655167877f693a7f0ce934a054d38af'/>
<id>urn:sha1:044e52e23655167877f693a7f0ce934a054d38af</id>
<content type='text'>
Add an internal check to make sure we always follow the API we've
documented for external authors.  Since the internal call is a bit
ad-hoc, it can be easy to miss a call site.

Change-Id: Ie8cd298d1fc34f10f3c5eb353512a3e881f42252
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/481721
Reviewed-by: Nasser Grainawi &lt;nasser.grainawi@oss.qualcomm.com&gt;
Reviewed-by: Gavin Mak &lt;gavinmak@google.com&gt;
Tested-by: Mike Frysinger &lt;vapier@google.com&gt;
Commit-Queue: Mike Frysinger &lt;vapier@google.com&gt;
</content>
</entry>
<entry>
<title>cleanup: Update codebase to expect Python 3.6</title>
<updated>2023-10-31T16:03:54+00:00</updated>
<author>
<name>Jason R. Coombs</name>
<email>jaraco@google.com</email>
</author>
<published>2023-09-29T15:04:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=b32ccbb66bb16965ecb8b4e266c4e45186636c1b'/>
<id>urn:sha1:b32ccbb66bb16965ecb8b4e266c4e45186636c1b</id>
<content type='text'>
- Bump minimum version to Python 3.6.
- Use f-strings in a lot of places.

Change-Id: I2aa70197230fcec2eff8e7c8eb754f20c08075bb
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389034
Tested-by: Jason R. Coombs &lt;jaraco@google.com&gt;
Reviewed-by: Mike Frysinger &lt;vapier@google.com&gt;
Commit-Queue: Jason R. Coombs &lt;jaraco@google.com&gt;
</content>
</entry>
<entry>
<title>delete Python 2 (object) compat</title>
<updated>2023-10-20T04:51:01+00:00</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@google.com</email>
</author>
<published>2023-10-19T09:13:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=d4aee6570b64c5b6de584b0a5ce76e6a139faf38'/>
<id>urn:sha1:d4aee6570b64c5b6de584b0a5ce76e6a139faf38</id>
<content type='text'>
Bug: 302871152
Change-Id: I39636d73a6e1d69efa8ade74f75c5381651e6dc8
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/390054
Commit-Queue: Mike Frysinger &lt;vapier@google.com&gt;
Reviewed-by: Aravind Vasudevan &lt;aravindvasudev@google.com&gt;
Tested-by: Mike Frysinger &lt;vapier@google.com&gt;
</content>
</entry>
<entry>
<title>hooks: drop support for Python 2</title>
<updated>2023-10-13T20:52:46+00:00</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@google.com</email>
</author>
<published>2023-10-13T19:40:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=3b8f9535c772178d8adeb1e0e4fc5916e311490a'/>
<id>urn:sha1:3b8f9535c772178d8adeb1e0e4fc5916e311490a</id>
<content type='text'>
Stop running old repohooks via python2.  Abort immediately with a
clear error for the user.

Bug: 302871152
Change-Id: I750c6cbbf3c7950e249512bb1bd023c32587eef5
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389454
Reviewed-by: Aravind Vasudevan &lt;aravindvasudev@google.com&gt;
Tested-by: Mike Frysinger &lt;vapier@google.com&gt;
Commit-Queue: Mike Frysinger &lt;vapier@google.com&gt;
</content>
</entry>
<entry>
<title>Format codebase with black and check formatting in CQ</title>
<updated>2023-03-22T17:46:28+00:00</updated>
<author>
<name>Gavin Mak</name>
<email>gavinmak@google.com</email>
</author>
<published>2023-03-11T06:46:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.enea.com/cgit/tools/git-repo.git/commit/?id=ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1'/>
<id>urn:sha1:ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1</id>
<content type='text'>
Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught
by flake8. Also check black formatting in run_tests (and CQ).

Bug: b/267675342
Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474
Reviewed-by: Mike Frysinger &lt;vapier@google.com&gt;
Tested-by: Gavin Mak &lt;gavinmak@google.com&gt;
Commit-Queue: Gavin Mak &lt;gavinmak@google.com&gt;
</content>
</entry>
</feed>
