refs.c: allow listing and deleting badly named refs
[gitweb.git] / builtin / update-index.c
index b0503f4e3d80de42b3b31858303a8e0cbda2b9e4..b0e3dc91055ec7e7579fb5f1964879a99fd71606 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
+#include "lockfile.h"
 #include "quote.h"
 #include "cache-tree.h"
 #include "tree-walk.h"
@@ -640,6 +641,9 @@ static int parse_new_style_cacheinfo(const char *arg,
        unsigned long ul;
        char *endp;
 
+       if (!arg)
+               return -1;
+
        errno = 0;
        ul = strtoul(arg, &endp, 8);
        if (errno || endp == arg || *endp != ',' || (unsigned int) ul != ul)
@@ -939,7 +943,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                if (newfd < 0) {
                        if (refresh_args.flags & REFRESH_QUIET)
                                exit(128);
-                       unable_to_lock_index_die(get_index_file(), lock_error);
+                       unable_to_lock_die(get_index_file(), lock_error);
                }
                if (write_locked_index(&the_index, lock_file, COMMIT_LOCK))
                        die("Unable to write new index file");