hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.62k stars 227 forks source link

Documentation missing: Subdirectories are cloned to temp directory #493

Open mss opened 1 month ago

mss commented 1 month ago

When one uses the double-slash syntax to retrieve only a subdirectory the Git repository is first cloned to the temp directory and then the relevant parts are copied over to the final destination. This is not documented.

The next section Checksumming has some extensive documentation on how the temp directory is picked up which I'd just move up to the Subdirectories section where it is more relevant.

Why is this relevant? Because Git config can be dependent on the $GIT_DIR and thus some config does not work as expected (which is additionally confusing because it works in Terraform which does its own double-slash parsing).

For a real-world example, let's take this Git config snippet:

[includeIf "gitdir:~/code/work/"]
    path = ~/.config/git/work.config 

And combine it with something relevant for cloning (through a VPN/Proxy in this case) in ~/.config/git/work.config like this:

[url "https://git.example.com/scm/"]
    insteadOf = ssh://git@git.example.com/