MCPcopy Create free account
hub / github.com/git/git / create_symref_lock

Function create_symref_lock

refs/files-backend.c:2124–2140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2122#endif
2123
2124static 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
2142static int files_reflog_exists(struct ref_store *ref_store,
2143 const char *refname)

Callers 1

lock_ref_for_updateFunction · 0.85

Calls 4

fdopen_lock_fileFunction · 0.85
strbuf_addfFunction · 0.85
get_lock_file_pathFunction · 0.85
get_lock_file_fpFunction · 0.85

Tested by

no test coverage detected