Skip to content

Commit a7718b5

Browse files
committed
Add feature to clone a specific tag. Refactor the git-partial-clone script, the local user is not required.
1 parent c5859a1 commit a7718b5

File tree

7 files changed

+535
-255
lines changed

7 files changed

+535
-255
lines changed

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ OPTIONS:
4646
-s | --subdir Subfolder to be cloned.
4747
4848
-t | --token Path to your access token (for private repos).
49-
-u | --user Your username (for private repos).
5049
5150
-b | --branch Branch to be fetched.
5251
-v | --tag Tag of the version to be fetched.
@@ -72,12 +71,10 @@ You will need to generate an access token in order to clone private repositories
7271
- Github: [github.com/settings/tokens](https://github.com/settings/tokens).
7372
- Gitlab: [gitlab.com/-/profile/personal_access_tokens](https://gitlab.com/-/profile/personal_access_tokens).
7473

75-
Save your token in a file and provide its path with the `--token` option, then provide your username with the `--user` option.
76-
77-
The following example would clone a subfolder of a private repository.
74+
Save your token in a file and provide its path with the `--token` option, the following example would clone a subfolder of a private repository.
7875
```zsh
7976
git-partial-clone --owner=owner --repo=repo --subdir=path/to/subdir \
80-
--token=/path/to/your/token/file --user=username_with_access
77+
--token=/path/to/your/token/file
8178
```
8279

8380
# Using a configuration file
@@ -106,8 +103,6 @@ Fill in the config file ([`template.conf`](./template.conf)) with the informatio
106103
### Variables for **private repositories**
107104
- `TOKEN_PATH`:
108105
- Path to the file containing the access token.
109-
- `GIT_USER`:
110-
- Username with access to the repository.
111106

112107
### Optional variables
113108
- `BRANCH`:
@@ -116,7 +111,7 @@ Fill in the config file ([`template.conf`](./template.conf)) with the informatio
116111
- Overrided by `TAG_NAME`.
117112
- `TAG_NAME`:(tag | t)
118113
- Tag of the version to be fetched.
119-
- Omit it to fetch the latest commit.
114+
- Omit it to fetch the latest commit of `BRANCH`.
120115
- Takes precedence over `BRANCH`.
121116
- `COMMIT_DEPTH`:
122117
- Number of commits you want to fetch (useful for deployment purposes).

completion-rules.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ _git-partial-clone()
4040
return
4141
;;
4242
--owner | -o | --repo | -r | --subdir | -s | \
43-
--user | -u | --branch | -b | --depth | -d | \
43+
--branch | -b | --depth | -d | \
4444
--tag | -v)
4545
# Suggest nothing :P
4646
return
4747
;;
48+
--tag | -v)
49+
return
50+
;;
4851
--help*)
4952
return
5053
;;

example.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ REPO_NAME=vscode-settings
1313
REMOTE_PARTIAL_DIR=json/snippets
1414

1515
TOKEN_PATH=
16-
GIT_USER=
1716

1817
BRANCH=master
1918
TAG_NAME=

0 commit comments

Comments
 (0)