summaryrefslogtreecommitdiff
path: root/src/lib/util
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2023-09-26 22:09:41 +0200
committerChristian Heusel <christian@heusel.eu>2023-09-26 22:44:58 +0200
commitf632659563acb7b8d481fdff9acd8305acf29b98 (patch)
treec10468b8b97ad6745d9e815a9d93f65dcb123d6a /src/lib/util
parent7e41adf00bb93cf6e016b9a7cd8ebdc693666077 (diff)
downloaddevtools-f632659563acb7b8d481fdff9acd8305acf29b98.tar.xz
fix(clone): ssh connection may require user input (key unlocking etc)
Anything that requires user input (such as a key unlock or hostkey verify) will block the terminal and wait for input which will never come. When cloning or configuring a repo via ssh we therefore initially connect to gitlab to warm the connection. Afterwards users are expected to either have setup a ssh ControlMaster or use something like a ssh agent. Fixes #148 Component: pkgctl repo clone/configure Co-Authored-by: Christian Heusel <christian@heusel.eu> Signed-off-by: Christian Heusel <christian@heusel.eu> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/git.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/util/git.sh b/src/lib/util/git.sh
index c4af662..82e4beb 100644
--- a/src/lib/util/git.sh
+++ b/src/lib/util/git.sh
@@ -7,6 +7,9 @@ DEVTOOLS_INCLUDE_UTIL_GIT_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
+# shellcheck source=src/lib/common.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
+
git_diff_tree() {
local commit=$1
@@ -22,3 +25,10 @@ git_diff_tree() {
"${commit}" \
-- "${path}"
}
+
+git_warmup_ssh_connection() {
+ msg 'Establishing ssh connection to git@%s' "${GITLAB_HOST}"
+ if ! ssh -T "git@${GITLAB_HOST}" >/dev/null; then
+ die 'Failed to establish ssh connection to git@%s' "${GITLAB_HOST}"
+ fi
+}