ajouter un wrapper pour que git-annex puisse utiliser la valeur GIT_SSH

This commit is contained in:
Jephte CLAIN 2014-12-31 08:58:48 +04:00
parent 3ff7f78d0b
commit e0bf8379ac
2 changed files with 17 additions and 1 deletions

7
lib/ssh-wrapper/ssh Executable file
View File

@ -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}" "$@"

View File

@ -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