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

Re: git-fetch remote tag to local branch fails

From
KLKlas Lindberg <klas.lindberg@gmail.com>
Date
Jun 24, 2008, 14:01 UTC
Message-ID
<33f4f4d70806240701o1c00cef2g688a188970964b0f@mail.gmail.com>
In-Reply-To
<8aa486160806240638o221b01d2i2f46cc8f0f3760a3@mail.gmail.com>
Hello
> git tag -l

foo_tag test_tag

>
> git branch -a
>

At this point, I can create the branch "b" from "foo_tag", so the fetch did get me a remote tag. It just didn't update a local branch with the contents (or create a new one).

Something that also confuses me is that if branch "b" already exists, then
> git-pull bogustree refs/tags/foo_tag:refs/heads/b
actually does update branch "b". I find the behaviour quite inconsistent.

Unfortunately it isn't a solution for me to fetch tags and then create branches from the tags. I need to be able to update existing branches, and I have to do that without first making such a branch the current branch.

Any suggestions?
/Klas
On Tue, Jun 24, 2008 at 3:38 PM, Santi Béjar <sbejar@gmail.com> wrote:
Show 64 quoted lines
> On Tue, Jun 24, 2008 at 14:17, Klas Lindberg <klas.lindberg@gmail.com> wrote:
>> Hi
>>
>> I have a repository "bogustree" that contains tags "test_tag" and
>> "foo_tag" (both on the same branch, with "test_tag" pointing to an
>> older commit).
>> I also have repository "R", which contains "test_tag" from "bogustree"
>> and a branch "b" created from "test_tag". The active branch in R is
>> "master".
>>
>> Now I want to do the following from R:
>>
>> git-fetch bogustree refs/tags/foo_tag:refs/heads/b
>>
>> but this fails with the message given below. The interesting part is
>> that git-fetch tries to write a "non-commit object" and indeed I have
>> no idea what this thing is (the commit pointed to by "foo_tag" has
>> commit ID cab0a25388f1884a1ab16bd0d66f877c0b36f1d5).
>
> non-commit object is an object that is not a commit, like a tag, a
> blob or a tree, and you are trying to write a tag in refs/heads/. Only
> commits objects (no tags) are allowed in refs/heads/.
>
>
>> Another
>> interesting detail is that the command fails and then continues
>> anyway. That seems wrong in itself.
>>
>> # remote: Counting objects: 6, done.
>> # remote: Compressing objects: 100% (2/2), done.
>> # remote: Total 4 (delta 0), reused 0 (delta 0)
>> # Unpacking objects: 100% (4/4), done.
>> # error: Trying to write non-commit object
>> 5f61233bc5dad0f3e25ecea65457f5bb528174d2 to branch refs/heads/B
>> # From /home/qliklas/bogustree/b/b
>> #    72f0622..5f61233  foo_tag    -> b
>> # From /home/qliklas/bogustree/b/b
>> #  * [new tag]         foo_tag    -> foo_tag
>> #  * [new tag]         test_tag   -> test_tag
>
> Are you sure it is written as a branch? What is the output of "git tag
> -l" and "git branch -a"?
>
>
>>
>> Why can't I fetch like this? The manual page for git-fetch says that
>>
>>       <refspec>
>>              The canonical format of a <refspec> parameter is +?<src>:<dst>;
>>              that is, an optional plus +, followed by the source ref,
>>              followed by a colon :, followed by the destination ref.
>>
>>              The remote ref that matches <src> is fetched, and if <dst> is
>>              not empty string, the local ref that matches it is fast
>>              forwarded using <src>. Again, if the optional plus + is used,
>>              the local ref is updated even if it does not result in a fast
>>              forward update.
>>
>> so I think it should be OK?
>
> as long as <src> are commit objects.
>
> Santi
>
Previous: Santi BéjarNext: Santi Béjar
Message 3 of 10 in “git-fetch remote tag to local branch fails”
  1. Klas LindbergJun 24, 2008
  2. Santi BéjarJun 24, 2008
  3. Klas LindbergJun 24, 2008
  4. Santi BéjarJun 24, 2008
  5. Klas LindbergJun 24, 2008
  6. Klas LindbergJun 24, 2008
  7. Santi BéjarJun 24, 2008
  8. Klas LindbergJun 25, 2008
  9. Jakub NarebskiJun 25, 2008
  10. Michael J GruberJun 24, 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.