| 240 | } |
| 241 | |
| 242 | int bundle_uri_parse_config_format(const char *uri, |
| 243 | const char *filename, |
| 244 | struct bundle_list *list) |
| 245 | { |
| 246 | int result; |
| 247 | struct config_options opts = { |
| 248 | .error_action = CONFIG_ERROR_ERROR, |
| 249 | }; |
| 250 | |
| 251 | if (!list->baseURI) { |
| 252 | struct strbuf baseURI = STRBUF_INIT; |
| 253 | strbuf_addstr(&baseURI, uri); |
| 254 | |
| 255 | /* |
| 256 | * If the URI does not end with a trailing slash, then |
| 257 | * remove the filename portion of the path. This is |
| 258 | * important for relative URIs. |
| 259 | */ |
| 260 | strbuf_strip_file_from_path(&baseURI); |
| 261 | list->baseURI = strbuf_detach(&baseURI, NULL); |
| 262 | } |
| 263 | result = git_config_from_file_with_options(config_to_bundle_list, |
| 264 | filename, list, |
| 265 | CONFIG_SCOPE_UNKNOWN, |
| 266 | &opts); |
| 267 | |
| 268 | if (!result && list->mode == BUNDLE_MODE_NONE) { |
| 269 | warning(_("bundle list at '%s' has no mode"), uri); |
| 270 | result = 1; |
| 271 | } |
| 272 | |
| 273 | if (!result) { |
| 274 | struct hashmap_iter iter; |
| 275 | struct remote_bundle_info *bundle; |
| 276 | |
| 277 | hashmap_for_each_entry(&list->bundles, &iter, bundle, ent) { |
| 278 | if (!bundle->uri) { |
| 279 | error(_("bundle list at '%s': bundle '%s' has no uri"), |
| 280 | uri, bundle->id ? bundle->id : "<unknown>"); |
| 281 | result = 1; |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | return result; |
| 287 | } |
| 288 | |
| 289 | static char *find_temp_filename(void) |
| 290 | { |