From e0bf8379acdafb17c9f324637c2bee1c141ad5cd Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Wed, 31 Dec 2014 08:58:48 +0400 Subject: [PATCH] ajouter un wrapper pour que git-annex puisse utiliser la valeur GIT_SSH --- lib/ssh-wrapper/ssh | 7 +++++++ uproject | 11 ++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 lib/ssh-wrapper/ssh diff --git a/lib/ssh-wrapper/ssh b/lib/ssh-wrapper/ssh new file mode 100755 index 0000000..7cfafef --- /dev/null +++ b/lib/ssh-wrapper/ssh @@ -0,0 +1,7 @@ +#!/bin/bash +# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +# wrapper permettant d'utiliser GIT_SSH avec des outils comme git-annex +# La variable __UTOOLS_FORCE_PATH doit être définie: c'est la valeur de +# PATH à utiliser +[ -n "$__UTOOLS_FORCE_PATH" ] && export PATH="$__UTOOLS_FORCE_PATH" +exec "${GIT_SSH:-ssh}" "$@" diff --git a/uproject b/uproject index 9a3c366..cddbaaf 100755 --- a/uproject +++ b/uproject @@ -186,6 +186,12 @@ done ################################################################################ # Traiter les commandes +function use_ssh_wrapper() { + local __UTOOLS_FORCE_PATH="$PATH" + udelpath "$scriptdir/lib/ssh-wrapper" __UTOOLS_FORCE_PATH + uinspath "$scriptdir/lib/ssh-wrapper" PATH +} + if [ "$CMD" == "grep" ]; then ## grep if [ $# -eq 1 -a "$1" == "--help" ]; then @@ -205,6 +211,7 @@ elif array_contains VCS_CMDS "$CMD"; then "vcs_$CMD" "$@" elif array_contains GITANNEX_CMDS "$CMD"; then + use_ssh_wrapper case "$CMD" in annex) git annex "$@";; xcopy|xmove|xget) git annex "${CMD#x}" "$@" && git annex sync;; @@ -220,6 +227,7 @@ elif [ "$CMD" == clone ]; then [ -n "$destdir" ] || setx destdir=basename -- "$repourl" [ -d "$destdir" ] && die "$(ppath "$destdir"): répertoire existant" + use_ssh_wrapper git clone "$repourl" "$destdir" || die git_annex_initial "$destdir" || die @@ -238,7 +246,8 @@ elif [ "$CMD" == crone ]; then userhost="$user@$host" [ -n "$path" ] || die "Vous devez spécifier le chemin du dépôt git" - ${GIT_SSH:-ssh} "$userhost" create "$path" || die + use_ssh_wrapper + ssh "$userhost" create "$path" || die git clone "$userhost:$path" "$destdir" || die git_annex_initial "$destdir" || die