From: Collin Funk Date: Sat, 16 Mar 2024 18:47:05 +0000 (-0700) Subject: gnulib-tool.py: Fix 'git update-index' call when using hard links. X-Git-Tag: v1.0~281 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=894307b38d53ac1a37fa36a75756d2985f11bce3;p=gnulib.git 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. --- 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