From: Junio C Hamano Date: Thu, 28 Feb 2008 17:57:23 GMT Subject: Re: [PATCHv3] clone: support cloning full bundles Message-ID: <7vmyplj75o.fsf@gitster.siamese.dyndns.org> In-Reply-To: <1204165372-12175-1-git-send-email-sbejar@gmail.com> Santi Béjar writes: > diff --git a/git-clone.sh b/git-clone.sh > index 0d686c3..0580b5a 100755 > --- a/git-clone.sh > +++ b/git-clone.sh > @@ -210,11 +210,14 @@ if base=$(get_repo_base "$repo"); then > then > local=yes > fi > +elif [ -f "$repo" ] ; then > + case "$repo" in /*);; *) repo="$PWD/$repo" ; esac > fi > > dir="$2" > # Try using "humanish" part of source repo if user didn't specify one > -[ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g') > +[ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*[/:]||g') && > +[ -f "$repo" ] && dir=$(echo "$repo" | sed -e 's|/*\.bundle$||' -e 's|.*/||g') > [ -e "$dir" ] && die "destination directory '$dir' already exists." > [ yes = "$bare" ] && unset GIT_WORK_TREE > [ -n "$GIT_WORK_TREE" ] && [ -e "$GIT_WORK_TREE" ] && This sequence was terse, to the point and very readable when the logic was simpler, but now it is getting out of hand. I think it is a time for rewriting to something more verbose, like... # Decide the directory name of the new repository if test -n "$2" then dir="$2" else # Derive one from the repository name if test -f "$repo" then # Cloning from a bundle dir=... humanish ... else dir=... humanish ... fi fi