List for cgit developers and users
 help / color / mirror / Atom feed
From: mailings at hupie.com (Ferry Huberts)
Subject: [PATCH] ui_repolist: get modtime from packed-refs as fallback
Date: Fri, 13 May 2011 23:09:34 +0200	[thread overview]
Message-ID: <1305320974-8453-1-git-send-email-mailings@hupie.com> (raw)

From: Ferry Huberts <ferry.huberts at pelagic.nl>

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 at pelagic.nl>
---
 ui-repolist.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/ui-repolist.c b/ui-repolist.c
index 2c98668..6c33e38 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)
 	}
 
 	path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
-	if (stat(path, &s) == 0)
+	if (stat(path, &s) == 0) {
 		*mtime = s.st_mtime;
-	else
-		*mtime = 0;
+		r->mtime = *mtime;
+		return 1;
+	}
+
+	path = fmt("%s/%s", repo->path, "packed-refs");
+	if (stat(path, &s) == 0) {
+		*mtime = s.st_mtime;
+		r->mtime = *mtime;
+		return 1;
+	}
 
+	*mtime = 0;
 	r->mtime = *mtime;
 	return (r->mtime != 0);
 }
-- 
1.7.4.4





             reply	other threads:[~2011-05-13 21:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 21:09 mailings [this message]
2011-05-30 21:31 ` hjemli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305320974-8453-1-git-send-email-mailings@hupie.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).