Author
|
zPlus <zplus@peers.community>
2022-07-30 18:46:42
|
Committer
|
zPlus <zplus@peers.community>
2022-07-30 18:46:42
|
Commit
|
a0eb47e
(patch)
|
Tree
|
376aa47
|
Parent(s)
|
|
Add support for reading "description" files in .git folders.
Read <repository>.git/description files and display it in the web UI.
commits diff:
e587546..a0eb47e
5 files changed,
53 insertions,
9 deletions
—
download
Diffstat
Diff options
+4/-0
M documentation/users
30
|
30
|
|
git clone git@example.org:repository
|
31
|
31
|
|
git push git@example.org:repository master
|
32
|
32
|
|
|
|
33
|
+ |
# Set repository description
|
|
34
|
+ |
|
|
35
|
+ |
ssh git@example.org desc <repositoy> "<description>"
|
|
36
|
+ |
|
33
|
37
|
|
# Pushing to a repository
|
34
|
38
|
|
|
35
|
39
|
|
git push git@example.org:repository.git
|
+12/-0
M static/css/clif.css
61
|
61
|
|
margin: 2rem 0 5rem 0;
|
62
|
62
|
|
}
|
63
|
63
|
|
|
|
64
|
+ |
/* List of repos in explore page */
|
|
65
|
+ |
.repositories_list > div {
|
|
66
|
+ |
display: grid;
|
|
67
|
+ |
grid-template-columns: 1fr 3fr;
|
|
68
|
+ |
grid-column-gap: 1rem;
|
|
69
|
+ |
padding: .2rem;
|
|
70
|
+ |
}
|
|
71
|
+ |
|
|
72
|
+ |
.repositories_list > div:hover {
|
|
73
|
+ |
background-color: #e3ecfa;
|
|
74
|
+ |
}
|
|
75
|
+ |
|
64
|
76
|
|
.repository {
|
65
|
77
|
|
display: flex;
|
66
|
78
|
|
width: 100%;
|
+14/-7
M templates/explore.html
10
|
10
|
|
|
11
|
11
|
|
<br />
|
12
|
12
|
|
|
|
13
|
+ |
<div class="repositories_list striped">
|
13
|
14
|
|
{% for repository in repositories %}
|
14
|
15
|
|
<div>
|
15
|
|
- |
{% if repository.endswith('.mlist.git') %}
|
16
|
|
- |
<span title="Mailing List">L</span>
|
17
|
|
- |
<a href="{{ url('threads', repository=repository[:-10]) }}">{{ repository[:-4] }}</a>
|
18
|
|
- |
{% else %}
|
19
|
|
- |
<span title="Repository">R</span>
|
20
|
|
- |
<a href="{{ url('readme', repository=repository[:-4]) }}">{{ repository }}</a>
|
21
|
|
- |
{% endif %}
|
|
16
|
+ |
<div>
|
|
17
|
+ |
{% if repository['path'].endswith('.mlist.git') %}
|
|
18
|
+ |
<span title="Mailing List">L</span>
|
|
19
|
+ |
<a href="{{ url('threads', repository=repository['path'][:-10]) }}">{{ repository['path'][:-4] }}</a>
|
|
20
|
+ |
{% else %}
|
|
21
|
+ |
<span title="Repository">R</span>
|
|
22
|
+ |
<a href="{{ url('readme', repository=repository['path'][:-4]) }}">{{ repository['path'] }}</a>
|
|
23
|
+ |
{% endif %}
|
|
24
|
+ |
</div>
|
|
25
|
+ |
<div>
|
|
26
|
+ |
{{ repository['description'] }}
|
|
27
|
+ |
</div>
|
22
|
28
|
|
</div>
|
23
|
29
|
|
{% endfor %}
|
|
30
|
+ |
</div>
|
24
|
31
|
|
|
25
|
32
|
|
{% endblock %}
|
+5/-0
M templates/repository/readme.html
13
|
13
|
|
{% endif %}
|
14
|
14
|
|
|
15
|
15
|
|
<div class="overview">
|
|
16
|
+ |
{% if description|length > 0 %}
|
|
17
|
+ |
<i>{{ description }}</i>
|
|
18
|
+ |
<br /><br />
|
|
19
|
+ |
{% endif %}
|
|
20
|
+ |
|
16
|
21
|
|
<b>Anon. clone</b><br />
|
17
|
22
|
|
https://{{ instance_domain }}/{{ repository }}
|
18
|
23
|
|
|
+18/-2
M web.py
76
|
76
|
|
if repository.lower() == 'gitolite-admin.git':
|
77
|
77
|
|
continue
|
78
|
78
|
|
|
79
|
|
- |
repositories.append(repository)
|
|
79
|
+ |
try:
|
|
80
|
+ |
with open(os.path.join(path, 'description')) as f:
|
|
81
|
+ |
description = f.read()
|
|
82
|
+ |
except:
|
|
83
|
+ |
description = ''
|
|
84
|
+ |
|
|
85
|
+ |
repositories.append({
|
|
86
|
+ |
'path': repository,
|
|
87
|
+ |
'description': description
|
|
88
|
+ |
})
|
80
|
89
|
|
|
81
|
|
- |
repositories.sort()
|
|
90
|
+ |
repositories.sort(key = lambda d: d['path'])
|
82
|
91
|
|
return repositories
|
83
|
92
|
|
|
84
|
93
|
|
def parse_thread_tags(data):
|
241
|
250
|
|
|
242
|
251
|
|
repo_size = sum(f.stat().st_size for f in pathlib.Path(path).glob("**/*"))
|
243
|
252
|
|
|
|
253
|
+ |
try:
|
|
254
|
+ |
with open(os.path.join(path, 'description')) as f:
|
|
255
|
+ |
description = f.read()
|
|
256
|
+ |
except:
|
|
257
|
+ |
description = ''
|
|
258
|
+ |
|
244
|
259
|
|
return template('repository/readme.html',
|
245
|
260
|
|
readme=readme,
|
246
|
261
|
|
repository=repository,
|
247
|
262
|
|
repository_size=human_size(repo_size),
|
|
263
|
+ |
description=description,
|
248
|
264
|
|
head_ref=HEAD)
|
249
|
265
|
|
|
250
|
266
|
|
@bottle.get('/<repository:path>.git/refs', name='refs')
|