{"thread":{"id":"2744","subject":"[PATCH] Warn when send-pack does nothing","startedAt":"2005-12-04T16:59:37Z","lastAt":"2005-12-04T16:59:37Z","messageCount":1,"participants":["Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"13175","messageId":"Pine.LNX.4.64.0512041141280.25300@iabervon.org","threadId":"2744","inReplyTo":null,"subject":"[PATCH] Warn when send-pack does nothing","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2005-12-04T16:59:37Z","receivedAt":"2005-12-04T16:59:37Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"If you try to push into an empty repository with no ref arguments to\ngit push, it doesn't do anything and doesn't say anything. This adds a\nwarning when send-pack isn't going to push anything, so you don't\nassume that it silently did what you wanted.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n\n---\n\n send-pack.c |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\napplies-to: fe523a4df93cce3e5c5b0266b9d3f1cbea009afa\n5519af6444d6da0ac55343fe48fe7f68fdb593d9\ndiff --git a/send-pack.c b/send-pack.c\nindex 3eeb18f..589e1f9 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -190,6 +190,12 @@ static int send_pack(int in, int out, in\n \tif (match_refs(local_refs, remote_refs, &remote_tail,\n \t\t       nr_refspec, refspec, send_all))\n \t\treturn -1;\n+\n+\tif (!remote_refs) {\n+\t\tfprintf(stderr, \"No refs in common and none specified; doing nothing.\\n\");\n+\t\treturn 0;\n+\t}\n+\n \t/*\n \t * Finally, tell the other end!\n \t */\n---\n0.99.9.GIT\n"}]}