1
0
Fork 0
git-repo/subcmds
Kenny Cheng 82d500eb7a sync: support post-sync hook in <repo-hooks>
Add support for a new hook type "post-sync" declared in the manifest using
<repo-hooks>. 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:

  <project name="myorg/repo-hooks" path="hooks" revision="main" />
  <repo-hooks in-project="myorg/repo-hooks" enabled-list="post-sync">
    <hook name="post-sync" />
  </repo-hooks>

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 <chao.shun.cheng.tw@gmail.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/480581
Reviewed-by: Scott Lee <ddoman@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2025-07-01 16:11:50 -07:00
..
__init__.py cleanup: Update codebase to expect Python 3.6 2023-10-31 16:03:54 +00:00
abandon.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
branches.py branches: Escape percent signs in branch names 2024-12-03 19:02:20 +00:00
checkout.py subcmds: reduce multiprocessing serialization overhead 2024-10-23 23:34:34 +00:00
cherry_pick.py Update logger.warn to logger.warning 2023-10-13 19:34:26 +00:00
diff.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
diffmanifests.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
download.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
forall.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
gc.py gc: Add tags to remote pack list 2025-02-05 12:36:27 -08:00
grep.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
help.py cleanup: Update codebase to expect Python 3.6 2023-10-31 16:03:54 +00:00
info.py info: print superproject revision 2025-05-27 11:49:32 -07:00
init.py init: Add environment variable for git-lfs 2025-06-30 15:27:26 -07:00
list.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
manifest.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
overview.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
prune.py subcmds: reduce multiprocessing serialization overhead 2024-10-23 23:34:34 +00:00
rebase.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
selfupdate.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
smartsync.py Format codebase with black and check formatting in CQ 2023-03-22 17:46:28 +00:00
stage.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
start.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
status.py subcmds: delete redundant dest= settings 2025-05-27 09:26:43 -07:00
sync.py sync: support post-sync hook in <repo-hooks> 2025-07-01 16:11:50 -07:00
upload.py upload: fix FileNotFoundError when no superproject 2025-06-17 13:31:02 -07:00
version.py cleanup: Update codebase to expect Python 3.6 2023-10-31 16:03:54 +00:00