submodule--helper: fix usage string for relative-path
[gitweb.git] / builtin / apply.c
index 7338ee6b68d48ec46436a621f6926be3e1252493..1a488f9e888b6e9ebb1357a6cf3f7f007cf732fe 100644 (file)
@@ -52,10 +52,7 @@ struct apply_state {
        const char *prefix;
        int prefix_length;
 
-       /*
-        * Since lockfile.c keeps a linked list of all created
-        * lock_file structures, it isn't safe to free(lock_file).
-        */
+       /* These are lock_file related */
        struct lock_file *lock_file;
        int newfd;
 
@@ -467,7 +464,7 @@ static int is_dev_null(const char *str)
 #define TERM_SPACE     1
 #define TERM_TAB       2
 
-static int name_terminate(const char *name, int namelen, int c, int terminate)
+static int name_terminate(int c, int terminate)
 {
        if (c == ' ' && !(terminate & TERM_SPACE))
                return 0;
@@ -703,7 +700,7 @@ static char *find_name_common(struct apply_state *state,
                if (!end && isspace(c)) {
                        if (c == '\n')
                                break;
-                       if (name_terminate(start, line-start, c, terminate))
+                       if (name_terminate(c, terminate))
                                break;
                }
                line++;
@@ -3362,7 +3359,7 @@ static int load_patch_target(struct apply_state *state,
 {
        if (state->cached || state->check_index) {
                if (read_file_or_gitlink(ce, buf))
-                       return error(_("read of %s failed"), name);
+                       return error(_("failed to read %s"), name);
        } else if (name) {
                if (S_ISGITLINK(expected_mode)) {
                        if (ce)
@@ -3373,7 +3370,7 @@ static int load_patch_target(struct apply_state *state,
                        return error(_("reading from '%s' beyond a symbolic link"), name);
                } else {
                        if (read_old_data(st, name, buf))
-                               return error(_("read of %s failed"), name);
+                               return error(_("failed to read %s"), name);
                }
        }
        return 0;
@@ -3419,7 +3416,7 @@ static int load_preimage(struct apply_state *state,
                        free_fragment_list(patch->fragments);
                        patch->fragments = NULL;
                } else if (status) {
-                       return error(_("read of %s failed"), patch->old_name);
+                       return error(_("failed to read %s"), patch->old_name);
                }
        }
 
@@ -4670,6 +4667,9 @@ static void init_apply_state(struct apply_state *state,
        state->ws_error_action = warn_on_ws_error;
        state->ws_ignore_action = ignore_ws_none;
        state->linenr = 1;
+       string_list_init(&state->fn_table, 0);
+       string_list_init(&state->limit_by_name, 0);
+       string_list_init(&state->symlink_changes, 0);
        strbuf_init(&state->root, 0);
 
        git_apply_config();