option -n pour pcrone le clone pas le dépôt nouvellement créé

This commit is contained in:
Jephté Clain 2018-11-21 22:19:35 +04:00
parent 01325d0c23
commit f72dd86584
1 changed files with 24 additions and 14 deletions

View File

@ -494,6 +494,11 @@ NR <= 2 { next }
fi
elif [ "$CMD" == crone ]; then
no_clone=
parse_opts "${PRETTYOPTS[@]}" \
-n,--no-clone no_clone=1 \
@ args -- "$@" && set -- "${args[@]}" || die "$args"
cxone_init "$@"
[ -n "$repourl" ] || die "Vous devez spécifier l'url du dépôt git"
@ -533,7 +538,7 @@ elif [ "$CMD" == crone ]; then
destdir="${destdir%.git}"
fi
tmpdestdir=
if [ -d "$destdir" ]; then
if [ -d "$destdir" -a -z "$no_clone" ]; then
[ -d "$destdir/.git" ] && die "$(ppath2 "$destdir"): un dépôt existe déjà"
ac_set_tmpdir tmpdestdir
fi
@ -542,6 +547,8 @@ elif [ "$CMD" == crone ]; then
setx result=curl -fs "$hostuser/create?$path" || die
echo "$result"
[[ "$result" == FATAL:* ]] && die
[ -n "$no_clone" ] && exit 0
if [ -n "$tmpdestdir" ]; then
setxx destname=abspath "$destdir" // basename
git clone "$hostuser/$path" "$tmpdestdir/$destname" || die
@ -550,9 +557,12 @@ elif [ "$CMD" == crone ]; then
else
git clone "$hostuser/$path" "$destdir" || die
fi
elif [ "$mode" == gitolite_ssh ]; then
git_annex_use_ssh_wrapper
ssh "$userhost" create "$path" || die
[ -n "$no_clone" ] && exit 0
if [ -n "$tmpdestdir" ]; then
setxx destname=abspath "$destdir" // basename
git clone "$userhost:$path" "$tmpdestdir/$destname" || die
@ -561,6 +571,7 @@ elif [ "$CMD" == crone ]; then
else
git clone "$userhost:$path" "$destdir" || die
fi
elif [ "$mode" == gogs_http ]; then
payload='{"private":true,"name":"'"$path"'"}'
if [ "$gogs_user" != "$user" ]; then
@ -576,6 +587,8 @@ url: $url
payload: $payload
result: $result"
echo "$result"
[ -n "$no_clone" ] && exit 0
if [ -n "$tmpdestdir" ]; then
setxx destname=abspath "$destdir" // basename
git clone "$repourl" "$tmpdestdir/$destname" || die
@ -587,26 +600,23 @@ result: $result"
else
die "bug: mode non prévu"
fi
if [ ! -f "$destdir/.gitignore" -o ! -f "$destdir/.gitattributes" ]; then
if ask_yesno "Voulez-vous créer les fichiers initiaux .gitignore et/ou .gitattributes?" O; then
if [ -f "$destdir/.gitignore" ]; then
einfo "Refus d'écraser le fichier .gitignore existant"
else
echo >"$destdir/.gitignore" "\
if [ -f "$destdir/.gitignore" ]; then
:
elif ask_yesno "Voulez-vous créer le fichier initial .gitignore?" O; then
echo >"$destdir/.gitignore" "\
.~lock*#
.*.swp"
fi
if [ -f "$destdir/.gitattributes" ]; then
einfo "Refus d'écraser le fichier .gitattributes existant"
else
echo >"$destdir/.gitattributes" "\
fi
if [ -f "$destdir/.gitattributes" ]; then
:
elif ask_yesno "Voulez-vous créer le fichier initial .gitattributes?" N; then
echo >"$destdir/.gitattributes" "\
*.zip -delta
*.gz -delta
*.bz2 -delta
*.whl -delta
*.exe -delta"
fi
fi
fi
elif [ "$CMD" == xconfig-export ]; then