Klaus Demo klaus / 44b6ada
Merge pull request #173 from jelmer/cloneurl Support gitweb .git/cloneurl file and 'gitweb.url' settings. Jonas Haag authored 3 years ago GitHub committed 3 years ago
2 changed file(s) with 15 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3030 if refs:
3131 return refs[0].commit_time
3232 return None
33
34 @property
35 def cloneurl(self):
36 """Retrieve the gitweb notion of the public clone URL of this repo."""
37 f = self.get_named_file('cloneurl')
38 if f is not None:
39 return f.read()
40 c = self.get_config()
41 try:
42 return force_unicode(c.get(b'gitweb', b'url'))
43 except KeyError:
44 return None
3345
3446 def get_description(self):
3547 """Like Dulwich's `get_description`, but returns None if the file
3636 {% if USE_SMARTHTTP %}
3737 <code>git clone {{ url_for('index', repo=repo.name, _external=True) }}</code>
3838 {% endif %}
39 {% if repo.cloneurl %}
40 <code>git clone {{ repo.cloneurl }}</code>
41 {% endif %}
3942 </h2>
4043
4144 {{ pagination() }}