diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-19 13:01:49 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-10-02 06:53:24 +0200 |
commit | b976f3c2c228413d124be8fea3280a44bd5e3136 (patch) | |
tree | 32e6712711c61a5d27bbed347901afc242bdc8dd /src/stash.c | |
parent | 71e33d2649f990086237a6cd0fdb7f7d6f742b51 (diff) | |
download | libgit2-b976f3c2c228413d124be8fea3280a44bd5e3136.tar.gz |
reflog: move the reflog implementation into refdb_fs
References and their logs are logically coupled, let's make it so in
the code by moving the fs-based reflog implementation to live next to
the fs-based refs one.
As part of the change, make the function take names rather than
references, as only the names are relevant when looking up and
handling reflogs.
Diffstat (limited to 'src/stash.c')
-rw-r--r-- | src/stash.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/stash.c b/src/stash.c index 7742eee19..ffdbd2e29 100644 --- a/src/stash.c +++ b/src/stash.c @@ -436,14 +436,16 @@ static int update_reflog( const git_signature *stasher, const char *message) { - git_reference *stash = NULL; + git_reference *stash; git_reflog *reflog = NULL; int error; if ((error = git_reference_create(&stash, repo, GIT_REFS_STASH_FILE, w_commit_oid, 1)) < 0) goto cleanup; - if ((error = git_reflog_read(&reflog, stash)) < 0) + git_reference_free(stash); + + if ((error = git_reflog_read(&reflog, repo, GIT_REFS_STASH_FILE) < 0)) goto cleanup; if ((error = git_reflog_append(reflog, w_commit_oid, stasher, message)) < 0) @@ -453,7 +455,6 @@ static int update_reflog( goto cleanup; cleanup: - git_reference_free(stash); git_reflog_free(reflog); return error; } @@ -599,7 +600,7 @@ int git_stash_foreach( if (error < 0) goto cleanup; - if ((error = git_reflog_read(&reflog, stash)) < 0) + if ((error = git_reflog_read(&reflog, repo, GIT_REFS_STASH_FILE)) < 0) goto cleanup; max = git_reflog_entrycount(reflog); @@ -633,7 +634,7 @@ int git_stash_drop( if ((error = git_reference_lookup(&stash, repo, GIT_REFS_STASH_FILE)) < 0) return error; - if ((error = git_reflog_read(&reflog, stash)) < 0) + if ((error = git_reflog_read(&reflog, repo, GIT_REFS_STASH_FILE)) < 0) goto cleanup; max = git_reflog_entrycount(reflog); |