From cf9ca51f6982824901ff850c7893d84eddb6897c Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 18 Apr 2025 13:22:21 +0200 Subject: [PATCH] Update comments describing head optimization --- ros2nix/ros2nix.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ros2nix/ros2nix.py b/ros2nix/ros2nix.py index 22afc5b..bcb852e 100755 --- a/ros2nix/ros2nix.py +++ b/ros2nix/ros2nix.py @@ -440,8 +440,9 @@ def ros2nix(args): cwd=srcdir, shell=True).decode().strip() if args.use_per_package_src: - # we need to get merge_base again to filter out applied patches from the package git hash - merge_base = merge_base_to_upstream(head) + # Set head to point to the last commit the subdirectory was changed. This is + # not strictly necessary, but it will increase hit rate of git_cache. + merge_base = merge_base_to_upstream(head) # filter out locally applied patches head = check_output(f"git rev-list {merge_base} -1 -- .".split()) def cache_key(url, prefix):