summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-10-27 01:48:30 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-10-27 01:48:30 (GMT)
commit2e6d8f181dd77d40a1148549d4f33cdf2877fb19 (patch)
treec6b7c9245913f96d89466a5f3db58f595686dc47 /refs.c
parent97f7a7bd0d9d618e503623ded5b22eafada9e174 (diff)
parent694500edbd51baef365c588986abe41f01acf0de (diff)
downloadgit-2e6d8f181dd77d40a1148549d4f33cdf2877fb19.zip
git-2e6d8f181dd77d40a1148549d4f33cdf2877fb19.tar.gz
git-2e6d8f181dd77d40a1148549d4f33cdf2877fb19.tar.bz2
Merge branch 'jc/reflog' into lj/refs
* jc/reflog: sha1_name.c: avoid compilation warnings. ref-log: allow ref@{count} syntax.
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index ed2e3b1..f003a0b 100644
--- a/refs.c
+++ b/refs.c
@@ -806,7 +806,7 @@ int write_ref_sha1(struct ref_lock *lock,
return 0;
}
-int read_ref_at(const char *ref, unsigned long at_time, unsigned char *sha1)
+int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1)
{
const char *logfile, *logdata, *logend, *rec, *lastgt, *lastrec;
char *tz_c;
@@ -839,7 +839,7 @@ int read_ref_at(const char *ref, unsigned long at_time, unsigned char *sha1)
if (!lastgt)
die("Log %s is corrupt.", logfile);
date = strtoul(lastgt + 1, &tz_c, 10);
- if (date <= at_time) {
+ if (date <= at_time || cnt == 0) {
if (lastrec) {
if (get_sha1_hex(lastrec, logged_sha1))
die("Log %s is corrupt.", logfile);
@@ -870,6 +870,8 @@ int read_ref_at(const char *ref, unsigned long at_time, unsigned char *sha1)
return 0;
}
lastrec = rec;
+ if (cnt > 0)
+ cnt--;
}
rec = logdata;