From 2ed7df213467df604f0b935dc36fb54d44aa068e Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Wed, 29 Jul 2020 10:45:37 -0700 Subject: [PATCH] toolbox/projtool.pl: show objects/info/packs timestamp Not all projects will have a bundle. All non-empty projects should have at least one pack. Since the `git update-server-info` command only runs after new packs have been created and always creates/modifies the objects/info/packs file, its date reflects the last time any pack changes have occurred in the project. When Git "freshens" a pack's date, it does not touch the objects/info/packs file at all making its timestamp immune to any "freshening" activity that may occur. Include this timestamp in the `projtool.pl show` output if the file exists. Comparing this date against the `lastgc` timestamp can quickly show whether or not the project is dirty (or even "stale"). Since this timestamp is being added to the `projtool show` output, also take this opportunity to make the bundle timestamp a little bit more readable (extra spaces) and use that same format for this new timestamp. Signed-off-by: Kyle J. McKay --- toolbox/projtool.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/toolbox/projtool.pl b/toolbox/projtool.pl index 2d13aef..df3a708 100755 --- a/toolbox/projtool.pl +++ b/toolbox/projtool.pl @@ -252,6 +252,11 @@ sub get_clean_project { if (defined($project->{path}) && $project->{path} ne "") { my $rp = realpath($project->{path}); defined($rp) && $rp ne "" and $project->{realpath} = $rp; + if (-f "$rp/objects/info/packs") { + my $ipt = (stat _)[9]; + defined($ipt) and $project->{infopackstime} = + strftime("%Y-%m-%d %H:%M:%S %z", localtime($ipt)); + } } my $owner = $project->{owner}; if ($owner) { @@ -266,7 +271,7 @@ sub get_clean_project { my @bundles = $project->bundles; for (my $i = 0; $i < @bundles; ++$i) { my $secs = $bundles[$i]->[0]; - $bundles[$i]->[0] = strftime("%Y-%m-%dT%H:%M:%S%z", localtime($secs)); + $bundles[$i]->[0] = strftime("%Y-%m-%d %H:%M:%S %z", localtime($secs)); my $sz = $bundles[$i]->[2]; 1 while $sz =~ s/(?<=\d)(\d{3})(?:,|$)/,$1/g; $bundles[$i]->[2] = $sz; -- 2.11.4.GIT