summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fetch-pack.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index cb21715..6565982 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -458,5 +458,19 @@ int main(int argc, char **argv)
close(fd[0]);
close(fd[1]);
finish_connect(pid);
+
+ if (!ret && nr_heads) {
+ /* If the heads to pull were given, we should have
+ * consumed all of them by matching the remote.
+ * Otherwise, 'git-fetch remote no-such-ref' would
+ * silently succeed without issuing an error.
+ */
+ for (i = 0; i < nr_heads; i++)
+ if (heads[i] && heads[i][0]) {
+ error("no such remote ref %s", heads[i]);
+ ret = 1;
+ }
+ }
+
return ret;
}