global: mark usage strings and string tables const

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ahelenia Ziemiańska committed Apr 21, 2025 at 10:56 UTC 86eef3541e96c398db900ff3e77258bfae9d99e3
15 files changed +24 -24
builtin/blame.c
+5 -5
@@ -36,17 +36,17 @@
36 #include "tag.h"
37 #include "write-or-die.h"
38
39 -static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
40 -static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");
39 +static const char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
40 +static const char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");
41
42 -static const char *blame_opt_usage[] = {
42 +static const char *const blame_opt_usage[] = {
43 blame_usage,
44 "",
45 N_("<rev-opts> are documented in git-rev-list(1)"),
46 NULL
47 };
48
49 -static const char *annotate_opt_usage[] = {
49 +static const char *const annotate_opt_usage[] = {
50 annotate_usage,
51 "",
52 N_("<rev-opts> are documented in git-rev-list(1)"),
@@ -929,7 +929,7 @@ int cmd_blame(int argc,
929 long anchor;
930 long num_lines = 0;
931 const char *str_usage = cmd_is_annotate ? annotate_usage : blame_usage;
932 - const char **opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
932 + const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
933
934 setup_default_color_by_age();
935 git_config(git_blame_config, &output_option);
builtin/commit-graph.c
+2 -2
@@ -22,12 +22,12 @@
22 " [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]\n" \
23 " <split-options>")
24
25 -static const char * builtin_commit_graph_verify_usage[] = {
25 +static const char * const builtin_commit_graph_verify_usage[] = {
26 BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
27 NULL
28 };
29
30 -static const char * builtin_commit_graph_write_usage[] = {
30 +static const char * const builtin_commit_graph_write_usage[] = {
31 BUILTIN_COMMIT_GRAPH_WRITE_USAGE,
32 NULL
33 };
builtin/fast-export.c
+1 -1
@@ -30,7 +30,7 @@
30 #include "remote.h"
31 #include "blob.h"
32
33 -static const char *fast_export_usage[] = {
33 +static const char *const fast_export_usage[] = {
34 N_("git fast-export [<rev-list-opts>]"),
35 NULL
36 };
builtin/mktree.c
+1 -1
@@ -66,7 +66,7 @@ static void write_tree(struct object_id *oid)
66 strbuf_release(&buf);
67 }
68
69 -static const char *mktree_usage[] = {
69 +static const char *const mktree_usage[] = {
70 "git mktree [-z] [--missing] [--batch]",
71 NULL
72 };
builtin/pack-objects.c
+1 -1
@@ -183,7 +183,7 @@ static inline void oe_set_delta_size(struct packing_data *pack,
183 #define SET_DELTA_CHILD(obj, val) oe_set_delta_child(&to_pack, obj, val)
184 #define SET_DELTA_SIBLING(obj, val) oe_set_delta_sibling(&to_pack, obj, val)
185
186 -static const char *pack_usage[] = {
186 +static const char *const pack_usage[] = {
187 N_("git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"),
188 N_("git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"),
189 NULL
builtin/show-branch.c
+1 -1
@@ -19,7 +19,7 @@
19 #include "date.h"
20 #include "wildmatch.h"
21
22 -static const char* show_branch_usage[] = {
22 +static const char*const show_branch_usage[] = {
23 N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
24 " [--current] [--color[=<when>] | --no-color] [--sparse]\n"
25 " [--more=<n> | --list | --independent | --merge-base]\n"
t/helper/test-bloom.c
+1 -1
@@ -44,7 +44,7 @@ static void get_bloom_filter_for_commit(const struct object_id *commit_oid)
44 print_bloom_filter(filter);
45 }
46
47 -static const char *bloom_usage = "\n"
47 +static const char *const bloom_usage = "\n"
48 " test-tool bloom get_murmur3 <string>\n"
49 " test-tool bloom get_murmur3_seven_highbit\n"
50 " test-tool bloom generate_filter <string> [<string>...]\n"
t/helper/test-date.c
+1 -1
@@ -2,7 +2,7 @@
2 #include "date.h"
3 #include "trace.h"
4
5 -static const char *usage_msg = "\n"
5 +static const char *const usage_msg = "\n"
6 " test-tool date relative [time_t]...\n"
7 " test-tool date human [time_t]...\n"
8 " test-tool date show:<format> [time_t]...\n"
t/helper/test-find-pack.c
+1 -1
@@ -15,7 +15,7 @@
15 * packfiles containing the object is not <n>.
16 */
17
18 -static const char *find_pack_usage[] = {
18 +static const char *const find_pack_usage[] = {
19 "test-tool find-pack [--check-count <n>] <object>",
20 NULL
21 };
t/helper/test-getcwd.c
+1 -1
@@ -2,7 +2,7 @@
2 #include "git-compat-util.h"
3 #include "parse-options.h"
4
5 -static const char *getcwd_usage[] = {
5 +static const char *const getcwd_usage[] = {
6 "test-tool getcwd",
7 NULL
8 };
t/helper/test-pack-mtimes.c
+1 -1
@@ -24,7 +24,7 @@ static void dump_mtimes(struct packed_git *p)
24 }
25 }
26
27 -static const char *pack_mtimes_usage = "\n"
27 +static const char *const pack_mtimes_usage = "\n"
28 " test-tool pack-mtimes <pack-name.mtimes>";
29
30 int cmd__pack_mtimes(int argc, const char **argv)
t/helper/test-proc-receive.c
+1 -1
@@ -6,7 +6,7 @@
6 #include "sigchain.h"
7 #include "string-list.h"
8
9 -static const char *proc_receive_usage[] = {
9 +static const char *const proc_receive_usage[] = {
10 "test-tool proc-receive [<options>]",
11 NULL
12 };
t/helper/test-rot13-filter.c
+1 -1
@@ -324,7 +324,7 @@ static void packet_initialize(void)
324 packet_flush(1);
325 }
326
327 -static const char *rot13_usage[] = {
327 +static const char *const rot13_usage[] = {
328 "test-tool rot13-filter [--always-delay] --log=<path> <capabilities>",
329 NULL
330 };
t/helper/test-submodule.c
+5 -5
@@ -12,33 +12,33 @@
12
13 #define TEST_TOOL_CHECK_NAME_USAGE \
14 "test-tool submodule check-name"
15 -static const char *submodule_check_name_usage[] = {
15 +static const char *const submodule_check_name_usage[] = {
16 TEST_TOOL_CHECK_NAME_USAGE,
17 NULL
18 };
19
20 #define TEST_TOOL_CHECK_URL_USAGE \
21 "test-tool submodule check-url"
22 -static const char *submodule_check_url_usage[] = {
22 +static const char *const submodule_check_url_usage[] = {
23 TEST_TOOL_CHECK_URL_USAGE,
24 NULL
25 };
26
27 #define TEST_TOOL_IS_ACTIVE_USAGE \
28 "test-tool submodule is-active <name>"
29 -static const char *submodule_is_active_usage[] = {
29 +static const char *const submodule_is_active_usage[] = {
30 TEST_TOOL_IS_ACTIVE_USAGE,
31 NULL
32 };
33
34 #define TEST_TOOL_RESOLVE_RELATIVE_URL_USAGE \
35 "test-tool submodule resolve-relative-url <up_path> <remoteurl> <url>"
36 -static const char *submodule_resolve_relative_url_usage[] = {
36 +static const char *const submodule_resolve_relative_url_usage[] = {
37 TEST_TOOL_RESOLVE_RELATIVE_URL_USAGE,
38 NULL,
39 };
40
41 -static const char *submodule_usage[] = {
41 +static const char *const submodule_usage[] = {
42 TEST_TOOL_CHECK_NAME_USAGE,
43 TEST_TOOL_CHECK_URL_USAGE,
44 TEST_TOOL_IS_ACTIVE_USAGE,
t/helper/test-windows-named-pipe.c
+1 -1
@@ -3,7 +3,7 @@
3 #include "strbuf.h"
4
5 #ifdef GIT_WINDOWS_NATIVE
6 -static const char *usage_string = "<pipe-filename>";
6 +static const char *const usage_string = "<pipe-filename>";
7
8 #define TEST_BUFSIZE (4096)
9