Code

sha1_file.c: fix typo
[git.git] / builtin-update-index.c
index 3a2291b03e23fbcf6b8dc6fffedd4d7dcf072aaa..dd43d5bef425af318a884bfc235a4aff40931633 100644 (file)
@@ -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;
@@ -488,7 +486,7 @@ static int unresolve_one(const char *path)
 static void read_head_pointers(void)
 {
        if (read_ref("HEAD", head_sha1))
-               die("No HEAD -- no initial commit yet?\n");
+               die("No HEAD -- no initial commit yet?");
        if (read_ref("MERGE_HEAD", merge_head_sha1)) {
                fprintf(stderr, "Not in the middle of a merge.\n");
                exit(0);
@@ -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;
@@ -746,8 +742,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
                if (newfd < 0) {
                        if (refresh_flags & REFRESH_QUIET)
                                exit(128);
-                       die("unable to create '%s.lock': %s",
-                           get_index_file(), strerror(lock_error));
+                       unable_to_lock_index_die(get_index_file(), lock_error);
                }
                if (write_cache(newfd, active_cache, active_nr) ||
                    commit_locked_index(lock_file))