| 2122 | #endif |
| 2123 | |
| 2124 | static int create_symref_lock(struct ref_lock *lock, const char *target, |
| 2125 | struct strbuf *err) |
| 2126 | { |
| 2127 | if (!fdopen_lock_file(&lock->lk, "w")) { |
| 2128 | strbuf_addf(err, "unable to fdopen %s: %s", |
| 2129 | get_lock_file_path(&lock->lk), strerror(errno)); |
| 2130 | return -1; |
| 2131 | } |
| 2132 | |
| 2133 | if (fprintf(get_lock_file_fp(&lock->lk), "ref: %s\n", target) < 0) { |
| 2134 | strbuf_addf(err, "unable to write to %s: %s", |
| 2135 | get_lock_file_path(&lock->lk), strerror(errno)); |
| 2136 | return -1; |
| 2137 | } |
| 2138 | |
| 2139 | return 0; |
| 2140 | } |
| 2141 | |
| 2142 | static int files_reflog_exists(struct ref_store *ref_store, |
| 2143 | const char *refname) |
no test coverage detected