{"thread":{"id":"8816","subject":"git-fetch will leave a ref pointing to a tag","startedAt":"2007-07-02T19:44:37Z","lastAt":"2007-07-03T13:59:18Z","messageCount":8,"participants":["linux@horizon.com","Johannes Schindelin","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"46268","messageId":"20070702194437.19202.qmail@science.horizon.com","threadId":"8816","inReplyTo":null,"subject":"git-fetch will leave a ref pointing to a tag","fromName":"","fromEmail":"linux@horizon.com","sentAt":"2007-07-02T19:44:37Z","receivedAt":"2007-07-02T19:44:37Z","isPatch":false,"sender":{"key":"linux@horizon.com","avatar":null},"body":"I did this while trying to force a fast-forward merge (I wanted an\nerror message if I had changes to merge), and got a somewhat obscure\nerror message:\n\n$ git branch temp tags/v2.6.22-rc6\n$ git fetch . tags/v2.6.22-rc7:temp\n$ git checkout temp\n$ (make minor change)\n$ git commit -a\nfatal: 087ea061253277de2b27e82d8572a386835a1b7e is not a valid 'commit' object\n\ngit-fetch does odd things when handed a tag rather than a commit.\nAlso, should \"git checkout\" have complained?\n"},{"id":"46278","messageId":"Pine.LNX.4.64.0707022207420.4071@racer.site","threadId":"8816","inReplyTo":"20070702194437.19202.qmail@science.horizon.com","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-02T21:14:01Z","receivedAt":"2007-07-02T21:14:01Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 2 Jul 2007, linux@horizon.com wrote:\n\n> $ git branch temp tags/v2.6.22-rc6\n> $ git fetch . tags/v2.6.22-rc7:temp\n\nWhy not do 'git branch temp v2.6.22-rc7' to begin with? Or even better: \ngit checkout -b temp v2.6.22-rc7.\n\nBut in any case, you should know that there is no floating tag in git, and \ntherefore, by storing it in the \"branch\" temp, you doom that branch to \nnot be able to be committed to.\n\nWhat you should have done, of course, is\n\n$ git checkout temp\n$ git merge v2.6.22-rc7\n\n> $ git checkout temp\n> $ (make minor change)\n> $ git commit -a\n> fatal: 087ea061253277de2b27e82d8572a386835a1b7e is not a valid 'commit' object\n> \n> git-fetch does odd things when handed a tag rather than a commit.\n\nNo. It is perfectly sane to fetch a tag, and to store it.\n\n> Also, should \"git checkout\" have complained?\n\nMaybe. Dunno.\n\nCiao,\nDscho\n"},{"id":"46296","messageId":"7v4pkmwgda.fsf@assigned-by-dhcp.cox.net","threadId":"8816","inReplyTo":"Pine.LNX.4.64.0707022207420.4071@racer.site","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-02T23:11:29Z","receivedAt":"2007-07-02T23:11:29Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Mon, 2 Jul 2007, linux@horizon.com wrote:\n>\n>> $ git branch temp tags/v2.6.22-rc6\n>> $ git fetch . tags/v2.6.22-rc7:temp\n> ...\n> No. It is perfectly sane to fetch a tag, and to store it.\n\nYes, but not to a branch.\n\nAnything under refs/heads/ should point at a commit and if we\nallowed a tag to be pointed at, you probably can argue that is a\nbug.\n"},{"id":"46303","messageId":"Pine.LNX.4.64.0707030028280.4071@racer.site","threadId":"8816","inReplyTo":"7v4pkmwgda.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-02T23:29:07Z","receivedAt":"2007-07-02T23:29:07Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 2 Jul 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On Mon, 2 Jul 2007, linux@horizon.com wrote:\n> >\n> >> $ git branch temp tags/v2.6.22-rc6\n> >> $ git fetch . tags/v2.6.22-rc7:temp\n> > ...\n> > No. It is perfectly sane to fetch a tag, and to store it.\n> \n> Yes, but not to a branch.\n\nOoops. I forgot to write that (as the \"No\" at the beginning suggests...).\n\nThank you,\nDscho\n"},{"id":"46316","messageId":"20070703032315.7279.qmail@science.horizon.com","threadId":"8816","inReplyTo":"Pine.LNX.4.64.0707022207420.4071@racer.site","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"","fromEmail":"linux@horizon.com","sentAt":"2007-07-03T03:23:15Z","receivedAt":"2007-07-03T03:23:15Z","isPatch":false,"sender":{"key":"linux@horizon.com","avatar":null},"body":"> Why not do 'git branch temp v2.6.22-rc7' to begin with? Or even better: \n> git checkout -b temp v2.6.22-rc7.\n\nIn my case, it was the \"master\" branch; I couldn't remember if I'd done\nany hacking on it.  But I used the branch name \"temp\" while demonstrating\nhow to recreate the problem.\n\n> But in any case, you should know that there is no floating tag in git, and \n> therefore, by storing it in the \"branch\" temp, you doom that branch to \n> not be able to be committed to.\n\nI just wanted to fast-forward my master to -rc7, like the git-merge-ff\nutility that's been floating around.\n\n> What you should have done, of course, is\n> \n> $ git checkout temp\n> $ git merge v2.6.22-rc7\n\nBut if I'd have changes to my master, I would have examined them and\neither rebased them or assigned a branch name.  It was just a way to\neither do what I wanted or get an error message, all in one step.\n\n>> $ git checkout temp\n>> $ (make minor change)\n>> $ git commit -a\n>> fatal: 087ea061253277de2b27e82d8572a386835a1b7e is not a valid 'commit' object\n>> \n>> git-fetch does odd things when handed a tag rather than a commit.\n\n> No. It is perfectly sane to fetch a tag, and to store it.\n\nI suppose, but should the result be put in the \"refs/heads\" directory?\n\nAnd until git-merge-ff is available, what's the recommended way to\n\"advance master to tag <foo>, but only if that wouldn't lose anything?\"\n"},{"id":"46323","messageId":"20070703041859.GB4007@coredump.intra.peff.net","threadId":"8816","inReplyTo":"20070703032315.7279.qmail@science.horizon.com","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-03T04:18:59Z","receivedAt":"2007-07-03T04:18:59Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jul 02, 2007 at 11:23:15PM -0400, linux@horizon.com wrote:\n\n> And until git-merge-ff is available, what's the recommended way to\n> \"advance master to tag <foo>, but only if that wouldn't lose anything?\"\n\nYou can ask \"do I have anything that foo doesn't?\":\n\n  test \"`git-rev-list foo.. | wc -l`\" -gt 0\n\n-Peff\n"},{"id":"46351","messageId":"Pine.LNX.4.64.0707031257590.4071@racer.site","threadId":"8816","inReplyTo":"20070703041859.GB4007@coredump.intra.peff.net","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-03T12:01:49Z","receivedAt":"2007-07-03T12:01:49Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 3 Jul 2007, Jeff King wrote:\n\n> On Mon, Jul 02, 2007 at 11:23:15PM -0400, linux@horizon.com wrote:\n> \n> > And until git-merge-ff is available, what's the recommended way to\n> > \"advance master to tag <foo>, but only if that wouldn't lose anything?\"\n> \n> You can ask \"do I have anything that foo doesn't?\":\n> \n>   test \"`git-rev-list foo.. | wc -l`\" -gt 0\n\nIf it is only the test, you can do that by\n\n\ttest $(git merge-base foo bar) = $(git rev-parse foo)\n\n(which tests if foo is a stricth ancestor of bar). Although in your \n(linux@horizon.com's) place I would really look at \"git log foo..\" myself, \nas peff almost suggested.\n\nFor if you (linux@horizon.com) _have_ changes, you want to know which \nchanges they are, right?\n\nOf course, it seems to me that what you (linux@horizon.com; do you really \nhave no proper name?) _really_ wanted to do is \"git rebase v2.6.22-rc7\".\n\nCiao,\nDscho\n"},{"id":"46365","messageId":"20070703135918.GA18597@coredump.intra.peff.net","threadId":"8816","inReplyTo":"Pine.LNX.4.64.0707031257590.4071@racer.site","subject":"Re: git-fetch will leave a ref pointing to a tag","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-07-03T13:59:18Z","receivedAt":"2007-07-03T13:59:18Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jul 03, 2007 at 01:01:49PM +0100, Johannes Schindelin wrote:\n\n> If it is only the test, you can do that by\n> \n> \ttest $(git merge-base foo bar) = $(git rev-parse foo)\n\nI had thought that calculating the merge base was actually slightly less\nefficient in this case, since it will actually find all of the merge\nbases (but I could very well be wrong). But really, either should\nproduce the result effectively instantaneously.\n\n> (which tests if foo is a stricth ancestor of bar). Although in your \n> (linux@horizon.com's) place I would really look at \"git log foo..\" myself, \n> as peff almost suggested.\n\nYes. In fact, I find an even more useful operation in that case to be\n\"gitk foo...\" to see \"where I'm at\" with respect to my changes and\nupstream changes.\n\n-Peff\n"}]}