| 3166 | } |
| 3167 | |
| 3168 | static int read_trailers(struct replay_opts *opts, struct strbuf *buf) |
| 3169 | { |
| 3170 | ssize_t len; |
| 3171 | |
| 3172 | strbuf_reset(buf); |
| 3173 | len = strbuf_read_file(buf, rebase_path_trailer(), 0); |
| 3174 | if (len > 0) { |
| 3175 | char *p = buf->buf, *nl; |
| 3176 | |
| 3177 | trailer_config_init(); |
| 3178 | |
| 3179 | while ((nl = strchr(p, '\n'))) { |
| 3180 | *nl = '\0'; |
| 3181 | if (!*p) |
| 3182 | return error(_("trailers file contains empty line")); |
| 3183 | strvec_push(&opts->trailer_args, p); |
| 3184 | p = nl + 1; |
| 3185 | } |
| 3186 | } else if (!len) { |
| 3187 | return error(_("trailers file is empty")); |
| 3188 | } else if (errno != ENOENT) { |
| 3189 | return error(_("cannot read trailers files")); |
| 3190 | } |
| 3191 | |
| 3192 | return 0; |
| 3193 | } |
| 3194 | |
| 3195 | static int read_populate_opts(struct replay_opts *opts) |
| 3196 | { |
no test coverage detected