diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-11-13 18:15:20 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-11-23 14:55:02 +0100 |
commit | a57dd3b7a46c9a2f87f203f1ab372fa28e10e571 (patch) | |
tree | ce76f383edaa14bee45a687453223613c1c1ee9c /src/refdb.c | |
parent | 110df89317b56267b956574216d6611637860446 (diff) | |
download | libgit2-a57dd3b7a46c9a2f87f203f1ab372fa28e10e571.tar.gz |
reflog: integrate into the ref writing
Whenever a reference is created or updated, we need to write to the
reflog regardless of whether the user gave us a message, so we shouldn't
leave that to the ref frontend, but integrate it into the backend.
This also eliminates the race between ref update and writing to the
reflog, as we protect the reflog with the ref lock.
As an additional benefit, this reflog append on the backend happens by
appending to the file instead of parsing and rewriting it.
Diffstat (limited to 'src/refdb.c')
-rw-r--r-- | src/refdb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/refdb.c b/src/refdb.c index 8f002ebcc..bc8c2b366 100644 --- a/src/refdb.c +++ b/src/refdb.c @@ -167,14 +167,14 @@ void git_refdb_iterator_free(git_reference_iterator *iter) iter->free(iter); } -int git_refdb_write(git_refdb *db, git_reference *ref, int force, const char *message) +int git_refdb_write(git_refdb *db, git_reference *ref, int force, const git_signature *who, const char *message) { assert(db && db->backend); GIT_REFCOUNT_INC(db); ref->db = db; - return db->backend->write(db->backend, ref, force, message); + return db->backend->write(db->backend, ref, force, who, message); } int git_refdb_rename( @@ -183,12 +183,13 @@ int git_refdb_rename( const char *old_name, const char *new_name, int force, + const git_signature *who, const char *message) { int error; assert(db && db->backend); - error = db->backend->rename(out, db->backend, old_name, new_name, force, message); + error = db->backend->rename(out, db->backend, old_name, new_name, force, who, message); if (error < 0) return error; |