Browse Source

list.pl: use .git/description, if defined

Brennen Bearnes 5 months ago
parent
commit
0294100701
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      code.p1k3.com/html/list.pl

+ 7
- 3
code.p1k3.com/html/list.pl View File

@@ -25,7 +25,7 @@ while (my $dir = readdir $dh) {
25 25
   my $repo_path = $repo_dir . $dir;
26 26
 
27 27
   $dirs{$dir} = (stat $repo_path)[9]; # mtime
28
-  $titles{$dir} = get_desc_from_repo($dir);
28
+  $titles{$dir} = get_desc_from_repo("$repo_dir/$dir");
29 29
   $names{$dir} = $dir;
30 30
   $names{$dir} =~ s/(.*)[.]git$/$1/;
31 31
 }
@@ -52,10 +52,14 @@ say $list;
52 52
 
53 53
 sub get_desc_from_repo {
54 54
   my ($repo) = @_;
55
+  my $desc = '';
55 56
   if (-e "$repo/description") {
56
-    return slurp("$repo/description");
57
+    $desc = slurp("$repo/description");
57 58
   }
58
-  return '';
59
+  if ($desc =~ /\QUnnamed repository; edit this file 'description' to name the repository.\E/) {
60
+    $desc = '';
61
+  }
62
+  return $desc;
59 63
 }
60 64
 
61 65
 sub slurp {

Loading…
Cancel
Save