Imported Upstream version 2.27.0
[platform/upstream/git.git] / ls-refs.c
index 818aef7..50d8686 100644 (file)
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -93,7 +93,7 @@ int ls_refs(struct repository *r, struct argv_array *keys,
 
        git_config(ls_refs_config, NULL);
 
-       while (packet_reader_read(request) != PACKET_READ_FLUSH) {
+       while (packet_reader_read(request) == PACKET_READ_NORMAL) {
                const char *arg = request->line;
                const char *out;
 
@@ -105,6 +105,9 @@ int ls_refs(struct repository *r, struct argv_array *keys,
                        argv_array_push(&data.prefixes, out);
        }
 
+       if (request->status != PACKET_READ_FLUSH)
+               die(_("expected flush after ls-refs arguments"));
+
        head_ref_namespaced(send_ref, &data);
        for_each_namespaced_ref(send_ref, &data);
        packet_flush(1);