Skip to content

Commit

Permalink
Merge pull request #916 from RonnyPfannschmidt/fix-913-larger-timeout…
Browse files Browse the repository at this point in the history
…-for-unshallow

Fix 913 larger timeout for unshallow
  • Loading branch information
RonnyPfannschmidt committed Sep 20, 2023
2 parents 6beec52 + 9d83cb3 commit ceca235
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ bugfix
------

* fix #912: ensure mypy safety of the version template + regression test

* fix #913: use 240s timeout instead of 20 for git unshallow
to account for large repos or slow connections

v8.0.1
======
Expand Down
15 changes: 12 additions & 3 deletions src/setuptools_scm/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,18 @@


def run_git(
args: Sequence[str | os.PathLike[str]], repo: Path, *, check: bool = False
args: Sequence[str | os.PathLike[str]],
repo: Path,
*,
check: bool = False,
timeout: int = 20,
) -> _CompletedProcess:
return _run(["git", "--git-dir", repo / ".git", *args], cwd=repo, check=check)
return _run(
["git", "--git-dir", repo / ".git", *args],
cwd=repo,
check=check,
timeout=timeout,
)


class GitWorkdir(Workdir):
Expand Down Expand Up @@ -127,7 +136,7 @@ def is_shallow(self) -> bool:
return self.path.joinpath(".git/shallow").is_file()

def fetch_shallow(self) -> None:
run_git(["fetch", "--unshallow"], self.path, check=True)
run_git(["fetch", "--unshallow"], self.path, check=True, timeout=240)

def node(self) -> str | None:
def _unsafe_short_node(node: str) -> str:
Expand Down

0 comments on commit ceca235

Please sign in to comment.