Skip to content

Commit

Permalink
update sparse_checkout_asishkumar.md
Browse files Browse the repository at this point in the history
Signed-off-by: Asish Kumar <[email protected]>
  • Loading branch information
officialasishkumar committed Jun 6, 2024
1 parent 8b66da9 commit cb6d79d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions research/design-doc/sparse_checkout_asishkumar.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

## User Interface

The user can just provide the subdir git url. An example command will look like this:
The user can just provide the git url of the subdir they want to install. An example command will look like this:

```
kcl mod add --git https://github.com/kcl-lang/modules/tree/main/argoproj --tag <tag>
```

kpm would parse the git url and extract the subdirectory path using `GetPath()` function from github.com/kubescape/go-git-url package. It will then download the subdirectory and append it in the subdir array of the `kcl.mod` file.
kpm would parse the git url and extract the subdirectory path using `GetPath()` function from github.com/kubescape/go-git-url subdir. It will then download the subdirectory and append it in the subdir array of the `kcl.mod` file.

The `kcl.mod` file will look like this:

Expand All @@ -27,11 +27,9 @@ The subdir is a list because in the future if user wants to add another subdir f

## Design

The path to the directory will be passed to `CloneOptions` in [pkg/git/git.go](https://github.com/kcl-lang/kpm/blob/d20b1acdc988f600c8f8465ecd9fe04225e19149/pkg/git/git.go#L19) as subDir.
The path to the directory will be passed to `CloneOptions` in [pkg/git/git.go](https://github.com/kcl-lang/kpm/blob/d20b1acdc988f600c8f8465ecd9fe04225e19149/pkg/git/git.go#L19) as subdir.

### using go-getter

As mentioned in the [go-getter](https://pkg.go.dev/github.com/hashicorp/go-getter#readme-subdirectories) docs, we can append our subDir from `CloneOptions` (only if subDir is not empty) in `WithRepoURL` function.
As mentioned in the [go-getter](https://pkg.go.dev/github.com/hashicorp/go-getter#readme-subdirectories) docs, we can append our subdir from `CloneOptions` (only if subdir is not empty) in `WithRepoURL` function.

## References

Expand Down

0 comments on commit cb6d79d

Please sign in to comment.