summaryrefslogtreecommitdiff
path: root/builtin-merge-recursive.c
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2008-09-29 10:52:34 -0700
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-09-29 10:52:34 -0700
commit5a139ba483efea47e103fef47afe87157e3bba77 (patch)
tree9b387acffb4bd7b886d2a1b05e18832ad079bff9 /builtin-merge-recursive.c
parentt4018-diff-funcname: test syntax of builtin xfuncname patterns (diff)
parentMerge branch 'bc/maint-diff-hunk-header-fix' into maint (diff)
downloadtgif-5a139ba483efea47e103fef47afe87157e3bba77.tar.xz
Merge branch 'maint' into bc/master-diff-hunk-header-fix
* maint: (41 commits) Clarify commit error message for unmerged files Use strchrnul() instead of strchr() plus manual workaround Use remove_path from dir.c instead of own implementation Add remove_path: a function to remove as much as possible of a path git-submodule: Fix "Unable to checkout" for the initial 'update' Clarify how the user can satisfy stash's 'dirty state' check. Remove empty directories in recursive merge Documentation: clarify the details of overriding LESS via core.pager Update release notes for 1.6.0.3 checkout: Do not show local changes when in quiet mode for-each-ref: Fix --format=%(subject) for log message without newlines git-stash.sh: don't default to refs/stash if invalid ref supplied maint: check return of split_cmdline to avoid bad config strings builtin-prune.c: prune temporary packs in <object_dir>/pack directory Do not perform cross-directory renames when creating packs Use dashless git commands in setgitperms.perl git-remote: do not use user input in a printf format string make "git remote" report multiple URLs Start draft release notes for 1.6.0.3 git-repack uses --no-repack-object, not --no-repack-delta. ... Conflicts: RelNotes
Diffstat (limited to 'builtin-merge-recursive.c')
-rw-r--r--builtin-merge-recursive.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c
index dfb363ee2f..36aa798459 100644
--- a/builtin-merge-recursive.c
+++ b/builtin-merge-recursive.c
@@ -18,6 +18,7 @@
#include "ll-merge.h"
#include "interpolate.h"
#include "attr.h"
+#include "dir.h"
#include "merge-recursive.h"
static int subtree_merge;
@@ -416,24 +417,6 @@ static int update_stages(const char *path, struct diff_filespec *o,
return 0;
}
-static int remove_path(const char *name)
-{
- int ret;
- char *slash, *dirs;
-
- ret = unlink(name);
- if (ret)
- return ret;
- dirs = xstrdup(name);
- while ((slash = strrchr(name, '/'))) {
- *slash = '\0';
- if (rmdir(name) != 0)
- break;
- }
- free(dirs);
- return ret;
-}
-
static int remove_file(int clean, const char *path, int no_wd)
{
int update_cache = index_only || clean;
@@ -444,10 +427,8 @@ static int remove_file(int clean, const char *path, int no_wd)
return -1;
}
if (update_working_directory) {
- unlink(path);
- if (errno != ENOENT || errno != EISDIR)
+ if (remove_path(path))
return -1;
- remove_path(path);
}
return 0;
}