git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv2] clone: support cloning full bundles

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 27, 2008, 22:44 UTC
Message-ID
<7v63waqasu.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1203934349-12125-1-git-send-email-sbejar@gmail.com>
Santi Béjar <sbejar@gmail.com> writes:
Show 20 quoted lines
> Signed-off-by: Santi Béjar <sbejar@gmail.com>
> diff --git a/git-clone.sh b/git-clone.sh
> index 0d686c3..2efb947 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')
> +[ -f "$dir" ] && dir=$(expr "$repo" : '.*/\([^/]*\)\.[^/]*')
>  [ -e "$dir" ] && die "destination directory '$dir' already exists."
>  [ yes = "$bare" ] && unset GIT_WORK_TREE
>  [ -n "$GIT_WORK_TREE" ] && [ -e "$GIT_WORK_TREE" ] &&

What is this [ -f "$dir" ] line doing? The purpose of these lines is:

 - The user (might have) said "clone to $2";
 - If the user didn't, then set dir to humanish part;
 - If that exists, we barf.

I do not see any valid reason for an additional logic in this sequence when adding a new clone _source_ type.

The check to see if "$dir" _exists_ is even worse. If the user said "clone _to_ this", then we would not have invented $dir based on the $repo (which is what the user said "clone _from_") but used whatever name the user has given us. The existing check to barf "Hey, that explicit location you told me to clone to is WRONG!!!" should not be broken.

Previous: Junio C HamanoNext: Santi Béjar
Message 5 of 12 in “[PATCHv2] clone: support cloning full bundles”
  1. Santi BéjarFeb 25, 2008
  2. Junio C HamanoFeb 25, 2008
  3. Santi BéjarFeb 25, 2008
  4. Junio C HamanoFeb 25, 2008
  5. Junio C HamanoFeb 27, 2008
  6. Santi BéjarFeb 27, 2008
  7. Santi BéjarFeb 27, 2008
  8. Daniel BarkalowFeb 27, 2008
  9. Junio C HamanoFeb 28, 2008
  10. Johannes SchindelinFeb 28, 2008
  11. Santi BéjarFeb 28, 2008
  12. Mark LevedahlFeb 29, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.