Skip to content

Commit 5f3c3a4

Browse files
dturner-twpeff
authored andcommitted
files_log_ref_write: new function
Because HEAD and stash are per-worktree, every refs backend needs to go through the files backend to write these refs. So create a new function, files_log_ref_write, and add it to refs/refs-internal.h. Later, we will use this to handle reflog updates for per-worktree symbolic refs (HEAD). Signed-off-by: David Turner <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent eb33876 commit 5f3c3a4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

refs/files-backend.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,6 +2733,14 @@ static int log_ref_write_1(const char *refname, const unsigned char *old_sha1,
27332733
static int log_ref_write(const char *refname, const unsigned char *old_sha1,
27342734
const unsigned char *new_sha1, const char *msg,
27352735
int flags, struct strbuf *err)
2736+
{
2737+
return files_log_ref_write(refname, old_sha1, new_sha1, msg, flags,
2738+
err);
2739+
}
2740+
2741+
int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
2742+
const unsigned char *new_sha1, const char *msg,
2743+
int flags, struct strbuf *err)
27362744
{
27372745
struct strbuf sb = STRBUF_INIT;
27382746
int ret = log_ref_write_1(refname, old_sha1, new_sha1, msg, &sb, flags,

refs/refs-internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,8 @@ struct ref_transaction {
177177
enum ref_transaction_state state;
178178
};
179179

180+
int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
181+
const unsigned char *new_sha1, const char *msg,
182+
int flags, struct strbuf *err);
183+
180184
#endif /* REFS_REFS_INTERNAL_H */

0 commit comments

Comments
 (0)