Skip to content

Commit

Permalink
git.py(git_cmd): always pass "-c" "fetch.prune=false" to git
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
glacambre committed Oct 6, 2023
1 parent 8016bdb commit de4efc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/e3/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit de4efc6

Please sign in to comment.