gitweb: Run git commands as a web user

Fixes #2306.

Tested that all the gitweb tests pass in Debian stable and testing
containers.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa authored and Sunil Mohan Adapa committed 2022-12-29 15:20:38 -08:00
1 parent d3d7e233e3
commit b94e1ea596
4 files changed
+14 -9

No files matched your search

+2 -1
View File
@@ -14,11 +14,12 @@ from django.utils.translation import gettext_lazy as _
from plinth.modules import gitweb
from . import privileged
from .manifest import REPO_DIR_OWNER
def _get_branches(repo):
"""Get all the branches in the repository."""
branch_data = privileged.get_branches(repo)
branch_data = privileged.get_branches(repo, _run_as_user=REPO_DIR_OWNER)
default_branch = branch_data['default_branch']
branches = branch_data['branches']