git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: GIT Mailing-list <git@vger.kernel.org>
Cc: "Ashfield, Bruce" <Bruce.Ashfield@windriver.com>,
	"saul.wold" <saul.wold@intel.com>
Subject: Re: Problems with git fetch confusing foo and foo.git repos
Date: Sat, 18 Aug 2012 15:49:43 +0100	[thread overview]
Message-ID: <1345301383.27428.55.camel@ted> (raw)
In-Reply-To: <1345299904.27428.50.camel@ted>

On Sat, 2012-08-18 at 15:25 +0100, Richard Purdie wrote:
> A while ago I reported a problem[1] where having:
> 
> /somewhere/foo
> and
> /somewhere/foo.git
> 
> as bare repositories and trying to clone them using alternates could
> cause git to confuse them.
> 
> The "conclusion" was that I needed to do:
> 
> git clone -s -n /somewhere/foo/ x
> 
> to stop it looking at the .git version. Ok, fine. Ugly but I can live
> with it and we added the workaround[2].
> 
> I've now discovered we only half solved the problem. Whilst the
> alternates might get setup correctly, the branch names and revisions get
> fetched from the .git version still.
> 
> It appears that even if you have a repository setup with an origin url
> of "/somewhere/foo/", when you run git fetch origin -f  refs/*:refs/*,
> it will look at foo.git if it exists.
> 
> The problem is the trailing slash is stripped off by the code in
> git-fetch itself. It appears to have done this since it was converted
> from a .sh function. It means it appears impossible to fetch the
> branchnames/revisions from foo when foo.git exists.
> 
> I work with build systems that build complete linux systems and we're
> running into failures caused by this. I really need pre-existing
> versions of git to work so I can't even patch git to work around the
> problem without significant cost. So far the only way I've figured out
> to avoid this is to create a symlink to /somewhere/foo/ and then set url
> to point at the symlink. This way I can prevent it from finding the
> other directory.
> 
> I thought I'd mention this in the hopes git can be fixed to behave
> better in this situation and perhaps I can drop the hacks I'm going to
> have to add sometime in the future.

I'd add that I think the commit made for the original problem[1] has
fixed this scenario since it now will prefer foo over foo.git also in
the fetch case even if the / is removed from the url. My test machines
don't have that version yet though and I'm left with a problem where git
is older than 1.7.9.2. 

[1]http://git.kernel.org/?p=git/git.git;a=commit;h=b3256eb8b35937192e85725d0c2bcb422295790c

Cheers,

Richard

  reply	other threads:[~2012-08-18 14:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-18 14:25 Problems with git fetch confusing foo and foo.git repos Richard Purdie
2012-08-18 14:49 ` Richard Purdie [this message]
2012-08-18 20:33   ` Junio C Hamano
2012-08-18 22:06     ` Richard Purdie

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=1345301383.27428.55.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=Bruce.Ashfield@windriver.com \
    --cc=git@vger.kernel.org \
    --cc=saul.wold@intel.com \
    /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).