submodule: used correct index in is_staging_gitmodules_ok
[gitweb.git] / merge-recursive.c
index 1d3f8f0d22157e11c1e0db6f230e39240d2f3e63..d00b274381e7fff7efd2b38f4328764105d9d7af 100644 (file)
@@ -540,8 +540,8 @@ static struct string_list *get_renames(struct merge_options *o,
                return renames;
 
        diff_setup(&opts);
-       DIFF_OPT_SET(&opts, RECURSIVE);
-       DIFF_OPT_CLR(&opts, RENAME_EMPTY);
+       opts.flags.recursive = 1;
+       opts.flags.rename_empty = 0;
        opts.detect_rename = DIFF_DETECT_RENAME;
        opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit :
                            o->diff_rename_limit >= 0 ? o->diff_rename_limit :
@@ -1901,8 +1901,9 @@ static int process_entry(struct merge_options *o,
                        oid = b_oid;
                        conf = _("directory/file");
                }
-               if (dir_in_way(path, !o->call_depth,
-                              S_ISGITLINK(a_mode))) {
+               if (dir_in_way(path,
+                              !o->call_depth && !S_ISGITLINK(a_mode),
+                              0)) {
                        char *new_path = unique_path(o, path, add_branch);
                        clean_merge = 0;
                        output(o, 1, _("CONFLICT (%s): There is a directory with name %s in %s. "
@@ -2162,7 +2163,7 @@ int merge_recursive_generic(struct merge_options *o,
                            struct commit **result)
 {
        int clean;
-       struct lock_file *lock = xcalloc(1, sizeof(struct lock_file));
+       struct lock_file lock = LOCK_INIT;
        struct commit *head_commit = get_ref(head, o->branch1);
        struct commit *next_commit = get_ref(merge, o->branch2);
        struct commit_list *ca = NULL;
@@ -2178,14 +2179,14 @@ int merge_recursive_generic(struct merge_options *o,
                }
        }
 
-       hold_locked_index(lock, LOCK_DIE_ON_ERROR);
+       hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
        clean = merge_recursive(o, head_commit, next_commit, ca,
                        result);
        if (clean < 0)
                return clean;
 
        if (active_cache_changed &&
-           write_locked_index(&the_index, lock, COMMIT_LOCK))
+           write_locked_index(&the_index, &lock, COMMIT_LOCK))
                return err(o, _("Unable to write index."));
 
        return clean ? 0 : 1;
@@ -2201,6 +2202,7 @@ static void merge_recursive_config(struct merge_options *o)
 
 void init_merge_options(struct merge_options *o)
 {
+       const char *merge_verbosity;
        memset(o, 0, sizeof(struct merge_options));
        o->verbosity = 2;
        o->buffer_output = 1;
@@ -2209,9 +2211,9 @@ void init_merge_options(struct merge_options *o)
        o->renormalize = 0;
        o->detect_rename = 1;
        merge_recursive_config(o);
-       if (getenv("GIT_MERGE_VERBOSITY"))
-               o->verbosity =
-                       strtol(getenv("GIT_MERGE_VERBOSITY"), NULL, 10);
+       merge_verbosity = getenv("GIT_MERGE_VERBOSITY");
+       if (merge_verbosity)
+               o->verbosity = strtol(merge_verbosity, NULL, 10);
        if (o->verbosity >= 5)
                o->buffer_output = 0;
        strbuf_init(&o->obuf, 0);
@@ -2251,6 +2253,8 @@ int parse_merge_opt(struct merge_options *o, const char *s)
                DIFF_XDL_SET(o, IGNORE_WHITESPACE);
        else if (!strcmp(s, "ignore-space-at-eol"))
                DIFF_XDL_SET(o, IGNORE_WHITESPACE_AT_EOL);
+       else if (!strcmp(s, "ignore-cr-at-eol"))
+               DIFF_XDL_SET(o, IGNORE_CR_AT_EOL);
        else if (!strcmp(s, "renormalize"))
                o->renormalize = 1;
        else if (!strcmp(s, "no-renormalize"))