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

+4 -3
View File
@@ -15,7 +15,7 @@ from plinth.package import Packages
from . import manifest, privileged
from .forms import is_repo_url
from .manifest import GIT_REPO_PATH
from .manifest import GIT_REPO_PATH, REPO_DIR_OWNER
_description = [
_('Git is a distributed version-control system for tracking changes in '
@@ -213,7 +213,7 @@ def get_repo_list():
def repo_info(repo):
"""Get information about repository."""
info = privileged.repo_info(repo)
info = privileged.repo_info(repo, _run_as_user=REPO_DIR_OWNER)
if info['access'] == 'private':
info['is_private'] = True
else:
@@ -244,4 +244,5 @@ def edit_repo(form_initial, form_cleaned):
privileged.set_repo_access(repo, 'public')
if form_cleaned['default_branch'] != form_initial['default_branch']:
privileged.set_default_branch(repo, form_cleaned['default_branch'])
privileged.set_default_branch(repo, form_cleaned['default_branch'],
_run_as_user=REPO_DIR_OWNER)