summaryrefslogtreecommitdiff
path: root/src/revparse.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-11-17 18:29:51 -0800
committernulltoken <emeric.fermas@gmail.com>2012-11-17 18:30:35 -0800
commitb15df1d937128bb7051ab35084195ff1980a7869 (patch)
treeccac67d86df9f6f8f2276d2b4f4b43555e99b20e /src/revparse.c
parent1a764476d27ac1861d1433b02bc7fbff733d8942 (diff)
downloadlibgit2-b15df1d937128bb7051ab35084195ff1980a7869.tar.gz
reflog: make entry_byindex() and drop() git compliant
Passing 0 as the index now retrieves the most recent entry instead of the oldest one.
Diffstat (limited to 'src/revparse.c')
-rw-r--r--src/revparse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/revparse.c b/src/revparse.c
index 83eea7d3f..6a7587d6a 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -201,7 +201,7 @@ static int retrieve_previously_checked_out_branch_or_revision(git_object **out,
numentries = git_reflog_entrycount(reflog);
- for (i = numentries - 1; i >= 0; i--) {
+ for (i = 0; i < numentries; i++) {
entry = git_reflog_entry_byindex(reflog, i);
msg = git_reflog_entry_msg(entry);
@@ -263,7 +263,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
}
entry = git_reflog_entry_byindex(reflog, identifier);
- git_oid_cpy(oid, git_reflog_entry_oidold(entry));
+ git_oid_cpy(oid, git_reflog_entry_oidnew(entry));
error = 0;
goto cleanup;
@@ -271,7 +271,7 @@ static int retrieve_oid_from_reflog(git_oid *oid, git_reference *ref, unsigned i
int i;
git_time commit_time;
- for (i = numentries - 1; i >= 0; i--) {
+ for (i = 0; i < numentries; i++) {
entry = git_reflog_entry_byindex(reflog, i);
commit_time = git_reflog_entry_committer(entry)->when;