Skip to content

[SR-3313] Swift package manager should clone with depth 1 by default #5159

@alblue

Description

@alblue
Previous ID SR-3313
Radar None
Original Reporter @alblue
Type Improvement
Status Resolved
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: 2e0e90cba36b930978412b088062e00b

Issue Description:

In the source code, swift package manager clones with depth 10:

https://github.com/apple/swift-package-manager/blob/57c5be1db1c1e12e089dff02241ffbce5722fb0e/Sources/Get/Git.swift#L31-L34

try system(Git.tool, "clone",
"--recursive", // get submodules too so that developers can use these if they so choose
"--depth", "10",
url, dstdir.asString, environment: env, message: "Cloning (url)")

The additional depth is unnecessary and in almost all cases won't be used; in addition, a remote git server can serve a --depth 1 quicker than a --depth >1, because a --depth 1 clone is simply a pack of the current tree.

Current versions of Git document the ability to extend the depth at a later stage if desired, which means that on a case-by-case basis this can easily be extended:

http://stackoverflow.com/questions/6941889/is-it-safe-to-shallow-clone-with-depth-1-create-commits-and-pull-updates-aga#21217267

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions