{"thread":{"id":"14302","subject":"remote does not support deleting refs","startedAt":"2008-07-05T21:22:10Z","lastAt":"2008-07-08T20:04:20Z","messageCount":6,"participants":["Martin","Dmitry Potapov","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"82306","messageId":"486FE602.3060301@gmx.de","threadId":"14302","inReplyTo":null,"subject":"remote does not support deleting refs","fromName":"Martin","fromEmail":"html-kurs@gmx.de","sentAt":"2008-07-05T21:22:10Z","receivedAt":"2008-07-05T21:22:10Z","isPatch":false,"sender":{"key":"html-kurs@gmx.de","avatar":null},"body":"Hi,\n\nI tried to setup a central git repository. Access is via ssh.\nHow do I delete a remote branch? If I try it using\n > git branch -d -r origin/testbranch\n > git push origin :refs/heads/testbranch\nI get the error\n\nTo ssh://myserver.com/my/path/to/repository\n  ! [rejected]        testbranch (remote does not support deleting refs)\nerror: failed to push some refs to \n'ssh://myserver.com/my/path/to/repository'\n\nSo how do I setup my remote repository to allow deleting remote branches?\n\nThanks,\nMartin\n"},{"id":"82313","messageId":"48700FC2.8080307@gmx.de","threadId":"14302","inReplyTo":"486FE602.3060301@gmx.de","subject":"error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs","fromName":"Martin","fromEmail":"html-kurs@gmx.de","sentAt":"2008-07-06T00:20:18Z","receivedAt":"2008-07-06T00:20:18Z","isPatch":false,"sender":{"key":"html-kurs@gmx.de","avatar":null},"body":"Hi,\n\nit seems that an old verison on the remote site was the problem:\nOn debian/etch git seems to be too old. I upgraded git to the testing \nversion and now I can delete remote branches.\n\nBut I get another error:\n$ git push origin :testbranch\nTo ssh://myserver.com/my/path/to/repository\n  - [deleted]         testbranch\nerror: unlink(.git/refs/remotes/origin/testbranch) failed: No such file \nor directory\nerror: Failed to delete\n\nAny idea?\n\nThanks,\nMartin\n\nMartin schrieb:\n> Hi,\n> \n> I tried to setup a central git repository. Access is via ssh.\n> How do I delete a remote branch? If I try it using\n>  > git branch -d -r origin/testbranch\n>  > git push origin :refs/heads/testbranch\n> I get the error\n> \n> To ssh://myserver.com/my/path/to/repository\n>  ! [rejected]        testbranch (remote does not support deleting refs)\n> error: failed to push some refs to \n> 'ssh://myserver.com/my/path/to/repository'\n> \n> So how do I setup my remote repository to allow deleting remote branches?\n> \n> Thanks,\n> Martin\n> -- \n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"82367","messageId":"37fcd2780807060629gbbbb2eai5ecfde6afe8c18b0@mail.gmail.com","threadId":"14302","inReplyTo":"486FE602.3060301@gmx.de","subject":"Re: remote does not support deleting refs","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-06T13:29:33Z","receivedAt":"2008-07-06T13:29:33Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Sun, Jul 6, 2008 at 1:22 AM, Martin <html-kurs@gmx.de> wrote:\n>\n> To ssh://myserver.com/my/path/to/repository\n>  ! [rejected]        testbranch (remote does not support deleting refs)\n\nWhat version of Git do you use on the server? I think Git before v1.5 does\nnot support deleting remote refs. You have to upgrade Git on your server.\n\nDmitry\n"},{"id":"82381","messageId":"37fcd2780807061134l341ac676ueb674a976ce15e6f@mail.gmail.com","threadId":"14302","inReplyTo":"48700FC2.8080307@gmx.de","subject":"Re: error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2008-07-06T18:34:31Z","receivedAt":"2008-07-06T18:34:31Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"Hi,\n\n[please do not top post]\n\nOn Sun, Jul 06, 2008 at 02:20:18AM +0200, Martin wrote:\n>_\n> But I get another error:\n> $ git push origin :testbranch\n> To ssh://myserver.com/my/path/to/repository\n>  - [deleted]         testbranch\n> error: unlink(.git/refs/remotes/origin/testbranch) failed: No such file_\n> or directory\n> error: Failed to delete\n>_\n> Any idea?\n\nIt is harmless. It is just that \"git push origin :refs/heads/testbranch\"\ncannot remove your local reference to that branch because you already have\nremoved it by running \"git branch -d -r origin/testbranch\"\n\nNormally you just run \"git push origin :refs/heads/testbranch\" without\n\"git branch -d -r origin/testbranch\" and then you will not have this error.\n\nDmitry\n"},{"id":"82537","messageId":"20080708040801.GA7186@sigill.intra.peff.net","threadId":"14302","inReplyTo":"37fcd2780807061134l341ac676ueb674a976ce15e6f@mail.gmail.com","subject":"Re: error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-07-08T04:08:02Z","receivedAt":"2008-07-08T04:08:02Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jul 06, 2008 at 10:34:31PM +0400, Dmitry Potapov wrote:\n\n> On Sun, Jul 06, 2008 at 02:20:18AM +0200, Martin wrote:\n> > But I get another error:\n> > $ git push origin :testbranch\n> > To ssh://myserver.com/my/path/to/repository\n> >  - [deleted]         testbranch\n> > error: unlink(.git/refs/remotes/origin/testbranch) failed: No such file_\n> > or directory\n> > error: Failed to delete\n> >_\n> > Any idea?\n> \n> It is harmless. It is just that \"git push origin :refs/heads/testbranch\"\n> cannot remove your local reference to that branch because you already have\n> removed it by running \"git branch -d -r origin/testbranch\"\n\nIt is harmless, but it still feels a little wrong to scare the user with\nthat message, especially since \"Failed to delete\" is ambiguous; it looks\nlike the main operation, deleting the remote ref, failed. But it didn't;\nthe operation that failed was something not even explicitly asked for.\n\nHow about this cleanup:\n\n-- >8 --\nmake deleting a missing ref more quiet\n\nIf git attempts to delete a ref, but the unlink of the ref\nfile fails, we print a message to stderr. This is usually a\ngood thing, but if the error is ENOENT, then it indicates\nthat the ref has _already_ been deleted. And since that's\nour goal, it doesn't make sense to complain to the user.\n\nThis harmonizes the error reporting behavior for the\nunpacked and packed cases; the packed case already printed\nnothing on ENOENT, but the unpacked printed unconditionally.\n\nAdditionally, send-pack would, when deleting the tracking\nref corresponding to a remote delete, print \"Failed to\ndelete\" on any failure. This can be a misleading\nmessage, since we actually _did_ delete at the remote side,\nbut we failed to delete locally. Rather than make the\nmessage more precise, let's just eliminate it entirely; the\ndelete_ref routine already takes care of printing out a much\nmore specific message about what went wrong.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin-send-pack.c          |    3 +--\n refs.c                       |    2 +-\n t/t5404-tracking-branches.sh |    7 +++++++\n 3 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-send-pack.c b/builtin-send-pack.c\nindex d76260c..a708d0a 100644\n--- a/builtin-send-pack.c\n+++ b/builtin-send-pack.c\n@@ -226,8 +226,7 @@ static void update_tracking_ref(struct remote *remote, struct ref *ref)\n \t\tif (args.verbose)\n \t\t\tfprintf(stderr, \"updating local tracking ref '%s'\\n\", rs.dst);\n \t\tif (ref->deletion) {\n-\t\t\tif (delete_ref(rs.dst, NULL))\n-\t\t\t\terror(\"Failed to delete\");\n+\t\t\tdelete_ref(rs.dst, NULL);\n \t\t} else\n \t\t\tupdate_ref(\"update by push\", rs.dst,\n \t\t\t\t\tref->new_sha1, NULL, 0, 0);\ndiff --git a/refs.c b/refs.c\nindex 6c6e9e5..39a3b23 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -925,7 +925,7 @@ int delete_ref(const char *refname, const unsigned char *sha1)\n \t\ti = strlen(lock->lk->filename) - 5; /* .lock */\n \t\tlock->lk->filename[i] = 0;\n \t\terr = unlink(lock->lk->filename);\n-\t\tif (err) {\n+\t\tif (err && errno != ENOENT) {\n \t\t\tret = 1;\n \t\t\terror(\"unlink(%s) failed: %s\",\n \t\t\t      lock->lk->filename, strerror(errno));\ndiff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh\nindex 1493a92..64fe261 100755\n--- a/t/t5404-tracking-branches.sh\n+++ b/t/t5404-tracking-branches.sh\n@@ -10,6 +10,7 @@ test_expect_success 'setup' '\n \tgit commit -m 1 &&\n \tgit branch b1 &&\n \tgit branch b2 &&\n+\tgit branch b3 &&\n \tgit clone . aa &&\n \tgit checkout b1 &&\n \techo b1 >>file &&\n@@ -50,4 +51,10 @@ test_expect_success 'deleted branches have their tracking branches removed' '\n \ttest \"$(git rev-parse origin/b1)\" = \"origin/b1\"\n '\n \n+test_expect_success 'already deleted tracking branches ignored' '\n+\tgit branch -d -r origin/b3 &&\n+\tgit push origin :b3 >output 2>&1 &&\n+\t! grep error output\n+'\n+\n test_done\n-- \n1.5.6.2.381.ga86b\n"},{"id":"82634","messageId":"7v7ibwta63.fsf@gitster.siamese.dyndns.org","threadId":"14302","inReplyTo":"20080708040801.GA7186@sigill.intra.peff.net","subject":"Re: error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-08T20:04:20Z","receivedAt":"2008-07-08T20:04:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> It is harmless, but it still feels a little wrong to scare the user with\n> that message, especially since \"Failed to delete\" is ambiguous; it looks\n> like the main operation, deleting the remote ref, failed. But it didn't;\n> the operation that failed was something not even explicitly asked for.\n>\n> How about this cleanup:\n\nAck.\n"}]}