Skip to content

Commit 0711883

Browse files
avargitster
authored andcommitted
fetch: stop accessing "remote" variable indirectly
Access the "remote" variable passed to the fetch_one() directly rather than through the gtransport wrapper struct constructed in this function for other purposes. This makes the code more readable, as it's now obvious that the remote struct doesn't somehow get munged by the prepare_transport() function above, which takes the "remote" struct as an argument and constructs the "gtransport" struct, containing among other things the "remote" struct. A subsequent change will copy this pattern to access a new remote->prune_tags field, but without the use of the gtransport variable. It's useful once that change lands to see that the two pieces of code behave exactly the same. This pattern of accessing the container struct was added in 737c5a9 ("fetch: make --prune configurable", 2013-07-13) when this code was initially introduced. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ce3ab21 commit 0711883

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,8 +1280,8 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
12801280

12811281
if (prune < 0) {
12821282
/* no command line request */
1283-
if (0 <= gtransport->remote->prune)
1284-
prune = gtransport->remote->prune;
1283+
if (0 <= remote->prune)
1284+
prune = remote->prune;
12851285
else if (0 <= fetch_prune_config)
12861286
prune = fetch_prune_config;
12871287
else

0 commit comments

Comments
 (0)