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