path: root/strbuf.h
diff options
authorJunio C Hamano <>2018-04-09 23:25:43 (GMT)
committerJunio C Hamano <>2018-04-09 23:25:43 (GMT)
commite4bb62fa1eeee689744b413e29a50b4d1dae6886 (patch)
tree674f7d3cc3c82665a296216b952524b215302028 /strbuf.h
parent468165c1d8a442994a825f3684528361727cd8c0 (diff)
parentc5b761fb2711542073cf1906c0e86a34616b79ae (diff)
Merge branch 'en/rename-directory-detection'
Rename detection logic in "diff" family that is used in "merge" has learned to guess when all of x/a, x/b and x/c have moved to z/a, z/b and z/c, it is likely that x/d added in the meantime would also want to move to z/d by taking the hint that the entire directory 'x' moved to 'z'. A bug causing dirty files involved in a rename to be overwritten during merge has also been fixed as part of this work. * en/rename-directory-detection: (29 commits) merge-recursive: ensure we write updates for directory-renamed file merge-recursive: avoid spurious rename/rename conflict from dir renames directory rename detection: new testcases showcasing a pair of bugs merge-recursive: fix remaining directory rename + dirty overwrite cases merge-recursive: fix overwriting dirty files involved in renames merge-recursive: avoid clobbering untracked files with directory renames merge-recursive: apply necessary modifications for directory renames merge-recursive: when comparing files, don't include trees merge-recursive: check for file level conflicts then get new name merge-recursive: add computation of collisions due to dir rename & merging merge-recursive: check for directory level conflicts merge-recursive: add get_directory_renames() merge-recursive: make a helper function for cleanup for handle_renames merge-recursive: split out code for determining diff_filepairs merge-recursive: make !o->detect_rename codepath more obvious merge-recursive: fix leaks of allocated renames and diff_filepairs merge-recursive: introduce new functions to handle rename logic merge-recursive: move the get_renames() function directory rename detection: tests for handling overwriting dirty files directory rename detection: tests for handling overwriting untracked files ...
Diffstat (limited to 'strbuf.h')
1 files changed, 16 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index e6cae5f..652f173 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -1,6 +1,8 @@
#ifndef STRBUF_H
#define STRBUF_H
+struct string_list;
* strbuf's are meant to be used with all the usual C string and memory
* APIs. Given that the length of the buffer is known, it's often better to
@@ -531,6 +533,20 @@ static inline struct strbuf **strbuf_split(const struct strbuf *sb,
return strbuf_split_max(sb, terminator, 0);
+ * Adds all strings of a string list to the strbuf, separated by the given
+ * separator. For example, if sep is
+ * ', '
+ * and slist contains
+ * ['element1', 'element2', ..., 'elementN'],
+ * then write:
+ * 'element1, element2, ..., elementN'
+ * to str. If only one element, just write "element1" to str.
+ */
+extern void strbuf_add_separated_string_list(struct strbuf *str,
+ const char *sep,
+ struct string_list *slist);
* Free a NULL-terminated list of strbufs (for example, the return
* values of the strbuf_split*() functions).