summaryrefslogtreecommitdiff
path: root/builtin-rm.c
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2008-09-29 11:04:20 -0700
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2008-09-29 11:04:20 -0700
commit9800c0df412869c7949935b61581b9361fc49bd1 (patch)
tree837cb43f80452126e46ff5de641f14b7b349484f /builtin-rm.c
parentMerge branch 'jc/better-conflict-resolution' (diff)
parentMerge branch 'maint' into bc/master-diff-hunk-header-fix (diff)
downloadtgif-9800c0df412869c7949935b61581b9361fc49bd1.tar.xz
Merge branch 'bc/master-diff-hunk-header-fix'
* bc/master-diff-hunk-header-fix: 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. t4018-diff-funcname: test syntax of builtin xfuncname patterns t4018-diff-funcname: test syntax of builtin xfuncname patterns make "git remote" report multiple URLs diff hunk pattern: fix misconverted "\{" tex macro introducers diff: fix "multiple regexp" semantics to find hunk header comment diff: use extended regexp to find hunk headers diff: use extended regexp to find hunk headers diff.*.xfuncname which uses "extended" regex's for hunk header selection diff.c: associate a flag with each pattern and use it for compiling regex diff.c: return pattern entry pointer rather than just the hunk header pattern Conflicts: builtin-merge-recursive.c t/t7201-co.sh xdiff-interface.h
Diffstat (limited to 'builtin-rm.c')
-rw-r--r--builtin-rm.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/builtin-rm.c b/builtin-rm.c
index fdac34f242..50ae6d5401 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -29,26 +29,6 @@ static void add_list(const char *name)
list.name[list.nr++] = name;
}
-static int remove_file(const char *name)
-{
- int ret;
- char *slash;
-
- ret = unlink(name);
- if (ret && errno == ENOENT)
- /* The user has removed it from the filesystem by hand */
- ret = errno = 0;
-
- if (!ret && (slash = strrchr(name, '/'))) {
- char *n = xstrdup(name);
- do {
- n[slash - name] = 0;
- name = n;
- } while (!rmdir(name) && (slash = strrchr(name, '/')));
- }
- return ret;
-}
-
static int check_local_mod(unsigned char *head, int index_only)
{
/* items in list are already sorted in the cache order,
@@ -239,7 +219,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
int removed = 0;
for (i = 0; i < list.nr; i++) {
const char *path = list.name[i];
- if (!remove_file(path)) {
+ if (!remove_path(path)) {
removed = 1;
continue;
}