git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <junkio@cox.net>
Subject: [PATCH] Fix clone to setup the origin if its name ends with .git
Date: Thu, 7 Jun 2007 00:49:06 +0200	[thread overview]
Message-ID: <20070606224906.GB3969@steel.home> (raw)

The problem is visible when cloning a local repo. The cloned
repository will have the origin url setup incorrectly: the origin name
will be copied verbatim in origin url of the cloned repository.
Normally, the name is to be expanded into absolute path.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
 git-clone.sh           |    2 +-
 t/t5701-clone-local.sh |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)
 create mode 100755 t/t5701-clone-local.sh

diff --git a/git-clone.sh b/git-clone.sh
index fdd354f..d45618d 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -20,7 +20,7 @@ usage() {
 get_repo_base() {
 	(
 		cd "`/bin/pwd`" &&
-		cd "$1" &&
+		cd "$1" || cd "$1.git" &&
 		{
 			cd .git
 			pwd
diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh
new file mode 100755
index 0000000..fb027f3
--- /dev/null
+++ b/t/t5701-clone-local.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+test_description='test local clone'
+. ./test-lib.sh
+
+test_expect_success 'preparing origin repository' \
+':>file && git add . && git commit -m1 && mv .git a.git'
+
+unset GIT_CONFIG
+
+test_expect_success 'local clone without .git suffix' \
+'git clone -l -s a b && cd b && git fetch && cd ..'
+
+test_expect_success 'local clone with .git suffix' \
+'git clone -l -s a.git c && cd c && git fetch && cd ..'
+
+test_done
-- 
1.5.2.1.141.g3c63

             reply	other threads:[~2007-06-06 22:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 22:49 Alex Riesen [this message]
2007-06-07  2:08 ` [PATCH] Fix clone to setup the origin if its name ends with .git Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070606224906.GB3969@steel.home \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).