git-arr: Implement an "ignore" option
When having symbolic links to the same repositories (e.g. if you have "repo" and a "repo.git" linking to it), it can be useful to ignore based on regular expressions to avoid having duplicates in the output. Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
This commit is contained in:
parent
c4e6484bb0
commit
cacf2ee2cc
9
git-arr
9
git-arr
@ -5,10 +5,11 @@ git-arr: A git web html generator.
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import math
|
import math
|
||||||
import optparse
|
import optparse
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import configparser
|
import configparser
|
||||||
@ -58,6 +59,7 @@ def load_config(path):
|
|||||||
'git_url_file': 'cloneurl',
|
'git_url_file': 'cloneurl',
|
||||||
'embed_markdown': 'yes',
|
'embed_markdown': 'yes',
|
||||||
'embed_images': 'no',
|
'embed_images': 'no',
|
||||||
|
'ignore': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
config = configparser.SafeConfigParser(defaults)
|
config = configparser.SafeConfigParser(defaults)
|
||||||
@ -88,6 +90,9 @@ def load_config(path):
|
|||||||
config.remove_section(s)
|
config.remove_section(s)
|
||||||
|
|
||||||
for s in config.sections():
|
for s in config.sections():
|
||||||
|
if config.get(s, 'ignore') and re.search(config.get(s, 'ignore'), s):
|
||||||
|
continue
|
||||||
|
|
||||||
fullpath = find_git_dir(config.get(s, 'path'))
|
fullpath = find_git_dir(config.get(s, 'path'))
|
||||||
if not fullpath:
|
if not fullpath:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
@ -67,6 +67,13 @@ path = /srv/git/repo/
|
|||||||
# Default: no
|
# Default: no
|
||||||
#embed_images = no
|
#embed_images = no
|
||||||
|
|
||||||
|
# Ignore repositories that match this regular expression.
|
||||||
|
# Generally used with recursive = yes, to ignore repeated repositories (for
|
||||||
|
# example, if using symlinks).
|
||||||
|
# For ignoring specific repositories, putting a "disable_gitweb" is a much
|
||||||
|
# better alternative.
|
||||||
|
# Default: empty (don't ignore)
|
||||||
|
#ignore = \.git$
|
||||||
|
|
||||||
# Another repository, we don't generate a tree for it because it's too big.
|
# Another repository, we don't generate a tree for it because it's too big.
|
||||||
[linux]
|
[linux]
|
||||||
|
Loading…
Reference in New Issue
Block a user