summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-04-19 10:58:08 -0700
committerJunio C Hamano <gitster@pobox.com>2018-05-08 16:11:00 +0900
commitf6f775591881036a3c4bfcf6737c9119c251537d (patch)
tree769a7e72d7ccd4107fe64e512a3448393cd7e9de /strbuf.c
parente95ab70aac4f38f1d365cdc03a7a041920c9c27b (diff)
downloadgit-f6f775591881036a3c4bfcf6737c9119c251537d.tar.gz
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 <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 43a840c67b..83d05024e6 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)
@@ -171,6 +172,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;