Skip to content

Commit

Permalink
files_log_ref_write: new function
Browse files Browse the repository at this point in the history
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 <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
  • Loading branch information
David Turner authored and Jeff King committed Nov 20, 2015
1 parent eb33876 commit 5f3c3a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions refs/files-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -2733,6 +2733,14 @@ static int log_ref_write_1(const char *refname, const unsigned char *old_sha1,
static int log_ref_write(const char *refname, const unsigned char *old_sha1,
const unsigned char *new_sha1, const char *msg,
int flags, struct strbuf *err)
{
return files_log_ref_write(refname, old_sha1, new_sha1, msg, flags,
err);
}

int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
const unsigned char *new_sha1, const char *msg,
int flags, struct strbuf *err)
{
struct strbuf sb = STRBUF_INIT;
int ret = log_ref_write_1(refname, old_sha1, new_sha1, msg, &sb, flags,
Expand Down
4 changes: 4 additions & 0 deletions refs/refs-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,8 @@ struct ref_transaction {
enum ref_transaction_state state;
};

int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
const unsigned char *new_sha1, const char *msg,
int flags, struct strbuf *err);

#endif /* REFS_REFS_INTERNAL_H */

0 comments on commit 5f3c3a4

Please sign in to comment.