| 4819 | } |
| 4820 | |
| 4821 | static int apply_save_autostash_ref(struct repository *r, const char *refname, |
| 4822 | int attempt_apply, |
| 4823 | const char *label_ours, const char *label_theirs, |
| 4824 | const char *label_base, |
| 4825 | const char *stash_msg) |
| 4826 | { |
| 4827 | struct object_id stash_oid; |
| 4828 | char stash_oid_hex[GIT_MAX_HEXSZ + 1]; |
| 4829 | int flag, ret; |
| 4830 | |
| 4831 | if (!refs_ref_exists(get_main_ref_store(r), refname)) |
| 4832 | return 0; |
| 4833 | |
| 4834 | if (!refs_resolve_ref_unsafe(get_main_ref_store(r), refname, |
| 4835 | RESOLVE_REF_READING, &stash_oid, &flag)) |
| 4836 | return -1; |
| 4837 | if (flag & REF_ISSYMREF) |
| 4838 | return error(_("autostash reference is a symref")); |
| 4839 | |
| 4840 | oid_to_hex_r(stash_oid_hex, &stash_oid); |
| 4841 | ret = apply_save_autostash_oid(stash_oid_hex, attempt_apply, |
| 4842 | label_ours, label_theirs, label_base, |
| 4843 | stash_msg); |
| 4844 | |
| 4845 | refs_delete_ref(get_main_ref_store(r), "", refname, |
| 4846 | &stash_oid, REF_NO_DEREF); |
| 4847 | |
| 4848 | return ret; |
| 4849 | } |
| 4850 | |
| 4851 | int save_autostash_ref(struct repository *r, const char *refname) |
| 4852 | { |
no test coverage detected