refs.c: remove the_repo from read_ref_at()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Apr 6, 2019 at 18:34 UTC
7fdff47432bbb591b6e44ebab48e1f206521cd1b
4 files changed
+12
-7
builtin/show-branch.c
+4
-2
@@ -753,7 +753,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
753
/* Ah, that is a date spec... */
754
timestamp_t at;
755
at = approxidate(reflog_base);
756
- read_ref_at(ref, flags, at, -1, &oid, NULL,
756
+ read_ref_at(get_main_ref_store(the_repository),
757
+ ref, flags, at, -1, &oid, NULL,
758
NULL, NULL, &base);
759
}
760
}
@@ -765,7 +766,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
766
timestamp_t timestamp;
767
int tz;
768
768
- if (read_ref_at(ref, flags, 0, base + i, &oid, &logmsg,
769
+ if (read_ref_at(get_main_ref_store(the_repository),
770
+ ref, flags, 0, base + i, &oid, &logmsg,
771
×tamp, &tz, NULL)) {
772
reflog = i;
773
break;
refs.c
+4
-3
@@ -967,7 +967,8 @@ static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid
967
return 1;
968
}
969
970
-int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, int cnt,
970
+int read_ref_at(struct ref_store *refs, const char *refname,
971
+ unsigned int flags, timestamp_t at_time, int cnt,
972
struct object_id *oid, char **msg,
973
timestamp_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt)
974
{
@@ -983,7 +984,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
984
cb.cutoff_cnt = cutoff_cnt;
985
cb.oid = oid;
986
986
- for_each_reflog_ent_reverse(refname, read_ref_at_ent, &cb);
987
+ refs_for_each_reflog_ent_reverse(refs, refname, read_ref_at_ent, &cb);
988
989
if (!cb.reccnt) {
990
if (flags & GET_OID_QUIETLY)
@@ -994,7 +995,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
995
if (cb.found_it)
996
return 0;
997
997
- for_each_reflog_ent(refname, read_ref_at_ent_oldest, &cb);
998
+ refs_for_each_reflog_ent(refs, refname, read_ref_at_ent_oldest, &cb);
999
1000
return 1;
1001
}
refs.h
+2
-1
@@ -388,7 +388,8 @@ int refs_create_reflog(struct ref_store *refs, const char *refname,
388
int safe_create_reflog(const char *refname, int force_create, struct strbuf *err);
389
390
/** Reads log for the value of ref during at_time. **/
391
-int read_ref_at(const char *refname, unsigned int flags,
391
+int read_ref_at(struct ref_store *refs,
392
+ const char *refname, unsigned int flags,
393
timestamp_t at_time, int cnt,
394
struct object_id *oid, char **msg,
395
timestamp_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt);
sha1-name.c
+2
-1
@@ -849,7 +849,8 @@ static int get_oid_basic(const char *str, int len, struct object_id *oid,
849
return -1;
850
}
851
}
852
- if (read_ref_at(real_ref, flags, at_time, nth, oid, NULL,
852
+ if (read_ref_at(get_main_ref_store(the_repository),
853
+ real_ref, flags, at_time, nth, oid, NULL,
854
&co_time, &co_tz, &co_cnt)) {
855
if (!len) {
856
if (starts_with(real_ref, "refs/heads/")) {