diff options
| author | Patrick Steinhardt <ps@pks.im> | 2022-03-14 08:42:46 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-03-14 22:24:59 +0000 |
| commit | 64a6151da7fa4b36eb2818047a9b76797e25b46e (patch) | |
| tree | 222091f728c8fe6a6946219834b15025b758f16c /builtin/repack.c | |
| parent | 4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a (diff) | |
| download | git-64a6151da7fa4b36eb2818047a9b76797e25b46e.tar.xz | |
repack: refactor to avoid double-negation of update-server-info
By default, git-repack(1) runs `update_server_info()` to generate info
required for the dumb HTTP protocol. This can be disabled via the `-n`
flag, which then sets the `no_update_server_info` flag. Further down the
code this leads to some double-negation logic, which is about to become
more confusing as we're about to add a new config which allows the user
to permanently disable generation of the info.
Refactor the code to avoid the double-negation and add some tests which
verify that the flag continues to work as expected.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repack.c')
| -rw-r--r-- | builtin/repack.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/repack.c b/builtin/repack.c index da1e364a75..f2ac8ad14b 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -620,7 +620,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix) const char *unpack_unreachable = NULL; int keep_unreachable = 0; struct string_list keep_pack_list = STRING_LIST_INIT_NODUP; - int no_update_server_info = 0; + int run_update_server_info = 1; struct pack_objects_args po_args = {NULL}; int geometric_factor = 0; int write_midx = 0; @@ -637,8 +637,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix) N_("pass --no-reuse-delta to git-pack-objects")), OPT_BOOL('F', NULL, &po_args.no_reuse_object, N_("pass --no-reuse-object to git-pack-objects")), - OPT_BOOL('n', NULL, &no_update_server_info, - N_("do not run git-update-server-info")), + OPT_NEGBIT('n', NULL, &run_update_server_info, + N_("do not run git-update-server-info"), 1), OPT__QUIET(&po_args.quiet, N_("be quiet")), OPT_BOOL('l', "local", &po_args.local, N_("pass --local to git-pack-objects")), @@ -939,7 +939,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix) prune_shallow(PRUNE_QUICK); } - if (!no_update_server_info) + if (run_update_server_info) update_server_info(0); remove_temporary_files(); |
