mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-26 02:47:47 +02:00
Use default branch as specified by the github repo (#35)
This commit is contained in:
@@ -47,7 +47,7 @@ def clean_github_repository(repo):
|
|||||||
repo = repo[:-1]
|
repo = repo[:-1]
|
||||||
split_repo = repo.split("/")
|
split_repo = repo.split("/")
|
||||||
(username, repository) = split_repo[0:2]
|
(username, repository) = split_repo[0:2]
|
||||||
branch = "master"
|
branch = None
|
||||||
if len(split_repo) > 2:
|
if len(split_repo) > 2:
|
||||||
if split_repo[2] == "tree":
|
if split_repo[2] == "tree":
|
||||||
branch = split_repo[3]
|
branch = split_repo[3]
|
||||||
@@ -452,6 +452,8 @@ class Anonymous_Github:
|
|||||||
g_commit = None
|
g_commit = None
|
||||||
try:
|
try:
|
||||||
g_repo = gh.get_repo("%s/%s" % (username, repo))
|
g_repo = gh.get_repo("%s/%s" % (username, repo))
|
||||||
|
if branch is None:
|
||||||
|
branch = g_repo.default_branch
|
||||||
g_commit = g_repo.get_commit(branch)
|
g_commit = g_repo.get_commit(branch)
|
||||||
except:
|
except:
|
||||||
return render_template('empty.html'), 404
|
return render_template('empty.html'), 404
|
||||||
|
|||||||
Reference in New Issue
Block a user