refspec: convert valid_fetch_refspec to use parse_refspec
[gitweb.git] / builtin / submodule--helper.c
index 7586f776fe3cf2140c86f1f1842389f186929201..c0c4db00736597eca7c264f70b0fc82c0246ce53 100644 (file)
@@ -12,6 +12,7 @@
 #include "run-command.h"
 #include "remote.h"
 #include "refs.h"
+#include "refspec.h"
 #include "connect.h"
 #include "revision.h"
 #include "diffcore.h"
@@ -596,8 +597,12 @@ static void print_status(unsigned int flags, char state, const char *path,
 
        printf("%c%s %s", state, oid_to_hex(oid), displaypath);
 
-       if (state == ' ' || state == '+')
-               printf(" (%s)", compute_rev_name(path, oid_to_hex(oid)));
+       if (state == ' ' || state == '+') {
+               const char *name = compute_rev_name(path, oid_to_hex(oid));
+
+               if (name)
+                       printf(" (%s)", name);
+       }
 
        printf("\n");
 }
@@ -1741,11 +1746,11 @@ static int push_check(int argc, const char **argv, const char *prefix)
        if (argc > 2) {
                int i, refspec_nr = argc - 2;
                struct ref *local_refs = get_local_heads();
-               struct refspec *refspec = parse_push_refspec(refspec_nr,
+               struct refspec_item *refspec = parse_push_refspec(refspec_nr,
                                                             argv + 2);
 
                for (i = 0; i < refspec_nr; i++) {
-                       struct refspec *rs = refspec + i;
+                       struct refspec_item *rs = refspec + i;
 
                        if (rs->pattern || rs->matching)
                                continue;