From 79d49b7d8c75b80d5aeaf9d84895361b85e9c748 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Wed, 14 Feb 2018 10:51:58 -0800 Subject: merge-recursive: check for file level conflicts then get new name Before trying to apply directory renames to paths within the given directories, we want to make sure that there aren't conflicts at the file level either. If there aren't any, then get the new name from any directory renames. Reviewed-by: Stefan Beller Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- strbuf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'strbuf.c') diff --git a/strbuf.c b/strbuf.c index 1df674e919..113e751d63 100644 --- a/strbuf.c +++ b/strbuf.c @@ -1,5 +1,6 @@ #include "cache.h" #include "refs.h" +#include "string-list.h" #include "utf8.h" int starts_with(const char *str, const char *prefix) @@ -163,6 +164,21 @@ struct strbuf **strbuf_split_buf(const char *str, size_t slen, return ret; } +void strbuf_add_separated_string_list(struct strbuf *str, + const char *sep, + struct string_list *slist) +{ + struct string_list_item *item; + int sep_needed = 0; + + for_each_string_list_item(item, slist) { + if (sep_needed) + strbuf_addstr(str, sep); + strbuf_addstr(str, item->string); + sep_needed = 1; + } +} + void strbuf_list_free(struct strbuf **sbs) { struct strbuf **s = sbs; -- cgit v1.2.3