| 908 | } |
| 909 | |
| 910 | static void report_pack_garbage(struct string_list *list) |
| 911 | { |
| 912 | int i, baselen = -1, first = 0, seen_bits = 0; |
| 913 | |
| 914 | if (!report_garbage) |
| 915 | return; |
| 916 | |
| 917 | string_list_sort(list); |
| 918 | |
| 919 | for (i = 0; i < list->nr; i++) { |
| 920 | const char *path = list->items[i].string; |
| 921 | if (baselen != -1 && |
| 922 | strncmp(path, list->items[first].string, baselen)) { |
| 923 | report_helper(list, seen_bits, first, i); |
| 924 | baselen = -1; |
| 925 | seen_bits = 0; |
| 926 | } |
| 927 | if (baselen == -1) { |
| 928 | const char *dot = strrchr(path, '.'); |
| 929 | if (!dot) { |
| 930 | report_garbage(PACKDIR_FILE_GARBAGE, path); |
| 931 | continue; |
| 932 | } |
| 933 | baselen = dot - path + 1; |
| 934 | first = i; |
| 935 | } |
| 936 | if (!strcmp(path + baselen, "pack")) |
| 937 | seen_bits |= 1; |
| 938 | else if (!strcmp(path + baselen, "idx")) |
| 939 | seen_bits |= 2; |
| 940 | } |
| 941 | report_helper(list, seen_bits, first, list->nr); |
| 942 | } |
| 943 | |
| 944 | void for_each_file_in_pack_subdir(const char *objdir, |
| 945 | const char *subdir, |
no test coverage detected