summaryrefslogtreecommitdiff
path: root/builtin-reflog.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2007-02-03 18:25:43 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-02-03 19:57:18 (GMT)
commiteb8381c88518b10d683a29deea1d43ed671f14ec (patch)
treea9523ae68d874de91032c1ed3be92de168a2f73c /builtin-reflog.c
parenta7e4fbf990290f955da1319ab605a59f85d3c3e2 (diff)
downloadgit-eb8381c88518b10d683a29deea1d43ed671f14ec.zip
git-eb8381c88518b10d683a29deea1d43ed671f14ec.tar.gz
git-eb8381c88518b10d683a29deea1d43ed671f14ec.tar.bz2
scan reflogs independently from refs
Currently, the search for all reflogs depends on the existence of corresponding refs under the .git/refs/ directory. Let's scan the .git/logs/ directory directly instead. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-reflog.c')
-rw-r--r--builtin-reflog.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/builtin-reflog.c b/builtin-reflog.c
index b6612a9..bfb169a 100644
--- a/builtin-reflog.c
+++ b/builtin-reflog.c
@@ -245,14 +245,11 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
char *log_file, *newlog_path = NULL;
int status = 0;
- if (strncmp(ref, "refs/", 5))
- return error("not a ref '%s'", ref);
-
memset(&cb, 0, sizeof(cb));
/* we take the lock for the ref itself to prevent it from
* getting updated.
*/
- lock = lock_ref_sha1(ref + 5, sha1);
+ lock = lock_any_ref_for_update(ref, sha1);
if (!lock)
return error("cannot lock ref '%s'", ref);
log_file = xstrdup(git_path("logs/%s", ref));
@@ -353,7 +350,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
}
if (do_all)
- status |= for_each_ref(expire_reflog, &cb);
+ status |= for_each_reflog(expire_reflog, &cb);
while (i < argc) {
const char *ref = argv[i++];
unsigned char sha1[20];