Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 4.0.4 (unreleased)

- Support environment variable `GIT_CLONE_DEPTH` for setting a default git depth for all checkouts. Useful for CI.
[maurits]

- Fix #47: Do not add packages with capital names uncommented at the bottom ignore list when checked out.
[petschki]

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ True by default, unless `default-use` in the general settings is false.
When false, the source is not checked out,
and the version for this package is not overridden.

#### `depth`

For `git` only.
This is used to set the git clone depth.
This is not set by default: you get a full clone.
You can set environment variable `GIT_CLONE_DEPTH=1` to set a default git depth for all checkouts. This is useful for CI.

#### `submodules`

There are 3 different options:
Expand Down
5 changes: 3 additions & 2 deletions src/mxdev/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


logger = common.logger
GIT_CLONE_DEPTH = os.getenv("GIT_CLONE_DEPTH")


class GitError(common.WCError):
Expand Down Expand Up @@ -151,8 +152,8 @@ def git_checkout(self, **kwargs) -> typing.Union[str, None]:
update_git_submodules = self.source.get("submodules", kwargs["submodules"])
if update_git_submodules == "recursive":
args.append("--recurse-submodules")
if "depth" in self.source:
args.extend(["--depth", self.source["depth"]])
if "depth" in self.source or GIT_CLONE_DEPTH:
args.extend(["--depth", self.source.get("depth", GIT_CLONE_DEPTH)])
if "branch" in self.source:
args.extend(["-b", self.source["branch"]])
args.extend([url, path])
Expand Down
Loading