From de4efc6c09396080981c066a19d16f04ed7df4dd Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Fri, 6 Oct 2023 18:12:45 +0200 Subject: [PATCH] git.py(git_cmd): always pass "-c" "fetch.prune=false" to git Problem: Anod sometimes breaks because users set fetch.prune=true in their .gitconfig, which causes Git to remove references that are actually required by Anod during `git fetch`es. Reproducer: Add the below snippet of code to your .gitconfig and run `anod update` twice. ```gitconfig [fetch] prune = true ``` Solution: Make every git command run with `-c fetch.prune=false`. This ensures that every git command will behave in an unsurprising way with regards to reference pruning on fetch. When pruning references on fetch is actually required, users of the `git_cmd` command will be able to add `--prune` to their `fetch` subcommand. --- src/e3/vcs/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/e3/vcs/git.py b/src/e3/vcs/git.py index 10e665bd..f58f7e47 100644 --- a/src/e3/vcs/git.py +++ b/src/e3/vcs/git.py @@ -134,7 +134,7 @@ def git_cmd( if output == GIT_LOG_STREAM: output = self.log_stream - p_cmd = [arg for arg in cmd if arg is not None] + p_cmd = ["-c", "fetch.prune=false"] + [arg for arg in cmd if arg is not None] p_cmd.insert(0, self.__class__.git) p = e3.os.process.Run(p_cmd, cwd=self.working_tree, output=output, **kwargs)