summaryrefslogtreecommitdiff
path: root/src/stash.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/stash.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/stash.c')
-rw-r--r--src/stash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stash.c b/src/stash.c
index 627d271f4..b74429aca 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -600,7 +600,7 @@ int git_stash_foreach(
max = git_reflog_entrycount(reflog);
for (i = 0; i < max; i++) {
- entry = git_reflog_entry_byindex(reflog, max - i - 1);
+ entry = git_reflog_entry_byindex(reflog, i);
if (callback(i,
git_reflog_entry_msg(entry),
@@ -642,7 +642,7 @@ int git_stash_drop(
goto cleanup;
}
- if ((error = git_reflog_drop(reflog, max - index - 1, true)) < 0)
+ if ((error = git_reflog_drop(reflog, index, true)) < 0)
goto cleanup;
if ((error = git_reflog_write(reflog)) < 0)