1 #define USE_THE_REPOSITORY_VARIABLE
3 #include "git-compat-util.h"
7 #include "run-command.h"
8 #include "levenshtein.h"
11 #include "command-list.h"
12 #include "string-list.h"
16 #include "parse-options.h"
18 #include "fsmonitor-ipc.h"
21 #include "git-curl-compat.h" /* For LIBCURL_VERSION only */
24 struct category_description
{
28 static uint32_t common_mask
=
29 CAT_init
| CAT_worktree
| CAT_info
|
30 CAT_history
| CAT_remote
;
31 static struct category_description common_categories
[] = {
32 { CAT_init
, N_("start a working area (see also: git help tutorial)") },
33 { CAT_worktree
, N_("work on the current change (see also: git help everyday)") },
34 { CAT_info
, N_("examine the history and state (see also: git help revisions)") },
35 { CAT_history
, N_("grow, mark and tweak your common history") },
36 { CAT_remote
, N_("collaborate (see also: git help workflows)") },
39 static struct category_description main_categories
[] = {
40 { CAT_mainporcelain
, N_("Main Porcelain Commands") },
41 { CAT_ancillarymanipulators
, N_("Ancillary Commands / Manipulators") },
42 { CAT_ancillaryinterrogators
, N_("Ancillary Commands / Interrogators") },
43 { CAT_foreignscminterface
, N_("Interacting with Others") },
44 { CAT_plumbingmanipulators
, N_("Low-level Commands / Manipulators") },
45 { CAT_plumbinginterrogators
, N_("Low-level Commands / Interrogators") },
46 { CAT_synchingrepositories
, N_("Low-level Commands / Syncing Repositories") },
47 { CAT_purehelpers
, N_("Low-level Commands / Internal Helpers") },
48 { CAT_userinterfaces
, N_("User-facing repository, command and file interfaces") },
49 { CAT_developerinterfaces
, N_("Developer-facing file formats, protocols and other interfaces") },
53 static const char *drop_prefix(const char *name
, uint32_t category
)
60 case CAT_userinterfaces
:
61 case CAT_developerinterfaces
:
68 if (skip_prefix(name
, prefix
, &new_name
))
74 static void extract_cmds(struct cmdname_help
**p_cmds
, uint32_t mask
)
77 struct cmdname_help
*cmds
;
79 if (ARRAY_SIZE(command_list
) == 0)
80 BUG("empty command_list[] is a sign of broken generate-cmdlist.sh");
82 ALLOC_ARRAY(cmds
, ARRAY_SIZE(command_list
) + 1);
84 for (i
= 0; i
< ARRAY_SIZE(command_list
); i
++) {
85 const struct cmdname_help
*cmd
= command_list
+ i
;
87 if (!(cmd
->category
& mask
))
91 cmds
[nr
].name
= drop_prefix(cmd
->name
, cmd
->category
);
99 static void print_command_list(const struct cmdname_help
*cmds
,
100 uint32_t mask
, int longest
)
104 for (i
= 0; cmds
[i
].name
; i
++) {
105 if (cmds
[i
].category
& mask
) {
106 size_t len
= strlen(cmds
[i
].name
);
107 printf(" %s ", cmds
[i
].name
);
109 mput_char(' ', longest
- len
);
110 puts(_(cmds
[i
].help
));
115 static int cmd_name_cmp(const void *elem1
, const void *elem2
)
117 const struct cmdname_help
*e1
= elem1
;
118 const struct cmdname_help
*e2
= elem2
;
120 return strcmp(e1
->name
, e2
->name
);
123 static void print_cmd_by_category(const struct category_description
*catdesc
,
126 struct cmdname_help
*cmds
;
131 for (i
= 0; catdesc
[i
].desc
; i
++)
132 mask
|= catdesc
[i
].category
;
134 extract_cmds(&cmds
, mask
);
136 for (i
= 0; cmds
[i
].name
; i
++, nr
++) {
137 if (longest
< strlen(cmds
[i
].name
))
138 longest
= strlen(cmds
[i
].name
);
140 QSORT(cmds
, nr
, cmd_name_cmp
);
142 for (i
= 0; catdesc
[i
].desc
; i
++) {
143 uint32_t mask
= catdesc
[i
].category
;
144 const char *desc
= catdesc
[i
].desc
;
149 print_command_list(cmds
, mask
, longest
);
153 *longest_p
= longest
;
156 void add_cmdname(struct cmdnames
*cmds
, const char *name
, int len
)
159 FLEX_ALLOC_MEM(ent
, name
, name
, len
);
162 ALLOC_GROW(cmds
->names
, cmds
->cnt
+ 1, cmds
->alloc
);
163 cmds
->names
[cmds
->cnt
++] = ent
;
166 void cmdnames_release(struct cmdnames
*cmds
)
169 for (i
= 0; i
< cmds
->cnt
; ++i
)
170 free(cmds
->names
[i
]);
176 static int cmdname_compare(const void *a_
, const void *b_
)
178 struct cmdname
*a
= *(struct cmdname
**)a_
;
179 struct cmdname
*b
= *(struct cmdname
**)b_
;
180 return strcmp(a
->name
, b
->name
);
183 static void uniq(struct cmdnames
*cmds
)
190 for (i
= j
= 1; i
< cmds
->cnt
; i
++) {
191 if (!strcmp(cmds
->names
[i
]->name
, cmds
->names
[j
-1]->name
))
192 free(cmds
->names
[i
]);
194 cmds
->names
[j
++] = cmds
->names
[i
];
200 void exclude_cmds(struct cmdnames
*cmds
, struct cmdnames
*excludes
)
206 while (ci
< cmds
->cnt
&& ei
< excludes
->cnt
) {
207 cmp
= strcmp(cmds
->names
[ci
]->name
, excludes
->names
[ei
]->name
);
209 cmds
->names
[cj
++] = cmds
->names
[ci
++];
212 free(cmds
->names
[ci
++]);
217 while (ci
< cmds
->cnt
)
218 cmds
->names
[cj
++] = cmds
->names
[ci
++];
223 static void pretty_print_cmdnames(struct cmdnames
*cmds
, unsigned int colopts
)
225 struct string_list list
= STRING_LIST_INIT_NODUP
;
226 struct column_options copts
;
229 for (i
= 0; i
< cmds
->cnt
; i
++)
230 string_list_append(&list
, cmds
->names
[i
]->name
);
232 * always enable column display, we only consult column.*
233 * about layout strategy and stuff
235 colopts
= (colopts
& ~COL_ENABLE_MASK
) | COL_ENABLED
;
236 memset(&copts
, 0, sizeof(copts
));
239 print_columns(&list
, colopts
, &copts
);
240 string_list_clear(&list
, 0);
243 static void list_commands_in_dir(struct cmdnames
*cmds
,
247 DIR *dir
= opendir(path
);
249 struct strbuf buf
= STRBUF_INIT
;
257 strbuf_addf(&buf
, "%s/", path
);
260 while ((de
= readdir(dir
)) != NULL
) {
264 if (!skip_prefix(de
->d_name
, prefix
, &ent
))
267 strbuf_setlen(&buf
, len
);
268 strbuf_addstr(&buf
, de
->d_name
);
269 if (!is_executable(buf
.buf
))
272 entlen
= strlen(ent
);
273 strip_suffix(ent
, ".exe", &entlen
);
275 add_cmdname(cmds
, ent
, entlen
);
278 strbuf_release(&buf
);
281 void load_command_list(const char *prefix
,
282 struct cmdnames
*main_cmds
,
283 struct cmdnames
*other_cmds
)
285 const char *env_path
= getenv("PATH");
286 const char *exec_path
= git_exec_path();
288 load_builtin_commands(prefix
, main_cmds
);
291 list_commands_in_dir(main_cmds
, exec_path
, prefix
);
292 QSORT(main_cmds
->names
, main_cmds
->cnt
, cmdname_compare
);
297 char *paths
, *path
, *colon
;
298 path
= paths
= xstrdup(env_path
);
300 if ((colon
= strchr(path
, PATH_SEP
)))
302 if (!exec_path
|| strcmp(path
, exec_path
))
303 list_commands_in_dir(other_cmds
, path
, prefix
);
311 QSORT(other_cmds
->names
, other_cmds
->cnt
, cmdname_compare
);
314 exclude_cmds(other_cmds
, main_cmds
);
317 static int get_colopts(const char *var
, const char *value
,
318 const struct config_context
*ctx UNUSED
, void *data
)
320 unsigned int *colopts
= data
;
322 if (starts_with(var
, "column."))
323 return git_column_config(var
, value
, "help", colopts
);
328 void list_commands(struct cmdnames
*main_cmds
, struct cmdnames
*other_cmds
)
330 unsigned int colopts
= 0;
331 git_config(get_colopts
, &colopts
);
333 if (main_cmds
->cnt
) {
334 const char *exec_path
= git_exec_path();
335 printf_ln(_("available git commands in '%s'"), exec_path
);
337 pretty_print_cmdnames(main_cmds
, colopts
);
341 if (other_cmds
->cnt
) {
342 puts(_("git commands available from elsewhere on your $PATH"));
344 pretty_print_cmdnames(other_cmds
, colopts
);
349 void list_common_cmds_help(void)
351 puts(_("These are common Git commands used in various situations:"));
353 print_cmd_by_category(common_categories
, NULL
);
356 void list_all_main_cmds(struct string_list
*list
)
358 struct cmdnames main_cmds
, other_cmds
;
361 memset(&main_cmds
, 0, sizeof(main_cmds
));
362 memset(&other_cmds
, 0, sizeof(other_cmds
));
363 load_command_list("git-", &main_cmds
, &other_cmds
);
365 for (i
= 0; i
< main_cmds
.cnt
; i
++)
366 string_list_append(list
, main_cmds
.names
[i
]->name
);
368 cmdnames_release(&main_cmds
);
369 cmdnames_release(&other_cmds
);
372 void list_all_other_cmds(struct string_list
*list
)
374 struct cmdnames main_cmds
, other_cmds
;
377 memset(&main_cmds
, 0, sizeof(main_cmds
));
378 memset(&other_cmds
, 0, sizeof(other_cmds
));
379 load_command_list("git-", &main_cmds
, &other_cmds
);
381 for (i
= 0; i
< other_cmds
.cnt
; i
++)
382 string_list_append(list
, other_cmds
.names
[i
]->name
);
384 cmdnames_release(&main_cmds
);
385 cmdnames_release(&other_cmds
);
388 void list_cmds_by_category(struct string_list
*list
,
391 int i
, n
= ARRAY_SIZE(command_list
);
394 for (i
= 0; category_names
[i
]; i
++) {
395 if (!strcmp(cat
, category_names
[i
])) {
401 die(_("unsupported command listing type '%s'"), cat
);
403 for (i
= 0; i
< n
; i
++) {
404 struct cmdname_help
*cmd
= command_list
+ i
;
406 if (!(cmd
->category
& cat_id
))
408 string_list_append(list
, drop_prefix(cmd
->name
, cmd
->category
));
412 void list_cmds_by_config(struct string_list
*list
)
414 const char *cmd_list
;
416 if (git_config_get_string_tmp("completion.commands", &cmd_list
))
419 string_list_sort(list
);
420 string_list_remove_duplicates(list
, 0);
423 struct strbuf sb
= STRBUF_INIT
;
424 const char *p
= strchrnul(cmd_list
, ' ');
426 strbuf_add(&sb
, cmd_list
, p
- cmd_list
);
427 if (sb
.buf
[0] == '-')
428 string_list_remove(list
, sb
.buf
+ 1, 0);
430 string_list_insert(list
, sb
.buf
);
438 void list_guides_help(void)
440 struct category_description catdesc
[] = {
441 { CAT_guide
, N_("The Git concept guides are:") },
444 print_cmd_by_category(catdesc
, NULL
);
448 void list_user_interfaces_help(void)
450 struct category_description catdesc
[] = {
451 { CAT_userinterfaces
, N_("User-facing repository, command and file interfaces:") },
454 print_cmd_by_category(catdesc
, NULL
);
458 void list_developer_interfaces_help(void)
460 struct category_description catdesc
[] = {
461 { CAT_developerinterfaces
, N_("File formats, protocols and other developer interfaces:") },
464 print_cmd_by_category(catdesc
, NULL
);
468 static int get_alias(const char *var
, const char *value
,
469 const struct config_context
*ctx UNUSED
, void *data
)
471 struct string_list
*list
= data
;
473 if (skip_prefix(var
, "alias.", &var
)) {
475 return config_error_nonbool(var
);
476 string_list_append(list
, var
)->util
= xstrdup(value
);
482 static void list_all_cmds_help_external_commands(void)
484 struct string_list others
= STRING_LIST_INIT_DUP
;
487 list_all_other_cmds(&others
);
489 printf("\n%s\n", _("External commands"));
490 for (i
= 0; i
< others
.nr
; i
++)
491 printf(" %s\n", others
.items
[i
].string
);
492 string_list_clear(&others
, 0);
495 static void list_all_cmds_help_aliases(int longest
)
497 struct string_list alias_list
= STRING_LIST_INIT_DUP
;
498 struct cmdname_help
*aliases
;
501 git_config(get_alias
, &alias_list
);
502 string_list_sort(&alias_list
);
504 for (i
= 0; i
< alias_list
.nr
; i
++) {
505 size_t len
= strlen(alias_list
.items
[i
].string
);
511 printf("\n%s\n", _("Command aliases"));
512 ALLOC_ARRAY(aliases
, alias_list
.nr
+ 1);
513 for (i
= 0; i
< alias_list
.nr
; i
++) {
514 aliases
[i
].name
= alias_list
.items
[i
].string
;
515 aliases
[i
].help
= alias_list
.items
[i
].util
;
516 aliases
[i
].category
= 1;
518 aliases
[alias_list
.nr
].name
= NULL
;
519 print_command_list(aliases
, 1, longest
);
522 string_list_clear(&alias_list
, 1);
525 void list_all_cmds_help(int show_external_commands
, int show_aliases
)
529 puts(_("See 'git help <command>' to read about a specific subcommand"));
531 print_cmd_by_category(main_categories
, &longest
);
533 if (show_external_commands
)
534 list_all_cmds_help_external_commands();
536 list_all_cmds_help_aliases(longest
);
539 int is_in_cmdlist(struct cmdnames
*c
, const char *s
)
542 for (i
= 0; i
< c
->cnt
; i
++)
543 if (!strcmp(s
, c
->names
[i
]->name
))
548 static int autocorrect
;
549 static struct cmdnames aliases
;
551 #define AUTOCORRECT_PROMPT (-3)
552 #define AUTOCORRECT_NEVER (-2)
553 #define AUTOCORRECT_IMMEDIATELY (-1)
555 static int git_unknown_cmd_config(const char *var
, const char *value
,
556 const struct config_context
*ctx
,
561 if (!strcmp(var
, "help.autocorrect")) {
563 return config_error_nonbool(var
);
564 if (!strcmp(value
, "never")) {
565 autocorrect
= AUTOCORRECT_NEVER
;
566 } else if (!strcmp(value
, "immediate")) {
567 autocorrect
= AUTOCORRECT_IMMEDIATELY
;
568 } else if (!strcmp(value
, "prompt")) {
569 autocorrect
= AUTOCORRECT_PROMPT
;
571 int v
= git_config_int(var
, value
, ctx
->kvi
);
572 autocorrect
= (v
< 0)
573 ? AUTOCORRECT_IMMEDIATELY
: v
;
576 /* Also use aliases for command lookup */
577 if (skip_prefix(var
, "alias.", &p
))
578 add_cmdname(&aliases
, p
, strlen(p
));
583 static int levenshtein_compare(const void *p1
, const void *p2
)
585 const struct cmdname
*const *c1
= p1
, *const *c2
= p2
;
586 const char *s1
= (*c1
)->name
, *s2
= (*c2
)->name
;
589 return l1
!= l2
? l1
- l2
: strcmp(s1
, s2
);
592 static void add_cmd_list(struct cmdnames
*cmds
, struct cmdnames
*old
)
595 ALLOC_GROW(cmds
->names
, cmds
->cnt
+ old
->cnt
, cmds
->alloc
);
597 for (i
= 0; i
< old
->cnt
; i
++)
598 cmds
->names
[cmds
->cnt
++] = old
->names
[i
];
599 FREE_AND_NULL(old
->names
);
603 /* An empirically derived magic number */
604 #define SIMILARITY_FLOOR 7
605 #define SIMILAR_ENOUGH(x) ((x) < SIMILARITY_FLOOR)
607 static const char bad_interpreter_advice
[] =
608 N_("'%s' appears to be a git command, but we were not\n"
609 "able to execute it. Maybe git-%s is broken?");
611 const char *help_unknown_cmd(const char *cmd
)
613 int i
, n
, best_similarity
= 0;
614 struct cmdnames main_cmds
, other_cmds
;
615 struct cmdname_help
*common_cmds
;
617 memset(&main_cmds
, 0, sizeof(main_cmds
));
618 memset(&other_cmds
, 0, sizeof(other_cmds
));
619 memset(&aliases
, 0, sizeof(aliases
));
621 read_early_config(the_repository
, git_unknown_cmd_config
, NULL
);
624 * Disable autocorrection prompt in a non-interactive session
626 if ((autocorrect
== AUTOCORRECT_PROMPT
) && (!isatty(0) || !isatty(2)))
627 autocorrect
= AUTOCORRECT_NEVER
;
629 if (autocorrect
== AUTOCORRECT_NEVER
) {
630 fprintf_ln(stderr
, _("git: '%s' is not a git command. See 'git --help'."), cmd
);
634 load_command_list("git-", &main_cmds
, &other_cmds
);
636 add_cmd_list(&main_cmds
, &aliases
);
637 add_cmd_list(&main_cmds
, &other_cmds
);
638 QSORT(main_cmds
.names
, main_cmds
.cnt
, cmdname_compare
);
641 extract_cmds(&common_cmds
, common_mask
);
643 /* This abuses cmdname->len for levenshtein distance */
644 for (i
= 0, n
= 0; i
< main_cmds
.cnt
; i
++) {
645 int cmp
= 0; /* avoid compiler stupidity */
646 const char *candidate
= main_cmds
.names
[i
]->name
;
649 * An exact match means we have the command, but
650 * for some reason exec'ing it gave us ENOENT; probably
651 * it's a bad interpreter in the #! line.
653 if (!strcmp(candidate
, cmd
))
654 die(_(bad_interpreter_advice
), cmd
, cmd
);
656 /* Does the candidate appear in common_cmds list? */
657 while (common_cmds
[n
].name
&&
658 (cmp
= strcmp(common_cmds
[n
].name
, candidate
)) < 0)
660 if (common_cmds
[n
].name
&& !cmp
) {
661 /* Yes, this is one of the common commands */
662 n
++; /* use the entry from common_cmds[] */
663 if (starts_with(candidate
, cmd
)) {
664 /* Give prefix match a very good score */
665 main_cmds
.names
[i
]->len
= 0;
670 main_cmds
.names
[i
]->len
=
671 levenshtein(cmd
, candidate
, 0, 2, 1, 3) + 1;
673 FREE_AND_NULL(common_cmds
);
675 QSORT(main_cmds
.names
, main_cmds
.cnt
, levenshtein_compare
);
678 die(_("Uh oh. Your system reports no Git commands at all."));
680 /* skip and count prefix matches */
681 for (n
= 0; n
< main_cmds
.cnt
&& !main_cmds
.names
[n
]->len
; n
++)
682 ; /* still counting */
684 if (main_cmds
.cnt
<= n
) {
685 /* prefix matches with everything? that is too ambiguous */
686 best_similarity
= SIMILARITY_FLOOR
+ 1;
688 /* count all the most similar ones */
689 for (best_similarity
= main_cmds
.names
[n
++]->len
;
690 (n
< main_cmds
.cnt
&&
691 best_similarity
== main_cmds
.names
[n
]->len
);
693 ; /* still counting */
695 if (autocorrect
&& n
== 1 && SIMILAR_ENOUGH(best_similarity
)) {
696 const char *assumed
= main_cmds
.names
[0]->name
;
697 main_cmds
.names
[0] = NULL
;
698 cmdnames_release(&main_cmds
);
700 _("WARNING: You called a Git command named '%s', "
701 "which does not exist."),
703 if (autocorrect
== AUTOCORRECT_IMMEDIATELY
)
705 _("Continuing under the assumption that "
708 else if (autocorrect
== AUTOCORRECT_PROMPT
) {
710 struct strbuf msg
= STRBUF_INIT
;
711 strbuf_addf(&msg
, _("Run '%s' instead [y/N]? "), assumed
);
712 answer
= git_prompt(msg
.buf
, PROMPT_ECHO
);
713 strbuf_release(&msg
);
714 if (!(starts_with(answer
, "y") ||
715 starts_with(answer
, "Y")))
719 _("Continuing in %0.1f seconds, "
720 "assuming that you meant '%s'."),
721 (float)autocorrect
/10.0, assumed
);
722 sleep_millisec(autocorrect
* 100);
727 fprintf_ln(stderr
, _("git: '%s' is not a git command. See 'git --help'."), cmd
);
729 if (SIMILAR_ENOUGH(best_similarity
)) {
731 Q_("\nThe most similar command is",
732 "\nThe most similar commands are",
735 for (i
= 0; i
< n
; i
++)
736 fprintf(stderr
, "\t%s\n", main_cmds
.names
[i
]->name
);
742 void get_version_info(struct strbuf
*buf
, int show_build_options
)
745 * The format of this string should be kept stable for compatibility
746 * with external projects that rely on the output of "git version".
748 * Always show the version, even if other options are given.
750 strbuf_addf(buf
, "git version %s\n", git_version_string
);
752 if (show_build_options
) {
753 strbuf_addf(buf
, "cpu: %s\n", GIT_HOST_CPU
);
754 if (git_built_from_commit_string
[0])
755 strbuf_addf(buf
, "built from commit: %s\n",
756 git_built_from_commit_string
);
758 strbuf_addstr(buf
, "no commit associated with this build\n");
759 strbuf_addf(buf
, "sizeof-long: %d\n", (int)sizeof(long));
760 strbuf_addf(buf
, "sizeof-size_t: %d\n", (int)sizeof(size_t));
761 strbuf_addf(buf
, "shell-path: %s\n", SHELL_PATH
);
762 /* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
764 if (fsmonitor_ipc__is_supported())
765 strbuf_addstr(buf
, "feature: fsmonitor--daemon\n");
766 #if defined LIBCURL_VERSION
767 strbuf_addf(buf
, "libcurl: %s\n", LIBCURL_VERSION
);
769 #if defined OPENSSL_VERSION_TEXT
770 strbuf_addf(buf
, "OpenSSL: %s\n", OPENSSL_VERSION_TEXT
);
772 #if defined ZLIB_VERSION
773 strbuf_addf(buf
, "zlib: %s\n", ZLIB_VERSION
);
778 int cmd_version(int argc
, const char **argv
, const char *prefix
)
780 struct strbuf buf
= STRBUF_INIT
;
781 int build_options
= 0;
782 const char * const usage
[] = {
783 N_("git version [--build-options]"),
786 struct option options
[] = {
787 OPT_BOOL(0, "build-options", &build_options
,
788 "also print build options"),
792 argc
= parse_options(argc
, argv
, prefix
, options
, usage
, 0);
794 get_version_info(&buf
, build_options
);
795 printf("%s", buf
.buf
);
797 strbuf_release(&buf
);
802 struct similar_ref_cb
{
803 const char *base_ref
;
804 struct string_list
*similar_refs
;
807 static int append_similar_ref(const char *refname
, const char *referent UNUSED
,
808 const struct object_id
*oid UNUSED
,
809 int flags UNUSED
, void *cb_data
)
811 struct similar_ref_cb
*cb
= (struct similar_ref_cb
*)(cb_data
);
812 char *branch
= strrchr(refname
, '/') + 1;
814 /* A remote branch of the same name is deemed similar */
815 if (starts_with(refname
, "refs/remotes/") &&
816 !strcmp(branch
, cb
->base_ref
))
817 string_list_append_nodup(cb
->similar_refs
,
818 refs_shorten_unambiguous_ref(get_main_ref_store(the_repository
), refname
, 1));
822 static struct string_list
guess_refs(const char *ref
)
824 struct similar_ref_cb ref_cb
;
825 struct string_list similar_refs
= STRING_LIST_INIT_DUP
;
827 ref_cb
.base_ref
= ref
;
828 ref_cb
.similar_refs
= &similar_refs
;
829 refs_for_each_ref(get_main_ref_store(the_repository
),
830 append_similar_ref
, &ref_cb
);
834 NORETURN
void help_unknown_ref(const char *ref
, const char *cmd
,
838 struct string_list suggested_refs
= guess_refs(ref
);
840 fprintf_ln(stderr
, _("%s: %s - %s"), cmd
, ref
, error
);
842 if (suggested_refs
.nr
> 0) {
844 Q_("\nDid you mean this?",
845 "\nDid you mean one of these?",
847 for (i
= 0; i
< suggested_refs
.nr
; i
++)
848 fprintf(stderr
, "\t%s\n", suggested_refs
.items
[i
].string
);
851 string_list_clear(&suggested_refs
, 0);