| 126 | }; |
| 127 | |
| 128 | static int run_one_gc_recent_objects_hook(struct oidset *set, |
| 129 | const char *args) |
| 130 | { |
| 131 | struct child_process cmd = CHILD_PROCESS_INIT; |
| 132 | struct strbuf buf = STRBUF_INIT; |
| 133 | FILE *out; |
| 134 | int ret = 0; |
| 135 | |
| 136 | cmd.use_shell = 1; |
| 137 | cmd.out = -1; |
| 138 | |
| 139 | strvec_push(&cmd.args, args); |
| 140 | |
| 141 | if (start_command(&cmd)) |
| 142 | return -1; |
| 143 | |
| 144 | out = xfdopen(cmd.out, "r"); |
| 145 | while (strbuf_getline(&buf, out) != EOF) { |
| 146 | struct object_id oid; |
| 147 | const char *rest; |
| 148 | |
| 149 | if (parse_oid_hex(buf.buf, &oid, &rest) || *rest) { |
| 150 | ret = error(_("invalid extra cruft tip: '%s'"), buf.buf); |
| 151 | break; |
| 152 | } |
| 153 | |
| 154 | oidset_insert(set, &oid); |
| 155 | } |
| 156 | |
| 157 | fclose(out); |
| 158 | ret |= finish_command(&cmd); |
| 159 | |
| 160 | strbuf_release(&buf); |
| 161 | return ret; |
| 162 | } |
| 163 | |
| 164 | static void load_gc_recent_objects(struct recent_data *data) |
| 165 | { |
no test coverage detected