On Thu, Oct 26, 2023 at 08:32:36AM -0700, Fuyuan Chu wrote:

> Hi guys, I met a pretty weird staff when running the following code to 
> update tags.
> Code:
> 
> #!/usr/bin/env python
> 
> from concurrent import futures
> import sh
[...]
>         sh.git("fetch", "--all", "--tags", "--force","--atomic")
[...]
> When we run this process concurrently, we find some of the tags failed to 
> update. Moreover, the command does not fail. That's so weird.
[...]

You do not appear to call Git directly, instead you're doing this with the
help of Python (that's fine) using a non-standard module sh (in the sense it's
not a part of Python's stdlib), and in particular - a "contrib" bit of its
code [1]. Hence basically you are not doing a clean-room experiment: what you
observe might be an issue of the sh module or its Git wrapper code - in
particular, that code might fail to properly handle the failure of the
`git tag` command.

Hence I would recommend to follow one of the following paths:

 - Re-write your example using plain shell which calls Git commands
   directly. Run the Git commands in the `set -e` shell's mode so that
   the execution immediately blows up on any error calling external code.

 - Run your Python program while having GIT_TRACE=1 in the environment,
   and save the (copious) output for examination. Then try to see whether any
   of the traced Git commands actually failed. See the output of `git help git`
   for ways to fine-tune tracing of the Git commands.

 1. https://sh.readthedocs.io/en/latest/sections/contrib.html#git

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/20231026160427.aq7ltdadyca47osx%40carbon.

Reply via email to