Code

Improve language in git-merge.txt and related docs
[git.git] / merge-recursive.c
index 08917314fb18a2c5af71cf96c410d2c8363a2650..a0c804c8171d021780680f11901680d4c7e89e0b 100644 (file)
@@ -16,9 +16,9 @@
 #include "string-list.h"
 #include "xdiff-interface.h"
 #include "ll-merge.h"
-#include "interpolate.h"
 #include "attr.h"
 #include "merge-recursive.h"
+#include "dir.h"
 
 static struct tree *shift_tree_object(struct tree *one, struct tree *two)
 {
@@ -392,22 +392,6 @@ static int update_stages(const char *path, struct diff_filespec *o,
        return 0;
 }
 
-static int remove_path(const char *name)
-{
-       char *slash, *dirs;
-
-       if (unlink(name))
-               return -1;
-       dirs = xstrdup(name);
-       while ((slash = strrchr(name, '/'))) {
-               *slash = '\0';
-               if (rmdir(name) != 0)
-                       break;
-       }
-       free(dirs);
-       return 0;
-}
-
 static int remove_file(struct merge_options *o, int clean,
                       const char *path, int no_wd)
 {
@@ -513,8 +497,7 @@ static void update_file_flags(struct merge_options *o,
                if (type != OBJ_BLOB)
                        die("blob expected for %s '%s'", sha1_to_hex(sha), path);
                if (S_ISREG(mode)) {
-                       struct strbuf strbuf;
-                       strbuf_init(&strbuf, 0);
+                       struct strbuf strbuf = STRBUF_INIT;
                        if (convert_to_working_tree(path, buf, size, &strbuf)) {
                                free(buf);
                                size = strbuf.len;
@@ -542,7 +525,8 @@ static void update_file_flags(struct merge_options *o,
                        char *lnk = xmemdupz(buf, size);
                        safe_create_leading_directories_const(path);
                        unlink(path);
-                       symlink(lnk, path);
+                       if (symlink(lnk, path))
+                               die("failed to symlink %s: %s", path, strerror(errno));
                        free(lnk);
                } else
                        die("do not know what to do with %06o %s '%s'",
@@ -1348,7 +1332,7 @@ static int merge_recursive_config(const char *var, const char *value, void *cb)
                o->merge_rename_limit = git_config_int(var, value);
                return 0;
        }
-       return git_default_config(var, value, cb);
+       return git_xmerge_config(var, value, cb);
 }
 
 void init_merge_options(struct merge_options *o)