| 75 | } |
| 76 | |
| 77 | static int list_replace_refs(const char *pattern, const char *format) |
| 78 | { |
| 79 | struct show_data data; |
| 80 | |
| 81 | data.repo = the_repository; |
| 82 | if (!pattern) |
| 83 | pattern = "*"; |
| 84 | data.pattern = pattern; |
| 85 | |
| 86 | if (format == NULL || *format == '\0' || !strcmp(format, "short")) |
| 87 | data.format = REPLACE_FORMAT_SHORT; |
| 88 | else if (!strcmp(format, "medium")) |
| 89 | data.format = REPLACE_FORMAT_MEDIUM; |
| 90 | else if (!strcmp(format, "long")) |
| 91 | data.format = REPLACE_FORMAT_LONG; |
| 92 | /* |
| 93 | * Please update _git_replace() in git-completion.bash when |
| 94 | * you add new format |
| 95 | */ |
| 96 | else |
| 97 | return error(_("invalid replace format '%s'\n" |
| 98 | "valid formats are 'short', 'medium' and 'long'"), |
| 99 | format); |
| 100 | |
| 101 | refs_for_each_replace_ref(get_main_ref_store(the_repository), |
| 102 | show_reference, (void *)&data); |
| 103 | |
| 104 | return 0; |
| 105 | } |
| 106 | |
| 107 | typedef int (*each_replace_name_fn)(const char *name, const char *ref, |
| 108 | const struct object_id *oid); |
no test coverage detected