| 302 | */ |
| 303 | |
| 304 | static void parse_cmd_update(struct ref_transaction *transaction, |
| 305 | const char *next, const char *end, |
| 306 | struct command_options *opts) |
| 307 | { |
| 308 | struct strbuf err = STRBUF_INIT; |
| 309 | char *refname; |
| 310 | struct object_id new_oid, old_oid; |
| 311 | enum ref_transaction_error tx_err; |
| 312 | int have_old; |
| 313 | |
| 314 | refname = parse_refname(&next); |
| 315 | if (!refname) |
| 316 | die("update: missing <ref>"); |
| 317 | |
| 318 | if (parse_next_oid(&next, end, &new_oid, "update", refname, |
| 319 | PARSE_SHA1_ALLOW_EMPTY)) |
| 320 | die("update %s: missing <new-oid>", refname); |
| 321 | |
| 322 | have_old = !parse_next_oid(&next, end, &old_oid, "update", refname, |
| 323 | PARSE_SHA1_OLD); |
| 324 | |
| 325 | if (*next != line_termination) |
| 326 | die("update %s: extra input: %s", refname, next); |
| 327 | |
| 328 | tx_err = ref_transaction_update(transaction, refname, |
| 329 | &new_oid, have_old ? &old_oid : NULL, |
| 330 | NULL, NULL, |
| 331 | update_flags | create_reflog_flag, |
| 332 | msg, &err); |
| 333 | handle_ref_transaction_error(refname, &new_oid, have_old ? &old_oid : NULL, |
| 334 | NULL, NULL, tx_err, &err, opts); |
| 335 | |
| 336 | |
| 337 | update_flags = default_flags; |
| 338 | free(refname); |
| 339 | strbuf_release(&err); |
| 340 | } |
| 341 | |
| 342 | static void parse_cmd_symref_update(struct ref_transaction *transaction, |
| 343 | const char *next, const char *end UNUSED, |
nothing calls this directly
no test coverage detected