698 |
STRBUF *addlist = strbuf_open(0); |
STRBUF *addlist = strbuf_open(0); |
699 |
STRBUF *deletelist = strbuf_open(0); |
STRBUF *deletelist = strbuf_open(0); |
700 |
STRBUF *addlist_other = strbuf_open(0); |
STRBUF *addlist_other = strbuf_open(0); |
|
STRBUF *deletelist_other = strbuf_open(0); |
|
701 |
IDSET *deleteset; |
IDSET *deleteset; |
702 |
int updated = 0; |
int updated = 0; |
703 |
const char *path; |
const char *path; |
756 |
find_close(); |
find_close(); |
757 |
/* |
/* |
758 |
* make delete list. |
* make delete list. |
|
* |
|
|
* deletelist: source files |
|
|
* deletelist_other: other files |
|
759 |
*/ |
*/ |
760 |
limit = gpath_nextkey(); |
limit = gpath_nextkey(); |
761 |
for (i = 1; i < limit; i++) { |
for (i = 1; i < limit; i++) { |
767 |
continue; |
continue; |
768 |
if (other) { |
if (other) { |
769 |
if (!test("f", path) || test("b", path)) |
if (!test("f", path) || test("b", path)) |
770 |
strbuf_puts0(deletelist_other, path); |
strbuf_puts0(deletelist, path); |
771 |
} else { |
} else { |
772 |
if (!test("f", path)) { |
if (!test("f", path)) { |
773 |
strbuf_puts0(deletelist, path); |
strbuf_puts0(deletelist, path); |
795 |
} |
} |
796 |
updated = 1; |
updated = 1; |
797 |
} |
} |
798 |
if (strbuf_getlen(deletelist) + strbuf_getlen(deletelist_other) + strbuf_getlen(addlist_other) > 0) { |
if (strbuf_getlen(deletelist) + strbuf_getlen(addlist_other) > 0) { |
799 |
const char *start, *end, *p; |
const char *start, *end, *p; |
800 |
|
|
801 |
if (vflag) |
if (vflag) |
808 |
for (p = start; p < end; p += strlen(p) + 1) |
for (p = start; p < end; p += strlen(p) + 1) |
809 |
gpath_delete(p); |
gpath_delete(p); |
810 |
} |
} |
|
if (strbuf_getlen(deletelist_other) > 0) { |
|
|
start = strbuf_value(deletelist_other); |
|
|
end = start + strbuf_getlen(deletelist_other); |
|
|
|
|
|
for (p = start; p < end; p += strlen(p) + 1) |
|
|
gpath_delete(p); |
|
|
} |
|
811 |
if (strbuf_getlen(addlist_other) > 0) { |
if (strbuf_getlen(addlist_other) > 0) { |
812 |
start = strbuf_value(addlist_other); |
start = strbuf_value(addlist_other); |
813 |
end = start + strbuf_getlen(addlist_other); |
end = start + strbuf_getlen(addlist_other); |
841 |
strbuf_close(addlist); |
strbuf_close(addlist); |
842 |
strbuf_close(deletelist); |
strbuf_close(deletelist); |
843 |
strbuf_close(addlist_other); |
strbuf_close(addlist_other); |
|
strbuf_close(deletelist_other); |
|
844 |
idset_close(deleteset); |
idset_close(deleteset); |
845 |
|
|
846 |
return updated; |
return updated; |