Skip to content

Commit 4c353e8

Browse files
iabervonJunio C Hamano
authored andcommitted
Warn when send-pack does nothing
If you try to push into an empty repository with no ref arguments to git push, it doesn't do anything and doesn't say anything. This adds a warning when send-pack isn't going to push anything, so you don't assume that it silently did what you wanted. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent d79374c commit 4c353e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

send-pack.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
190190
if (match_refs(local_refs, remote_refs, &remote_tail,
191191
nr_refspec, refspec, send_all))
192192
return -1;
193+
194+
if (!remote_refs) {
195+
fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
196+
return 0;
197+
}
198+
193199
/*
194200
* Finally, tell the other end!
195201
*/

0 commit comments

Comments
 (0)