X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=merge-recursive.c;h=7472d3ecc9b8412a697a64c1307259a104e0abf9;hb=dd7f5f105a1d4d094a96c5e3f251854f81106be0;hp=ac90fd9e2719a0084e45c195a446ee0571acb8e3;hpb=eb53586ba94087d9750c58d29ff494e5c1a95207;p=git.git diff --git a/merge-recursive.c b/merge-recursive.c index ac90fd9e2..7472d3ecc 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -19,6 +19,7 @@ #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 +393,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) { @@ -419,10 +404,8 @@ static int remove_file(struct merge_options *o, int clean, return -1; } if (update_working_directory) { - unlink(path); - if (errno != ENOENT || errno != EISDIR) + if (remove_path(path) && errno != ENOENT) return -1; - remove_path(path); } return 0; } @@ -515,8 +498,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; @@ -1350,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)