git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Bash <bash@genarts.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: git@vger.kernel.org
Subject: refs/original breaks git-clone for tags (was Re: Tags, Grafts, and Clones, oh my!)
Date: Fri, 20 Aug 2010 15:08:49 -0400 (EDT)	[thread overview]
Message-ID: <32751199.117741.1282331329553.JavaMail.root@mail.hq.genarts.com> (raw)
In-Reply-To: <5054888.117464.1282315250235.JavaMail.root@mail.hq.genarts.com>

> > Thanks for the testcase! Offhand, it definitely looks like a bug.
> > I'm
> > investigating to figure out which part of the chain is at fault.
> 
> No problem. I was very happily to isolate it outside the large repo I
> was working with...
> 
> Data from further testing:
> - doing a "normal" local clone doesn't emit the error
> - a remote clone over ssh does emit the error (so it's not just
> file:///)
> - in a brand new repo (init'ed, not cloned) 'git fetch ../foo
> refs/tags/tagFoo:refs/tags/tagFoo' fails:
> error: unable to find 28fffee... (sha of tag object)
> - in a brand new repo 'git fetch ../foo
> refs/heads/branchFoo:ref/heads/branchFoo' succeeds, and correctly
> fetches tagFoo (where branchFoo is created via 'git checkout -b
> branchFoo tagFoo')

After a lot of guess and check, it appears the issue is somehow related to the refs/original directory created by filter-branch.  If that directory is moved out of refs/ or deleted the clone succeeds.  Digging further, a simple rename of refs/original/refs/tags/tagFoo to anything else also fixes the problem.

A simplified test case is:

git init foo
cd foo
echo A >> foo.txt
git add foo.txt
git commit -m "Created foo"
git tag -am "Tagging foo" tagFoo
git filter-branch --env-filter 'export GIT_AUTHOR_NAME=xyz123' --tag-name-filter cat -- --all
cd ..
git clone file:///`pwd`/foo newFoo

git clone will "succeed" (exit 0), but throw the error 

   error: refs/tags/tagFoo does not point to a valid object!

and the tagFoo will not exist in the new repo.

(The env-filter is arbitrary, just need something that will force a commit rewrite)  For this bug to occur, the filter-branch must create refs/original/refs/tags/tagFoo, so if the filter-branch command is 

git filter-branch --env-filter 'export GIT_AUTHOR_NAME=xyz123' --tag-name-filter cat master

filter-branch will happily rewrite the tag, but won't create the offending file, so the clone will succeed without error (and the tag will exist in the new repo).  

Removing refs/original is a pretty trivial work-around, so I'm going to modify my scripts and continue working on my SVN transition.  Let me know if I can be of any assistance tracking down the actual bug.

Thanks,
Stephen

  reply	other threads:[~2010-08-20 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <29380346.117285.1282264933599.JavaMail.root@mail.hq.genarts.com>
2010-08-20  0:54 ` Tags, Grafts, and Clones, oh my! Stephen Bash
2010-08-20  6:15   ` Ramkumar Ramachandra
2010-08-20 13:00     ` Stephen Bash
2010-08-20 13:39       ` Ramkumar Ramachandra
2010-08-20 14:40         ` Stephen Bash
2010-08-20 19:08           ` Stephen Bash [this message]
2010-09-07 23:14             ` refs/original breaks git-clone for tags Jonathan Nieder

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=32751199.117741.1282331329553.JavaMail.root@mail.hq.genarts.com \
    --to=bash@genarts.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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).