{"thread":{"id":"35538","subject":"git fetch doesn't ignore funny refs","startedAt":"2013-12-17T12:35:33Z","lastAt":"2014-01-05T01:22:51Z","messageCount":2,"participants":["Lorenzo Keller","Heiko Voigt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"232096","messageId":"52B04515.8020609@marvell.com","threadId":"35538","inReplyTo":null,"subject":"git fetch doesn't ignore funny refs","fromName":"Lorenzo Keller","fromEmail":"lkeller@marvell.com","sentAt":"2013-12-17T12:35:33Z","receivedAt":"2013-12-17T12:35:33Z","isPatch":false,"sender":{"key":"lkeller@marvell.com","avatar":null},"body":"Hello,\n\nI'm trying to maintain a mirror of a repo that is published with gerrit.\nThe repo contains\na \"funny ref\" with name 'refs/tags/xyz/...' .\n\nWhen I clone the repo the ref is correctly ignored:\n\n> git clone --mirror ssh://server:29418/repo\n\nCloning into bare repository 'repo.git'...\nerror: * Ignoring funny ref 'refs/tags/xyz/...' locally\nremote: Counting objects: 58263, done\nremote: Finding sources: 100% (58263/58263)\nremote: Total 58263 (delta 40882), reused 58131 (delta 40882)\nReceiving objects: 100% (58263/58263), 16.10 MiB | 163.00 KiB/s, done.\nResolving deltas: 100% (40882/40882), done.\nChecking connectivity... done.\n\nWhen I try to update the mirror, however, the command fails:\n\n> git remote update\n\nFetching origin\nerror: * Ignoring funny ref refs/tags/xyz/...' locally\nFrom ssh://server:29418/repo\n ! [new tag]         xyz/... -> xyz/...  (unable to update local ref)\nerror: Could not fetch origin\n\nDoing a fetch also fails:\n\n> git fetch --all\n\nFetching origin\nerror: * Ignoring funny ref 'refs/tags/xyz/...' locally\nFrom ssh://server:29418/repo\n ! [new tag]         xyz/... -> xyz/...  (unable to update local ref)\nerror: Could not fetch origin\n\nIf I force not to update the tags, then the command is successful:\n\n> git fetch --all -n\n\nFetching origin\nerror: * Ignoring funny ref 'refs/tags/xyz/...' locally\n\nI believe the problem is due to the fact that in function\nfind_non_local_tags() in file builtins/fetch.c\nthe refs are directly obtained from the transport and not filtered for\nfunny entries.\n\nA check as this one:\n\nif (check_refname_format(ref->name, 0))\n   continue;\n\nfixes the problem for me.\n\nI report here bug and fix in the hope it can be reviewed and integrated\nin future git releases.\n\nBest regards,\nLorenzo Keller\n"},{"id":"232656","messageId":"20140105012251.GA12969@book-mint","threadId":"35538","inReplyTo":"52B04515.8020609@marvell.com","subject":"Re: git fetch doesn't ignore funny refs","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2014-01-05T01:22:51Z","receivedAt":"2014-01-05T01:22:51Z","isPatch":false,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Tue, Dec 17, 2013 at 01:35:33PM +0100, Lorenzo Keller wrote:\n> A check as this one:\n> \n> if (check_refname_format(ref->name, 0))\n>    continue;\n> \n> fixes the problem for me.\n> \n> I report here bug and fix in the hope it can be reviewed and integrated\n> in future git releases.\n\nSince it seems you already have a fix: How about sending a proper patch\n(possibly you want to extend this with a warning message) so people can\ndiscuss and integrate your fix here? See Documentation/SubmittingPatches\nfor further information.\n\nCheers Heiko\n"}]}