diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Hide git's default repository description
Diffstat (limited to '')
-rw-r--r--source/scan-tree.c10
1 file changed, 10 insertions, 0 deletions
diff --git a/source/scan-tree.c b/source/scan-tree.c
index 82f2cc0..7e626bf 100644
--- a/source/scan-tree.c
+++ b/source/scan-tree.c
@@ -46,6 +46,9 @@ out:
return result;
}
+// The description git puts in every freshly created repository.
+static const char *default_git_desc = "Unnamed repository; edit this file 'description' to name the repository.";
+
static struct cgit_repo *repo;
static void scan_tree_repo_config(const char *name, const char *value)
@@ -154,6 +157,13 @@ static void add_repo(const char *base, struct strbuf *path)
if (!stat(path->buf, &st))
read_first_line(path->buf, &repo->desc, &size);
strbuf_setlen(path, pathlen);
+ // Git writes this line into every repository it creates, so it
+ // describes nothing. Treat it as no description at all rather
+ // than repeating it down the whole index.
+ if (repo->desc && !strcmp(repo->desc, default_git_desc)) {
+ free(repo->desc);
+ repo->desc = cgit_default_repo_desc;
+ }
}
if (ctx.cfg.section_from_path) {