* remote does not support deleting refs @ 2008-07-05 21:22 Martin 2008-07-06 0:20 ` error: unlink(.git/refs/remotes/origin/testbranch) failed: was " Martin 2008-07-06 13:29 ` Dmitry Potapov 0 siblings, 2 replies; 6+ messages in thread From: Martin @ 2008-07-05 21:22 UTC (permalink / raw) To: git Hi, I tried to setup a central git repository. Access is via ssh. How do I delete a remote branch? If I try it using > git branch -d -r origin/testbranch > git push origin :refs/heads/testbranch I get the error To ssh://myserver.com/my/path/to/repository ! [rejected] testbranch (remote does not support deleting refs) error: failed to push some refs to 'ssh://myserver.com/my/path/to/repository' So how do I setup my remote repository to allow deleting remote branches? Thanks, Martin ^ permalink raw reply [flat|nested] 6+ messages in thread
* error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs 2008-07-05 21:22 remote does not support deleting refs Martin @ 2008-07-06 0:20 ` Martin 2008-07-06 18:34 ` Dmitry Potapov 2008-07-06 13:29 ` Dmitry Potapov 1 sibling, 1 reply; 6+ messages in thread From: Martin @ 2008-07-06 0:20 UTC (permalink / raw) To: git Hi, it seems that an old verison on the remote site was the problem: On debian/etch git seems to be too old. I upgraded git to the testing version and now I can delete remote branches. But I get another error: $ git push origin :testbranch To ssh://myserver.com/my/path/to/repository - [deleted] testbranch error: unlink(.git/refs/remotes/origin/testbranch) failed: No such file or directory error: Failed to delete Any idea? Thanks, Martin Martin schrieb: > Hi, > > I tried to setup a central git repository. Access is via ssh. > How do I delete a remote branch? If I try it using > > git branch -d -r origin/testbranch > > git push origin :refs/heads/testbranch > I get the error > > To ssh://myserver.com/my/path/to/repository > ! [rejected] testbranch (remote does not support deleting refs) > error: failed to push some refs to > 'ssh://myserver.com/my/path/to/repository' > > So how do I setup my remote repository to allow deleting remote branches? > > Thanks, > Martin > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs 2008-07-06 0:20 ` error: unlink(.git/refs/remotes/origin/testbranch) failed: was " Martin @ 2008-07-06 18:34 ` Dmitry Potapov 2008-07-08 4:08 ` Jeff King 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Potapov @ 2008-07-06 18:34 UTC (permalink / raw) To: Martin; +Cc: git Hi, [please do not top post] On Sun, Jul 06, 2008 at 02:20:18AM +0200, Martin wrote: >_ > But I get another error: > $ git push origin :testbranch > To ssh://myserver.com/my/path/to/repository > - [deleted] testbranch > error: unlink(.git/refs/remotes/origin/testbranch) failed: No such file_ > or directory > error: Failed to delete >_ > Any idea? It is harmless. It is just that "git push origin :refs/heads/testbranch" cannot remove your local reference to that branch because you already have removed it by running "git branch -d -r origin/testbranch" Normally you just run "git push origin :refs/heads/testbranch" without "git branch -d -r origin/testbranch" and then you will not have this error. Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs 2008-07-06 18:34 ` Dmitry Potapov @ 2008-07-08 4:08 ` Jeff King 2008-07-08 20:04 ` Junio C Hamano 0 siblings, 1 reply; 6+ messages in thread From: Jeff King @ 2008-07-08 4:08 UTC (permalink / raw) To: Dmitry Potapov; +Cc: Junio C Hamano, Martin, git On Sun, Jul 06, 2008 at 10:34:31PM +0400, Dmitry Potapov wrote: > On Sun, Jul 06, 2008 at 02:20:18AM +0200, Martin wrote: > > But I get another error: > > $ git push origin :testbranch > > To ssh://myserver.com/my/path/to/repository > > - [deleted] testbranch > > error: unlink(.git/refs/remotes/origin/testbranch) failed: No such file_ > > or directory > > error: Failed to delete > >_ > > Any idea? > > It is harmless. It is just that "git push origin :refs/heads/testbranch" > cannot remove your local reference to that branch because you already have > removed it by running "git branch -d -r origin/testbranch" It is harmless, but it still feels a little wrong to scare the user with that message, especially since "Failed to delete" is ambiguous; it looks like the main operation, deleting the remote ref, failed. But it didn't; the operation that failed was something not even explicitly asked for. How about this cleanup: -- >8 -- make deleting a missing ref more quiet If git attempts to delete a ref, but the unlink of the ref file fails, we print a message to stderr. This is usually a good thing, but if the error is ENOENT, then it indicates that the ref has _already_ been deleted. And since that's our goal, it doesn't make sense to complain to the user. This harmonizes the error reporting behavior for the unpacked and packed cases; the packed case already printed nothing on ENOENT, but the unpacked printed unconditionally. Additionally, send-pack would, when deleting the tracking ref corresponding to a remote delete, print "Failed to delete" on any failure. This can be a misleading message, since we actually _did_ delete at the remote side, but we failed to delete locally. Rather than make the message more precise, let's just eliminate it entirely; the delete_ref routine already takes care of printing out a much more specific message about what went wrong. Signed-off-by: Jeff King <peff@peff.net> --- builtin-send-pack.c | 3 +-- refs.c | 2 +- t/t5404-tracking-branches.sh | 7 +++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/builtin-send-pack.c b/builtin-send-pack.c index d76260c..a708d0a 100644 --- a/builtin-send-pack.c +++ b/builtin-send-pack.c @@ -226,8 +226,7 @@ static void update_tracking_ref(struct remote *remote, struct ref *ref) if (args.verbose) fprintf(stderr, "updating local tracking ref '%s'\n", rs.dst); if (ref->deletion) { - if (delete_ref(rs.dst, NULL)) - error("Failed to delete"); + delete_ref(rs.dst, NULL); } else update_ref("update by push", rs.dst, ref->new_sha1, NULL, 0, 0); diff --git a/refs.c b/refs.c index 6c6e9e5..39a3b23 100644 --- a/refs.c +++ b/refs.c @@ -925,7 +925,7 @@ int delete_ref(const char *refname, const unsigned char *sha1) i = strlen(lock->lk->filename) - 5; /* .lock */ lock->lk->filename[i] = 0; err = unlink(lock->lk->filename); - if (err) { + if (err && errno != ENOENT) { ret = 1; error("unlink(%s) failed: %s", lock->lk->filename, strerror(errno)); diff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh index 1493a92..64fe261 100755 --- a/t/t5404-tracking-branches.sh +++ b/t/t5404-tracking-branches.sh @@ -10,6 +10,7 @@ test_expect_success 'setup' ' git commit -m 1 && git branch b1 && git branch b2 && + git branch b3 && git clone . aa && git checkout b1 && echo b1 >>file && @@ -50,4 +51,10 @@ test_expect_success 'deleted branches have their tracking branches removed' ' test "$(git rev-parse origin/b1)" = "origin/b1" ' +test_expect_success 'already deleted tracking branches ignored' ' + git branch -d -r origin/b3 && + git push origin :b3 >output 2>&1 && + ! grep error output +' + test_done -- 1.5.6.2.381.ga86b ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: error: unlink(.git/refs/remotes/origin/testbranch) failed: was remote does not support deleting refs 2008-07-08 4:08 ` Jeff King @ 2008-07-08 20:04 ` Junio C Hamano 0 siblings, 0 replies; 6+ messages in thread From: Junio C Hamano @ 2008-07-08 20:04 UTC (permalink / raw) To: Jeff King; +Cc: Dmitry Potapov, Martin, git Jeff King <peff@peff.net> writes: > It is harmless, but it still feels a little wrong to scare the user with > that message, especially since "Failed to delete" is ambiguous; it looks > like the main operation, deleting the remote ref, failed. But it didn't; > the operation that failed was something not even explicitly asked for. > > How about this cleanup: Ack. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: remote does not support deleting refs 2008-07-05 21:22 remote does not support deleting refs Martin 2008-07-06 0:20 ` error: unlink(.git/refs/remotes/origin/testbranch) failed: was " Martin @ 2008-07-06 13:29 ` Dmitry Potapov 1 sibling, 0 replies; 6+ messages in thread From: Dmitry Potapov @ 2008-07-06 13:29 UTC (permalink / raw) To: Martin; +Cc: git On Sun, Jul 6, 2008 at 1:22 AM, Martin <html-kurs@gmx.de> wrote: > > To ssh://myserver.com/my/path/to/repository > ! [rejected] testbranch (remote does not support deleting refs) What version of Git do you use on the server? I think Git before v1.5 does not support deleting remote refs. You have to upgrade Git on your server. Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-07-08 20:05 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-07-05 21:22 remote does not support deleting refs Martin 2008-07-06 0:20 ` error: unlink(.git/refs/remotes/origin/testbranch) failed: was " Martin 2008-07-06 18:34 ` Dmitry Potapov 2008-07-08 4:08 ` Jeff King 2008-07-08 20:04 ` Junio C Hamano 2008-07-06 13:29 ` Dmitry Potapov
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).