From 06958376afece96e03834f17958bed6c572cf680 Mon Sep 17 00:00:00 2001
From: Levente Polyak <anthraxx@archlinux.org>
Date: Thu, 12 Oct 2023 20:55:45 +0200
Subject: [PATCH] fix(db-functions): avoid git asking for credentials for
 unknown repos

Use GIT_TERMINAL_PROMPT=0 to enforce Git not asking for any prompts or
credentials. GitLab does not return none existing repositories but
instead prompts for credentials to avoid side channel information leaks.
However, we explicitly do not want to get any such prompts, instead we
fail gracefully.
---
 db-functions-git | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/db-functions-git b/db-functions-git
index 2a0307d..78a6d06 100644
--- a/db-functions-git
+++ b/db-functions-git
@@ -62,6 +62,10 @@ fetch_pkgbuild() {
 	project_path=$(gitlab_project_name_to_path "${pkgbase}")
 	src="${GIT_PACKAGING_REPOS_URL}/${project_path}.git"
 	target="${GIT_PACKAGES_CACHE}/${pkgbase}"
+
+	# avoid git operations asking for terminal input
+	export GIT_TERMINAL_PROMPT=0
+
 	if [[ ! -d $target ]]; then
 		if ! arch_git -c core.sharedRepository=group clone --origin origin --bare --mirror "${src}" "${target}"; then
 			return 1
-- 
GitLab