From 878c52bcf02018a9e85b19b796e85b067a486caf Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sat, 16 Mar 2024 11:47:05 -0700 Subject: [PATCH] gnulib-tool.py: Fix 'git update-index' call when using hard links. * pygnulib/main.py: Fix conditional used to check whether 'git update-index' should be called. Only catch FileNotFoundError exceptions thrown when no 'git' program exists. --- ChangeLog | 7 +++++++ pygnulib/main.py | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 44ff5a5475..9f78456440 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-03-16 Collin Funk + + gnulib-tool.py: Fix 'git update-index' call when using hard links. + * pygnulib/main.py: Fix conditional used to check whether 'git + update-index' should be called. Only catch FileNotFoundError exceptions + thrown when no 'git' program exists. + 2024-03-16 Collin Funk gnulib-tool.py: Coding style: Avoid not(). diff --git a/pygnulib/main.py b/pygnulib/main.py index a3db7bb7c7..5d88d0115a 100644 --- a/pygnulib/main.py +++ b/pygnulib/main.py @@ -1279,7 +1279,7 @@ def main(): sys.stderr.write(message) sys.exit(1) - if copymode != classes.CopyAction.Copy or lcopymode != classes.CopyAction.Copy: + if copymode == classes.CopyAction.Hardlink or lcopymode == classes.CopyAction.Hardlink: # Setting hard links modifies the ctime of files in the gnulib checkout. # This disturbs the result of the next "gitk" invocation. # Workaround: Let git scan the files. This can be done through @@ -1287,9 +1287,9 @@ def main(): if isdir(joinpath(APP['root'], '.git')): try: sp.run(['git', 'update-index', '--refresh'], - cwd=APP['root'], stdout=sp.DEVNULL, stderr=sp.DEVNULL) - except Exception: - # We did our best... + cwd=APP['root'], stdout=sp.DEVNULL) + except FileNotFoundError: + # No 'git' program was found. pass -- 2.44.0