| 639 | } |
| 640 | |
| 641 | static int s_update_ref(const char *action, |
| 642 | struct ref *ref, |
| 643 | struct ref_transaction *transaction, |
| 644 | int check_old) |
| 645 | { |
| 646 | char *msg; |
| 647 | char *rla = getenv("GIT_REFLOG_ACTION"); |
| 648 | struct strbuf err = STRBUF_INIT; |
| 649 | int ret; |
| 650 | |
| 651 | if (dry_run) |
| 652 | return 0; |
| 653 | if (!rla) |
| 654 | rla = default_rla.buf; |
| 655 | msg = xstrfmt("%s: %s", rla, action); |
| 656 | |
| 657 | ret = ref_transaction_update(transaction, ref->name, &ref->new_oid, |
| 658 | check_old ? &ref->old_oid : NULL, |
| 659 | NULL, NULL, 0, msg, &err); |
| 660 | |
| 661 | if (ret) |
| 662 | error("%s", err.buf); |
| 663 | strbuf_release(&err); |
| 664 | free(msg); |
| 665 | return ret; |
| 666 | } |
| 667 | |
| 668 | static int refcol_width(const struct ref *ref_map, int compact_format) |
| 669 | { |
no test coverage detected