Code

notes: fix core.notesRef documentation
[git.git] / builtin-update-index.c
index 417f9724abdce3c49df316505eff1019126a5058..65d5775107f9013526cc5b288a80a00b449e8814 100644 (file)
@@ -218,7 +218,7 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
        struct cache_entry *ce;
 
        if (!verify_path(path))
-               return -1;
+               return error("Invalid path '%s'", path);
 
        len = strlen(path);
        size = cache_entry_size(len);
@@ -297,11 +297,9 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
 
 static void read_index_info(int line_termination)
 {
-       struct strbuf buf;
-       struct strbuf uq;
+       struct strbuf buf = STRBUF_INIT;
+       struct strbuf uq = STRBUF_INIT;
 
-       strbuf_init(&buf, 0);
-       strbuf_init(&uq, 0);
        while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
                char *ptr, *tab;
                char *path_name;
@@ -717,10 +715,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                        free((char*)p);
        }
        if (read_from_stdin) {
-               struct strbuf buf, nbuf;
+               struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
 
-               strbuf_init(&buf, 0);
-               strbuf_init(&nbuf, 0);
                setup_work_tree();
                while (strbuf_getline(&buf, stdin, line_termination) != EOF) {
                        const char *p;