Skip to content

Commit 869a0eb

Browse files
rcoupgitster
authored andcommitted
builtin/fetch-pack: add --refetch option
Add a refetch option to fetch-pack to force a full fetch. Use when applying a new partial clone filter to refetch all matching objects. Signed-off-by: Robert Coup <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4dfd092 commit 869a0eb

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Documentation/git-fetch-pack.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ be in a separate packet, and the list must end with a flush packet.
101101
current shallow boundary instead of from the tip of each
102102
remote branch history.
103103

104+
--refetch::
105+
Skips negotiating commits with the server in order to fetch all matching
106+
objects. Use to reapply a new partial clone blob/tree filter.
107+
104108
--no-progress::
105109
Do not show the progress.
106110

builtin/fetch-pack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
153153
args.from_promisor = 1;
154154
continue;
155155
}
156+
if (!strcmp("--refetch", arg)) {
157+
args.refetch = 1;
158+
continue;
159+
}
156160
if (skip_prefix(arg, ("--" CL_ARG__FILTER "="), &arg)) {
157161
parse_list_objects_filter(&args.filter_options, arg);
158162
continue;

remote-curl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct options {
4343
/* see documentation of corresponding flag in fetch-pack.h */
4444
from_promisor : 1,
4545

46+
refetch : 1,
4647
atomic : 1,
4748
object_format : 1,
4849
force_if_includes : 1;
@@ -198,6 +199,9 @@ static int set_option(const char *name, const char *value)
198199
} else if (!strcmp(name, "from-promisor")) {
199200
options.from_promisor = 1;
200201
return 0;
202+
} else if (!strcmp(name, "refetch")) {
203+
options.refetch = 1;
204+
return 0;
201205
} else if (!strcmp(name, "filter")) {
202206
options.filter = xstrdup(value);
203207
return 0;
@@ -1182,6 +1186,8 @@ static int fetch_git(struct discovery *heads,
11821186
strvec_push(&args, "--deepen-relative");
11831187
if (options.from_promisor)
11841188
strvec_push(&args, "--from-promisor");
1189+
if (options.refetch)
1190+
strvec_push(&args, "--refetch");
11851191
if (options.filter)
11861192
strvec_pushf(&args, "--filter=%s", options.filter);
11871193
strvec_push(&args, url.buf);

0 commit comments

Comments
 (0)