diff options
author | Ferry Huberts <ferry.huberts@pelagic.nl> | 2011-05-14 06:09:34 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2011-05-31 06:15:31 (JST) |
commit | 21e0e0bfac660072a4518f91f59d5c4bf6e764b5 (patch) | |
tree | 0d14c3e9c38b83b7c9eaafcefb9151ddc3771d4b | |
parent | 2ffeecb7a6827dcf0f81cf543ed312155f6e8f83 (diff) | |
download | cgit-21e0e0bfac660072a4518f91f59d5c4bf6e764b5.zip cgit-21e0e0bfac660072a4518f91f59d5c4bf6e764b5.tar.gz |
ui_repolist: get modtime from packed-refs as fallback
When no modtime could be determined then as a final
fallback try to get it from the packed-refs.
This will show an idle time when a repository has been packed
with all refs in the packed-refs.
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-repolist.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ui-repolist.c b/ui-repolist.c index 6f304bb..dce2eac 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -46,11 +46,20 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); | 48 | path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); |
49 | if (stat(path, &s) == 0) | 49 | if (stat(path, &s) == 0) { |
50 | *mtime = s.st_mtime; | 50 | *mtime = s.st_mtime; |
51 | else | 51 | r->mtime = *mtime; |
52 | *mtime = 0; | 52 | return 1; |
53 | } | ||
54 | |||
55 | path = fmt("%s/%s", repo->path, "packed-refs"); | ||
56 | if (stat(path, &s) == 0) { | ||
57 | *mtime = s.st_mtime; | ||
58 | r->mtime = *mtime; | ||
59 | return 1; | ||
60 | } | ||
53 | 61 | ||
62 | *mtime = 0; | ||
54 | r->mtime = *mtime; | 63 | r->mtime = *mtime; |
55 | return (r->mtime != 0); | 64 | return (r->mtime != 0); |
56 | } | 65 | } |