Skip to content

Commit 96f2952

Browse files
committed
Merge branch 'ma/http-walker-no-partial'
"git http-fetch" (deprecated) had an optional and experimental "feature" to fetch only commits and/or trees, which nobody used. This has been removed. * ma/http-walker-no-partial: walker: drop fields of `struct walker` which are always 1 http-fetch: make `-a` standard behaviour
2 parents 71c848b + 0b6b342 commit 96f2952

File tree

6 files changed

+24
-40
lines changed

6 files changed

+24
-40
lines changed

Documentation/git-http-fetch.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,18 @@ DESCRIPTION
1515
-----------
1616
Downloads a remote Git repository via HTTP.
1717

18-
*NOTE*: use of this command without -a is deprecated. The -a
19-
behaviour will become the default in a future release.
18+
This command always gets all objects. Historically, there were three options
19+
`-a`, `-c` and `-t` for choosing which objects to download. They are now
20+
silently ignored.
2021

2122
OPTIONS
2223
-------
2324
commit-id::
2425
Either the hash or the filename under [URL]/refs/ to
2526
pull.
2627

27-
-c::
28-
Get the commit objects.
29-
-t::
30-
Get trees associated with the commit objects.
31-
-a::
32-
Get all the objects.
28+
-a, -c, -t::
29+
These options are ignored for historical reasons.
3330
-v::
3431
Report what is downloaded.
3532

http-fetch.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,13 @@ int cmd_main(int argc, const char **argv)
1717
char *url = NULL;
1818
int arg = 1;
1919
int rc = 0;
20-
int get_tree = 0;
21-
int get_history = 0;
22-
int get_all = 0;
2320
int get_verbosely = 0;
2421
int get_recover = 0;
2522

2623
while (arg < argc && argv[arg][0] == '-') {
2724
if (argv[arg][1] == 't') {
28-
get_tree = 1;
2925
} else if (argv[arg][1] == 'c') {
30-
get_history = 1;
3126
} else if (argv[arg][1] == 'a') {
32-
get_all = 1;
33-
get_tree = 1;
34-
get_history = 1;
3527
} else if (argv[arg][1] == 'v') {
3628
get_verbosely = 1;
3729
} else if (argv[arg][1] == 'w') {
@@ -55,10 +47,6 @@ int cmd_main(int argc, const char **argv)
5547
commits = 1;
5648
}
5749

58-
if (get_all == 0)
59-
warning("http-fetch: use without -a is deprecated.\n"
60-
"In a future release, -a will become the default.");
61-
6250
if (argv[arg])
6351
str_end_url_with_slash(argv[arg], &url);
6452

@@ -68,9 +56,6 @@ int cmd_main(int argc, const char **argv)
6856

6957
http_init(NULL, url, 0);
7058
walker = get_http_walker(url);
71-
walker->get_tree = get_tree;
72-
walker->get_history = get_history;
73-
walker->get_all = get_all;
7459
walker->get_verbosely = get_verbosely;
7560
walker->get_recover = get_recover;
7661

remote-curl.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,9 +869,6 @@ static int fetch_dumb(int nr_heads, struct ref **to_fetch)
869869
targets[i] = xstrdup(oid_to_hex(&to_fetch[i]->old_oid));
870870

871871
walker = get_http_walker(url.buf);
872-
walker->get_all = 1;
873-
walker->get_tree = 1;
874-
walker->get_history = 1;
875872
walker->get_verbosely = options.verbosity >= 3;
876873
walker->get_recover = 0;
877874
ret = walker_fetch(walker, nr_heads, targets, NULL, NULL);

t/t5550-http-fetch-dumb.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,17 @@ test_expect_success 'fetch changes via manual http-fetch' '
169169
test_cmp file clone2/file
170170
'
171171

172+
test_expect_success 'manual http-fetch without -a works just as well' '
173+
cp -R clone-tmpl clone3 &&
174+
175+
HEAD=$(git rev-parse --verify HEAD) &&
176+
(cd clone3 &&
177+
git http-fetch -w heads/master-new $HEAD $(git config remote.origin.url) &&
178+
git checkout master-new &&
179+
test $HEAD = $(git rev-parse --verify HEAD)) &&
180+
test_cmp file clone3/file
181+
'
182+
172183
test_expect_success 'http remote detects correct HEAD' '
173184
git push public master:other &&
174185
(cd clone &&

walker.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ static struct commit_list *complete = NULL;
7272

7373
static int process_commit(struct walker *walker, struct commit *commit)
7474
{
75+
struct commit_list *parents;
76+
7577
if (parse_commit(commit))
7678
return -1;
7779

@@ -86,19 +88,14 @@ static int process_commit(struct walker *walker, struct commit *commit)
8688

8789
walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid));
8890

89-
if (walker->get_tree) {
90-
if (process(walker, &commit->tree->object))
91+
if (process(walker, &commit->tree->object))
92+
return -1;
93+
94+
for (parents = commit->parents; parents; parents = parents->next) {
95+
if (process(walker, &parents->item->object))
9196
return -1;
92-
if (!walker->get_all)
93-
walker->get_tree = 0;
94-
}
95-
if (walker->get_history) {
96-
struct commit_list *parents = commit->parents;
97-
for (; parents; parents = parents->next) {
98-
if (process(walker, &parents->item->object))
99-
return -1;
100-
}
10197
}
98+
10299
return 0;
103100
}
104101

walker.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ struct walker {
99
void (*prefetch)(struct walker *, unsigned char *sha1);
1010
int (*fetch)(struct walker *, unsigned char *sha1);
1111
void (*cleanup)(struct walker *);
12-
int get_tree;
13-
int get_history;
14-
int get_all;
1512
int get_verbosely;
1613
int get_recover;
1714

0 commit comments

Comments
 (0)