Skip to content

Commit c96e184

Browse files
avargitster
authored andcommitted
fetch-pack: use file-scope static struct for fsck_options
Change code added in 5476e1e (fetch-pack: print and use dangling .gitmodules, 2021-02-22) so that we use a file-scoped "static struct fsck_options" instead of defining one in the "fsck_gitmodules_oids()" function. We use this pattern in all of builtin/{fsck,index-pack,mktag,unpack-objects}.c. It's odd to see fetch-pack be the odd one out. One might think that we're using other fsck_options structs in fetch-pack, or doing on fsck twice there, but we're not. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 462f5ca commit c96e184

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fetch-pack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static int server_supports_filtering;
3838
static int advertise_sid;
3939
static struct shallow_lock shallow_lock;
4040
static const char *alternate_shallow_file;
41+
static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
4142
static struct strbuf fsck_msg_types = STRBUF_INIT;
4243
static struct string_list uri_protocols = STRING_LIST_INIT_DUP;
4344

@@ -991,15 +992,14 @@ static void fsck_gitmodules_oids(struct oidset *gitmodules_oids)
991992
{
992993
struct oidset_iter iter;
993994
const struct object_id *oid;
994-
struct fsck_options fo = FSCK_OPTIONS_STRICT;
995995

996996
if (!oidset_size(gitmodules_oids))
997997
return;
998998

999999
oidset_iter_init(gitmodules_oids, &iter);
10001000
while ((oid = oidset_iter_next(&iter)))
1001-
register_found_gitmodules(&fo, oid);
1002-
if (fsck_finish(&fo))
1001+
register_found_gitmodules(&fsck_options, oid);
1002+
if (fsck_finish(&fsck_options))
10031003
die("fsck failed");
10041004
}
10051005

0 commit comments

Comments
 (0)