Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
clean: convert to use parse_pathspec
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sun, 14 Jul 2013 08:35:37 +0000
(15:35 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 15 Jul 2013 17:56:07 +0000
(10:56 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clean.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
8f4f8f4
)
diff --git
a/builtin/clean.c
b/builtin/clean.c
index f955a4020425e2ecab24c750201d4c82d0a84a10..fdd4980b12e94c6c3b9bb76df874b7f52df3ecdd 100644
(file)
--- a/
builtin/clean.c
+++ b/
builtin/clean.c
@@
-13,6
+13,7
@@
#include "refs.h"
#include "string-list.h"
#include "quote.h"
#include "refs.h"
#include "string-list.h"
#include "quote.h"
+#include "pathspec.h"
static int force = -1; /* unset */
static int force = -1; /* unset */
@@
-150,7
+151,7
@@
int cmd_clean(int argc, const char **argv, const char *prefix)
int rm_flags = REMOVE_DIR_KEEP_NESTED_GIT;
struct strbuf directory = STRBUF_INIT;
struct dir_struct dir;
int rm_flags = REMOVE_DIR_KEEP_NESTED_GIT;
struct strbuf directory = STRBUF_INIT;
struct dir_struct dir;
- st
atic const char **
pathspec;
+ st
ruct pathspec
pathspec;
struct strbuf buf = STRBUF_INIT;
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
struct exclude_list *el;
struct strbuf buf = STRBUF_INIT;
struct string_list exclude_list = STRING_LIST_INIT_NODUP;
struct exclude_list *el;
@@
-209,9
+210,11
@@
int cmd_clean(int argc, const char **argv, const char *prefix)
for (i = 0; i < exclude_list.nr; i++)
add_exclude(exclude_list.items[i].string, "", 0, el, -(i+1));
for (i = 0; i < exclude_list.nr; i++)
add_exclude(exclude_list.items[i].string, "", 0, el, -(i+1));
- pathspec = get_pathspec(prefix, argv);
+ parse_pathspec(&pathspec, 0,
+ PATHSPEC_PREFER_CWD,
+ prefix, argv);
- fill_directory(&dir, pathspec);
+ fill_directory(&dir, pathspec
.raw
);
for (i = 0; i < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
for (i = 0; i < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
@@
-246,9
+249,9
@@
int cmd_clean(int argc, const char **argv, const char *prefix)
if (lstat(ent->name, &st))
continue;
if (lstat(ent->name, &st))
continue;
- if (pathspec)
- matches = match_pathspec
(pathspec, ent->name, len
,
- 0, NULL);
+ if (pathspec
.nr
)
+ matches = match_pathspec
_depth(&pathspec, ent->name
,
+
len,
0, NULL);
if (S_ISDIR(st.st_mode)) {
strbuf_addstr(&directory, ent->name);
if (S_ISDIR(st.st_mode)) {
strbuf_addstr(&directory, ent->name);
@@
-262,7
+265,7
@@
int cmd_clean(int argc, const char **argv, const char *prefix)
}
strbuf_reset(&directory);
} else {
}
strbuf_reset(&directory);
} else {
- if (pathspec && !matches)
+ if (pathspec
.nr
&& !matches)
continue;
res = dry_run ? 0 : unlink(ent->name);
if (res) {
continue;
res = dry_run ? 0 : unlink(ent->name);
if (res) {