diff options
175 files changed, 755 insertions, 330 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d5ad9d05..53f10ba94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,9 +14,12 @@ PROJECT(libgit2 C) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) CMAKE_POLICY(SET CMP0015 NEW) -IF (NOT CMAKE_VERSION VERSION_LESS 3.1) +IF (POLICY CMP0051) CMAKE_POLICY(SET CMP0051 NEW) ENDIF() +IF (POLICY CMP0042) + CMAKE_POLICY(SET CMP0042 NEW) +ENDIF() # Add find modules to the path SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/Modules/") @@ -28,7 +31,10 @@ INCLUDE(CheckStructHasMember) INCLUDE(AddCFlagIfSupported) INCLUDE(FindPkgConfig) INCLUDE(FindThreads) +INCLUDE(FindStatNsec) +INCLUDE(IdeSplitSources) INCLUDE(FeatureSummary) +INCLUDE(EnableWarnings) # Build options # @@ -91,50 +97,6 @@ IF(MSVC) OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF) ENDIF() -CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h" - HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C) -CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h" - HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C) -CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h - HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C) - -IF (HAVE_STRUCT_STAT_ST_MTIM) - CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h - HAVE_STRUCT_STAT_NSEC LANGUAGE C) -ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC) - CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h - HAVE_STRUCT_STAT_NSEC LANGUAGE C) -ELSE () - SET( HAVE_STRUCT_STAT_NSEC ON ) -ENDIF() - -IF (HAVE_STRUCT_STAT_NSEC OR WIN32) - OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON ) -ENDIF() - -# This function splits the sources files up into their appropriate -# subdirectories. This is especially useful for IDEs like Xcode and -# Visual Studio, so that you can navigate into the libgit2_clar project, -# and see the folders within the tests folder (instead of just seeing all -# source and tests in a single folder.) -FUNCTION(IDE_SPLIT_SOURCES target) - IF(MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode) - GET_TARGET_PROPERTY(sources ${target} SOURCES) - FOREACH(source ${sources}) - IF(source MATCHES ".*/") - STRING(REPLACE ${libgit2_SOURCE_DIR}/ "" rel ${source}) - IF(rel) - STRING(REGEX REPLACE "/([^/]*)$" "" rel ${rel}) - IF(rel) - STRING(REPLACE "/" "\\\\" rel ${rel}) - SOURCE_GROUP(${rel} FILES ${source}) - ENDIF() - ENDIF() - ENDIF() - ENDFOREACH() - ENDIF() -ENDFUNCTION() - FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$") STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${GIT2_HEADER}") @@ -230,21 +192,6 @@ ELSE () SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}") - MACRO(ENABLE_WARNINGS flag) - IF(ENABLE_WERROR) - ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag}) - ELSE() - ADD_C_FLAG_IF_SUPPORTED(-W${flag}) - ENDIF() - ENDMACRO() - - MACRO(DISABLE_WARNINGS flag) - ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag}) - IF(ENABLE_WERROR) - ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag}) - ENDIF() - ENDMACRO() - ENABLE_WARNINGS(all) ENABLE_WARNINGS(extra) diff --git a/cmake/Modules/EnableWarnings.cmake b/cmake/Modules/EnableWarnings.cmake new file mode 100644 index 000000000..e7d7d3986 --- /dev/null +++ b/cmake/Modules/EnableWarnings.cmake @@ -0,0 +1,14 @@ +MACRO(ENABLE_WARNINGS flag) + IF(ENABLE_WERROR) + ADD_C_FLAG_IF_SUPPORTED(-Werror=${flag}) + ELSE() + ADD_C_FLAG_IF_SUPPORTED(-W${flag}) + ENDIF() +ENDMACRO() + +MACRO(DISABLE_WARNINGS flag) + ADD_C_FLAG_IF_SUPPORTED(-Wno-${flag}) + IF(ENABLE_WERROR) + ADD_C_FLAG_IF_SUPPORTED(-Wno-error=${flag}) + ENDIF() +ENDMACRO() diff --git a/cmake/Modules/FindStatNsec.cmake b/cmake/Modules/FindStatNsec.cmake new file mode 100644 index 000000000..fa550a214 --- /dev/null +++ b/cmake/Modules/FindStatNsec.cmake @@ -0,0 +1,20 @@ +CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h" + HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C) +CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h" + HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C) +CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h + HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C) + +IF (HAVE_STRUCT_STAT_ST_MTIM) + CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h + HAVE_STRUCT_STAT_NSEC LANGUAGE C) +ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC) + CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h + HAVE_STRUCT_STAT_NSEC LANGUAGE C) +ELSE () + SET( HAVE_STRUCT_STAT_NSEC ON ) +ENDIF() + +IF (HAVE_STRUCT_STAT_NSEC OR WIN32) + OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON ) +ENDIF() diff --git a/cmake/Modules/IdeSplitSources.cmake b/cmake/Modules/IdeSplitSources.cmake new file mode 100644 index 000000000..e2e09b4ce --- /dev/null +++ b/cmake/Modules/IdeSplitSources.cmake @@ -0,0 +1,22 @@ +# This function splits the sources files up into their appropriate +# subdirectories. This is especially useful for IDEs like Xcode and +# Visual Studio, so that you can navigate into the libgit2_clar project, +# and see the folders within the tests folder (instead of just seeing all +# source and tests in a single folder.) +FUNCTION(IDE_SPLIT_SOURCES target) + IF(MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode) + GET_TARGET_PROPERTY(sources ${target} SOURCES) + FOREACH(source ${sources}) + IF(source MATCHES ".*/") + STRING(REPLACE ${libgit2_SOURCE_DIR}/ "" rel ${source}) + IF(rel) + STRING(REGEX REPLACE "/([^/]*)$" "" rel ${rel}) + IF(rel) + STRING(REPLACE "/" "\\\\" rel ${rel}) + SOURCE_GROUP(${rel} FILES ${source}) + ENDIF() + ENDIF() + ENDIF() + ENDFOREACH() + ENDIF() +ENDFUNCTION() diff --git a/src/attr.c b/src/attr.c index 17309d0eb..93d9551d9 100644 --- a/src/attr.c +++ b/src/attr.c @@ -56,12 +56,16 @@ int git_attr_get( git_attr_file *file; git_attr_name attr; git_attr_rule *rule; + git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN; assert(value && repo && name); *value = NULL; - if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), GIT_DIR_FLAG_UNKNOWN) < 0) + if (git_repository_is_bare(repo)) + dir_flag = GIT_DIR_FLAG_FALSE; + + if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0) return -1; if ((error = collect_attr_files(repo, NULL, flags, pathname, &files)) < 0) @@ -114,13 +118,17 @@ int git_attr_get_many_with_session( git_attr_rule *rule; attr_get_many_info *info = NULL; size_t num_found = 0; + git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN; if (!num_attr) return 0; assert(values && repo && names); - if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), GIT_DIR_FLAG_UNKNOWN) < 0) + if (git_repository_is_bare(repo)) + dir_flag = GIT_DIR_FLAG_FALSE; + + if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0) return -1; if ((error = collect_attr_files(repo, attr_session, flags, pathname, &files)) < 0) @@ -196,10 +204,14 @@ int git_attr_foreach( git_attr_rule *rule; git_attr_assignment *assign; git_strmap *seen = NULL; + git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN; assert(repo && callback); - if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), GIT_DIR_FLAG_UNKNOWN) < 0) + if (git_repository_is_bare(repo)) + dir_flag = GIT_DIR_FLAG_FALSE; + + if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0) return -1; if ((error = collect_attr_files(repo, NULL, flags, pathname, &files)) < 0 || diff --git a/src/buf_text.c b/src/buf_text.c index 7e6779d2d..306980b5c 100644 --- a/src/buf_text.c +++ b/src/buf_text.c @@ -188,7 +188,7 @@ bool git_buf_text_is_binary(const git_buf *buf) git_bom_t bom; int printable = 0, nonprintable = 0; - scan += git_buf_text_detect_bom(&bom, buf, 0); + scan += git_buf_text_detect_bom(&bom, buf); if (bom > GIT_BOM_UTF8) return 1; @@ -215,18 +215,18 @@ bool git_buf_text_contains_nul(const git_buf *buf) return (memchr(buf->ptr, '\0', buf->size) != NULL); } -int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf, size_t offset) +int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf) { const char *ptr; size_t len; *bom = GIT_BOM_NONE; - /* need at least 2 bytes after offset to look for any BOM */ - if (buf->size < offset + 2) + /* need at least 2 bytes to look for any BOM */ + if (buf->size < 2) return 0; - ptr = buf->ptr + offset; - len = buf->size - offset; + ptr = buf->ptr; + len = buf->size; switch (*ptr++) { case 0: @@ -274,7 +274,7 @@ bool git_buf_text_gather_stats( memset(stats, 0, sizeof(*stats)); /* BOM detection */ - skip = git_buf_text_detect_bom(&stats->bom, buf, 0); + skip = git_buf_text_detect_bom(&stats->bom, buf); if (skip_bom) scan += skip; diff --git a/src/buf_text.h b/src/buf_text.h index 163bef1ad..726b0ae7b 100644 --- a/src/buf_text.h +++ b/src/buf_text.h @@ -99,11 +99,9 @@ extern bool git_buf_text_contains_nul(const git_buf *buf); * * @param bom Set to the type of BOM detected or GIT_BOM_NONE * @param buf Buffer in which to check the first bytes for a BOM - * @param offset Offset into buffer to look for BOM * @return Number of bytes of BOM data (or 0 if no BOM found) */ -extern int git_buf_text_detect_bom( - git_bom_t *bom, const git_buf *buf, size_t offset); +extern int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf); /** * Gather stats for a piece of text diff --git a/src/cc-compat.h b/src/cc-compat.h index cefdc928b..0f05cd2d9 100644 --- a/src/cc-compat.h +++ b/src/cc-compat.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_compat_h__ -#define INCLUDE_compat_h__ +#ifndef INCLUDE_cc_compat_h__ +#define INCLUDE_cc_compat_h__ #include <stdarg.h> @@ -84,4 +84,4 @@ # endif #endif -#endif /* INCLUDE_compat_h__ */ +#endif diff --git a/src/common.h b/src/common.h index d3622d3eb..44063be12 100644 --- a/src/common.h +++ b/src/common.h @@ -230,6 +230,12 @@ GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int v GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \ GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { return -1; } +#define GITERR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \ + if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \ + GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \ + GIT_ADD_SIZET_OVERFLOW(out, *(out), four) || \ + GIT_ADD_SIZET_OVERFLOW(out, *(out), five)) { return -1; } + /** Check for multiplicative overflow, failing if it would occur. */ #define GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \ if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { return -1; } @@ -238,4 +244,4 @@ GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int v #include "util.h" -#endif /* INCLUDE_common_h__ */ +#endif diff --git a/src/config_file.h b/src/config_file.h index 25ef45e5b..72818e58c 100644 --- a/src/config_file.h +++ b/src/config_file.h @@ -71,4 +71,3 @@ GIT_INLINE(int) git_config_file_unlock(git_config_backend *cfg, int success) extern int git_config_file_normalize_section(char *start, char *end); #endif - diff --git a/src/config_parse.c b/src/config_parse.c index 586bba8ed..149550dcd 100644 --- a/src/config_parse.c +++ b/src/config_parse.c @@ -217,7 +217,7 @@ static int skip_bom(git_parse_ctx *parser) { git_buf buf = GIT_BUF_INIT_CONST(parser->content, parser->content_len); git_bom_t bom; - int bom_offset = git_buf_text_detect_bom(&bom, &buf, parser->content_len); + int bom_offset = git_buf_text_detect_bom(&bom, &buf); if (bom == GIT_BOM_UTF8) git_parse_advance_chars(parser, bom_offset); @@ -475,6 +475,11 @@ int git_config_parse( size_t line_len = parser->ctx.line_len; char c; + /* + * Get either first non-whitespace character or, if that does + * not exist, the first whitespace character. This is required + * to preserve whitespaces when writing back the file. + */ if (git_parse_peek(&c, ctx, GIT_PARSE_PEEK_SKIP_WHITESPACE) < 0 && git_parse_peek(&c, ctx, 0) < 0) continue; @@ -490,6 +495,7 @@ int git_config_parse( break; case '\n': /* comment or whitespace-only */ + case '\r': case ' ': case '\t': case ';': diff --git a/src/config_parse.h b/src/config_parse.h index 6c1863952..d14a8e60c 100644 --- a/src/config_parse.h +++ b/src/config_parse.h @@ -4,6 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ +#ifndef INCLUDE_config_parse_h__ +#define INCLUDE_config_parse_h__ #include "common.h" #include "array.h" @@ -58,3 +60,5 @@ int git_config_parse( git_config_parser_comment_cb on_comment, git_config_parser_eof_cb on_eof, void *data); + +#endif diff --git a/src/diff.h b/src/diff.h index 8c04438fa..93374b96e 100644 --- a/src/diff.h +++ b/src/diff.h @@ -66,4 +66,3 @@ extern int git_diff__entry_cmp(const void *a, const void *b); extern int git_diff__entry_icmp(const void *a, const void *b); #endif - diff --git a/src/diff_generate.h b/src/diff_generate.h index 8de2a0644..3f182b0ba 100644 --- a/src/diff_generate.h +++ b/src/diff_generate.h @@ -126,4 +126,3 @@ GIT_INLINE(int) git_diff_file__resolve_zero_size( } #endif - diff --git a/src/diff_tform.h b/src/diff_tform.h index a31c40f8e..7abb8b3fe 100644 --- a/src/diff_tform.h +++ b/src/diff_tform.h @@ -23,4 +23,3 @@ extern int git_diff_find_similar__calc_similarity( int *score, void *siga, void *sigb, void *payload); #endif - diff --git a/src/fileops.h b/src/fileops.h index 57b9d173e..2844ece21 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -387,4 +387,4 @@ extern int git_futils_fsync_dir(const char *path); */ extern int git_futils_fsync_parent(const char *path); -#endif /* INCLUDE_fileops_h__ */ +#endif diff --git a/src/fnmatch.h b/src/fnmatch.h index 88af45939..ddaae15bb 100644 --- a/src/fnmatch.h +++ b/src/fnmatch.h @@ -25,8 +25,8 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#ifndef INCLUDE_fnmatch__compat_h__ -#define INCLUDE_fnmatch__compat_h__ +#ifndef INCLUDE_fnmatch_h__ +#define INCLUDE_fnmatch_h__ #include "common.h" @@ -45,5 +45,4 @@ extern int p_fnmatch(const char *pattern, const char *string, int flags); -#endif /* _FNMATCH_H */ - +#endif diff --git a/src/hash.h b/src/hash.h index cce3a7f30..31eaf8889 100644 --- a/src/hash.h +++ b/src/hash.h @@ -42,4 +42,4 @@ int git_hash_final(git_oid *out, git_hash_ctx *c); int git_hash_buf(git_oid *out, const void *data, size_t len); int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n); -#endif /* INCLUDE_hash_h__ */ +#endif diff --git a/src/hash/hash_collisiondetect.h b/src/hash/hash_collisiondetect.h index 5fdae8df6..4c5e3c302 100644 --- a/src/hash/hash_collisiondetect.h +++ b/src/hash/hash_collisiondetect.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_collisiondetect_h__ -#define INCLUDE_hash_collisiondetect_h__ +#ifndef INCLUDE_hash_hash_collisiondetect_h__ +#define INCLUDE_hash_hash_collisiondetect_h__ #include "hash.h" #include "sha1dc/sha1.h" @@ -44,4 +44,4 @@ GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx) return 0; } -#endif /* INCLUDE_hash_collisiondetect_h__ */ +#endif diff --git a/src/hash/hash_common_crypto.h b/src/hash/hash_common_crypto.h index 4cd229d3c..5c3887dba 100644 --- a/src/hash/hash_common_crypto.h +++ b/src/hash/hash_common_crypto.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_common_crypto_h__ -#define INCLUDE_hash_common_crypto_h__ +#ifndef INCLUDE_hash_hash_common_crypto_h__ +#define INCLUDE_hash_hash_common_crypto_h__ #include "hash.h" @@ -54,4 +54,4 @@ GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx) return 0; } -#endif /* INCLUDE_hash_common_crypto_h__ */ +#endif diff --git a/src/hash/hash_generic.h b/src/hash/hash_generic.h index 114b60781..21a042807 100644 --- a/src/hash/hash_generic.h +++ b/src/hash/hash_generic.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_generic_h__ -#define INCLUDE_hash_generic_h__ +#ifndef INCLUDE_hash_hash_generic_h__ +#define INCLUDE_hash_hash_generic_h__ #include "common.h" @@ -22,4 +22,4 @@ struct git_hash_ctx { #define git_hash_ctx_init(ctx) git_hash_init(ctx) #define git_hash_ctx_cleanup(ctx) -#endif /* INCLUDE_hash_generic_h__ */ +#endif diff --git a/src/hash/hash_openssl.h b/src/hash/hash_openssl.h index 048c2bdb3..eb2dcb02f 100644 --- a/src/hash/hash_openssl.h +++ b/src/hash/hash_openssl.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_openssl_h__ -#define INCLUDE_hash_openssl_h__ +#ifndef INCLUDE_hash_hash_openssl_h__ +#define INCLUDE_hash_hash_openssl_h__ #include "hash.h" @@ -56,4 +56,4 @@ GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx) return 0; } -#endif /* INCLUDE_hash_openssl_h__ */ +#endif diff --git a/src/hash/hash_win32.h b/src/hash/hash_win32.h index 187c07267..9704204e2 100644 --- a/src/hash/hash_win32.h +++ b/src/hash/hash_win32.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_hash_win32_h__ -#define INCLUDE_hash_win32_h__ +#ifndef INCLUDE_hash_hash_win32_h__ +#define INCLUDE_hash_hash_win32_h__ #include "common.h" @@ -138,4 +138,4 @@ struct git_hash_ctx { } ctx; }; -#endif /* INCLUDE_hash_openssl_h__ */ +#endif diff --git a/src/ignore.c b/src/ignore.c index 615cd94bf..ddbcaf3bf 100644 --- a/src/ignore.c +++ b/src/ignore.c @@ -540,6 +540,7 @@ int git_ignore_path_is_ignored( git_ignores ignores; unsigned int i; git_attr_file *file; + git_dir_flag dir_flag = GIT_DIR_FLAG_UNKNOWN; assert(repo && ignored && pathname); @@ -548,7 +549,10 @@ int git_ignore_path_is_ignored( memset(&path, 0, sizeof(path)); memset(&ignores, 0, sizeof(ignores)); - if ((error = git_attr_path__init(&path, pathname, workdir, GIT_DIR_FLAG_UNKNOWN)) < 0 || + if (git_repository_is_bare(repo)) + dir_flag = GIT_DIR_FLAG_FALSE; + + if ((error = git_attr_path__init(&path, pathname, workdir, dir_flag)) < 0 || (error = git_ignore__for_path(repo, path.path, &ignores)) < 0) goto cleanup; diff --git a/src/integer.h b/src/integer.h index 61712cebf..30528db59 100644 --- a/src/integer.h +++ b/src/integer.h @@ -93,4 +93,4 @@ GIT_INLINE(bool) git__multiply_sizet_overflow(size_t *out, size_t one, size_t tw #endif -#endif /* INCLUDE_integer_h__ */ +#endif @@ -43,4 +43,4 @@ typedef struct { /* memory mapped buffer */ extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset); extern int p_munmap(git_map *map); -#endif /* INCLUDE_map_h__ */ +#endif diff --git a/src/merge.c b/src/merge.c index aae5d764a..6c98d13fb 100644 --- a/src/merge.c +++ b/src/merge.c @@ -2263,7 +2263,7 @@ static int compute_base( git_oidarray bases = {0}; git_annotated_commit *base = NULL, *other = NULL, *new_base = NULL; git_merge_options opts = GIT_MERGE_OPTIONS_INIT; - size_t i; + size_t i, base_count; int error; *out = NULL; @@ -2271,17 +2271,27 @@ static int compute_base( if (given_opts) memcpy(&opts, given_opts, sizeof(git_merge_options)); - if ((error = insert_head_ids(&head_ids, one)) < 0 || - (error = insert_head_ids(&head_ids, two)) < 0) + /* With more than two commits, merge_bases_many finds the base of + * the first commit and a hypothetical merge of the others. Since + * "one" may itself be a virtual commit, which insert_head_ids + * substitutes multiple ancestors for, it needs to be added + * after "two" which is always a single real commit. + */ + if ((error = insert_head_ids(&head_ids, two)) < 0 || + (error = insert_head_ids(&head_ids, one)) < 0 || + (error = git_merge_bases_many(&bases, repo, + head_ids.size, head_ids.ptr)) < 0) goto done; - if ((error = git_merge_bases_many(&bases, repo, - head_ids.size, head_ids.ptr)) < 0 || - (error = git_annotated_commit_lookup(&base, repo, &bases.ids[0])) < 0 || - (opts.flags & GIT_MERGE_NO_RECURSIVE)) + base_count = (opts.flags & GIT_MERGE_NO_RECURSIVE) ? 0 : bases.count; + + if (base_count) + git_oidarray__reverse(&bases); + + if ((error = git_annotated_commit_lookup(&base, repo, &bases.ids[0])) < 0) goto done; - for (i = 1; i < bases.count; i++) { + for (i = 1; i < base_count; i++) { recursion_level++; if (opts.recursion_limit && recursion_level > opts.recursion_limit) diff --git a/src/message.h b/src/message.h index 88fc7884c..251727b22 100644 --- a/src/message.h +++ b/src/message.h @@ -14,4 +14,4 @@ int git_message__prettify(git_buf *message_out, const char *message, int strip_comments); -#endif /* INCLUDE_message_h__ */ +#endif diff --git a/src/notes.h b/src/notes.h index cfc0ca239..2168e4595 100644 --- a/src/notes.h +++ b/src/notes.h @@ -29,4 +29,4 @@ struct git_note { char *message; }; -#endif /* INCLUDE_notes_h__ */ +#endif diff --git a/src/oidarray.c b/src/oidarray.c index fda3b638d..e70e9dd61 100644 --- a/src/oidarray.c +++ b/src/oidarray.c @@ -20,3 +20,15 @@ void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array) arr->count = array->size; arr->ids = array->ptr; } + +void git_oidarray__reverse(git_oidarray *arr) +{ + size_t i; + git_oid tmp; + + for (i = 0; i < arr->count / 2; i++) { + git_oid_cpy(&tmp, &arr->ids[i]); + git_oid_cpy(&arr->ids[i], &arr->ids[(arr->count-1)-i]); + git_oid_cpy(&arr->ids[(arr->count-1)-i], &tmp); + } +} diff --git a/src/oidarray.h b/src/oidarray.h index f051a0ec4..eed3a1091 100644 --- a/src/oidarray.h +++ b/src/oidarray.h @@ -14,6 +14,7 @@ typedef git_array_t(git_oid) git_array_oid_t; +extern void git_oidarray__reverse(git_oidarray *arr); extern void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array); #endif diff --git a/src/pack-objects.h b/src/pack-objects.h index e1e0ee3c8..c9cd5777a 100644 --- a/src/pack-objects.h +++ b/src/pack-objects.h @@ -104,4 +104,4 @@ struct git_packbuilder { int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb); -#endif /* INCLUDE_pack_objects_h__ */ +#endif diff --git a/src/parse.h b/src/parse.h index 419014e93..46897e306 100644 --- a/src/parse.h +++ b/src/parse.h @@ -4,6 +4,9 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ +#ifndef INCLUDE_parse_h__ +#define INCLUDE_parse_h__ + #include "common.h" typedef struct { @@ -54,3 +57,5 @@ enum GIT_PARSE_PEEK_FLAGS { }; int git_parse_peek(char *out, git_parse_ctx *ctx, int flags); + +#endif diff --git a/src/reflog.h b/src/reflog.h index d54b4cde8..8c3895952 100644 --- a/src/reflog.h +++ b/src/reflog.h @@ -38,4 +38,4 @@ GIT_INLINE(size_t) reflog_inverse_index(size_t idx, size_t total) return (total - 1) - idx; } -#endif /* INCLUDE_reflog_h__ */ +#endif diff --git a/src/sysdir.c b/src/sysdir.c index 7480e82fd..509b23b82 100644 --- a/src/sysdir.c +++ b/src/sysdir.c @@ -13,6 +13,9 @@ #include <ctype.h> #if GIT_WIN32 #include "win32/findfile.h" +#else +#include <unistd.h> +#include <pwd.h> #endif static int git_sysdir_guess_programdata_dirs(git_buf *out) @@ -34,12 +37,63 @@ static int git_sysdir_guess_system_dirs(git_buf *out) #endif } +#ifndef GIT_WIN32 +static int get_passwd_home(git_buf *out, uid_t uid) +{ + struct passwd pwd, *pwdptr; + char *buf = NULL; + long buflen; + int error; + + assert(out); + + if ((buflen = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1) + buflen = 1024; + + do { + buf = git__realloc(buf, buflen); + error = getpwuid_r(uid, &pwd, buf, buflen, &pwdptr); + buflen *= 2; + } while (error == ERANGE && buflen <= 8192); + + if (error) { + giterr_set(GITERR_OS, "failed to get passwd entry"); + goto out; + } + + if (!pwdptr) { + giterr_set(GITERR_OS, "no passwd entry found for user"); + goto out; + } + + if ((error = git_buf_puts(out, pwdptr->pw_dir)) < 0) + goto out; + +out: + git__free(buf); + return error; +} +#endif + static int git_sysdir_guess_global_dirs(git_buf *out) { #ifdef GIT_WIN32 return git_win32__find_global_dirs(out); #else - int error = git__getenv(out, "HOME"); + int error; + uid_t uid, euid; + + uid = getuid(); + euid = geteuid(); + + /* + * In case we are running setuid, use the configuration + * of the effective user. + */ + if (uid == euid) + error = git__getenv(out, "HOME"); + else + error = get_passwd_home(out, euid); if (error == GIT_ENOTFOUND) { giterr_clear(); @@ -57,12 +111,25 @@ static int git_sysdir_guess_xdg_dirs(git_buf *out) #else git_buf env = GIT_BUF_INIT; int error; - - if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0) - error = git_buf_joinpath(out, env.ptr, "git"); - - if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0) - error = git_buf_joinpath(out, env.ptr, ".config/git"); + uid_t uid, euid; + + uid = getuid(); + euid = geteuid(); + + /* + * In case we are running setuid, only look up passwd + * directory of the effective user. + */ + if (uid == euid) { + if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0) + error = git_buf_joinpath(out, env.ptr, "git"); + + if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0) + error = git_buf_joinpath(out, env.ptr, ".config/git"); + } else { + if ((error = get_passwd_home(&env, euid)) == 0) + error = git_buf_joinpath(out, env.ptr, ".config/git"); + } if (error == GIT_ENOTFOUND) { giterr_clear(); diff --git a/src/sysdir.h b/src/sysdir.h index 8f4466b46..ce1b4dc71 100644 --- a/src/sysdir.h +++ b/src/sysdir.h @@ -116,4 +116,4 @@ extern int git_sysdir_get_str(char *out, size_t outlen, git_sysdir_t which); */ extern int git_sysdir_set(git_sysdir_t which, const char *paths); -#endif /* INCLUDE_sysdir_h__ */ +#endif diff --git a/src/thread-utils.h b/src/thread-utils.h index 2df2aeb99..035de699f 100644 --- a/src/thread-utils.h +++ b/src/thread-utils.h @@ -243,4 +243,4 @@ extern int git_online_cpus(void); # define GIT_MEMORY_BARRIER /* noop */ #endif -#endif /* INCLUDE_thread_utils_h__ */ +#endif diff --git a/src/transports/auth.h b/src/transports/auth.h index 06af79dec..3b8b29eb9 100644 --- a/src/transports/auth.h +++ b/src/transports/auth.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_http_auth_h__ -#define INCLUDE_http_auth_h__ +#ifndef INCLUDE_transports_auth_h__ +#define INCLUDE_transports_auth_h__ #include "common.h" @@ -62,4 +62,3 @@ int git_http_auth_basic( const gitno_connection_data *connection_data); #endif - diff --git a/src/transports/auth_negotiate.h b/src/transports/auth_negotiate.h index 5866c19c3..15a528aaf 100644 --- a/src/transports/auth_negotiate.h +++ b/src/transports/auth_negotiate.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_auth_negotiate_h__ -#define INCLUDE_auth_negotiate_h__ +#ifndef INCLUDE_transports_auth_negotiate_h__ +#define INCLUDE_transports_auth_negotiate_h__ #include "common.h" #include "git2.h" @@ -25,4 +25,3 @@ extern int git_http_auth_negotiate( #endif /* GIT_GSSAPI */ #endif - diff --git a/src/transports/cred.h b/src/transports/cred.h index dceab9aa3..ed5821c55 100644 --- a/src/transports/cred.h +++ b/src/transports/cred.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_cred_h__ -#define INCLUDE_git_cred_h__ +#ifndef INCLUDE_transports_cred_h__ +#define INCLUDE_transports_cred_h__ #include "common.h" diff --git a/src/transports/smart.h b/src/transports/smart.h index f1ad70479..e33a25402 100644 --- a/src/transports/smart.h +++ b/src/transports/smart.h @@ -4,6 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ +#ifndef INCLUDE_transports_smart_h__ +#define INCLUDE_transports_smart_h__ #include "common.h" @@ -194,3 +196,5 @@ int git_pkt_buffer_done(git_buf *buf); int git_pkt_buffer_wants(const git_remote_head * const *refs, size_t count, transport_smart_caps *caps, git_buf *buf); int git_pkt_buffer_have(git_oid *oid, git_buf *buf); void git_pkt_free(git_pkt *pkt); + +#endif diff --git a/src/transports/ssh.h b/src/transports/ssh.h index e36e7246e..d3e741f1d 100644 --- a/src/transports/ssh.h +++ b/src/transports/ssh.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_ssh_h__ -#define INCLUDE_ssh_h__ +#ifndef INCLUDE_transports_ssh_h__ +#define INCLUDE_transports_ssh_h__ #include "common.h" diff --git a/src/unix/posix.h b/src/unix/posix.h index ee36ea0f3..f2fffd5c9 100644 --- a/src/unix/posix.h +++ b/src/unix/posix.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_posix__unix_h__ -#define INCLUDE_posix__unix_h__ +#ifndef INCLUDE_unix_posix_h__ +#define INCLUDE_unix_posix_h__ #ifndef LIBGIT2_NO_FEATURES_H # include "git2/sys/features.h" diff --git a/src/unix/pthread.h b/src/unix/pthread.h index 3f23d10d5..233561b4e 100644 --- a/src/unix/pthread.h +++ b/src/unix/pthread.h @@ -53,4 +53,4 @@ typedef struct { #define git_rwlock_free(a) pthread_rwlock_destroy(a) #define GIT_RWLOCK_STATIC_INIT PTHREAD_RWLOCK_INITIALIZER -#endif /* INCLUDE_unix_pthread_h__ */ +#endif diff --git a/src/util.h b/src/util.h index 80ee8e647..63ffa134e 100644 --- a/src/util.h +++ b/src/util.h @@ -539,4 +539,4 @@ GIT_INLINE(double) git__timer(void) extern int git__getenv(git_buf *out, const char *name); -#endif /* INCLUDE_util_h__ */ +#endif diff --git a/src/win32/dir.h b/src/win32/dir.h index 704a9a8a9..acd64729e 100644 --- a/src/win32/dir.h +++ b/src/win32/dir.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_dir_h__ -#define INCLUDE_dir_h__ +#ifndef INCLUDE_win32_dir_h__ +#define INCLUDE_win32_dir_h__ #include "common.h" @@ -41,4 +41,4 @@ extern int git__closedir(git__DIR *); # define closedir git__closedir # endif -#endif /* INCLUDE_dir_h__ */ +#endif diff --git a/src/win32/error.h b/src/win32/error.h index a2ecf6a6a..9e81141ce 100644 --- a/src/win32/error.h +++ b/src/win32/error.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_win32_error_h__ -#define INCLUDE_git_win32_error_h__ +#ifndef INCLUDE_win32_error_h__ +#define INCLUDE_win32_error_h__ #include "common.h" diff --git a/src/win32/findfile.h b/src/win32/findfile.h index 1eae4691c..e7bcf948a 100644 --- a/src/win32/findfile.h +++ b/src/win32/findfile.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_findfile_h__ -#define INCLUDE_git_findfile_h__ +#ifndef INCLUDE_win32_findfile_h__ +#define INCLUDE_win32_findfile_h__ #include "common.h" diff --git a/src/win32/mingw-compat.h b/src/win32/mingw-compat.h index 698ebed1a..aa2bef98d 100644 --- a/src/win32/mingw-compat.h +++ b/src/win32/mingw-compat.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_mingw_compat__ -#define INCLUDE_mingw_compat__ +#ifndef INCLUDE_win32_mingw_compat_h__ +#define INCLUDE_win32_mingw_compat_h__ #if defined(__MINGW32__) @@ -20,4 +20,4 @@ void __mingworg_MemoryBarrier(void); #endif -#endif /* INCLUDE_mingw_compat__ */ +#endif diff --git a/src/win32/msvc-compat.h b/src/win32/msvc-compat.h index 12b50d981..ea77820a2 100644 --- a/src/win32/msvc-compat.h +++ b/src/win32/msvc-compat.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_msvc_compat__ -#define INCLUDE_msvc_compat__ +#ifndef INCLUDE_win32_msvc_compat_h__ +#define INCLUDE_win32_msvc_compat_h__ #if defined(_MSC_VER) @@ -19,4 +19,4 @@ typedef SSIZE_T ssize_t; #define GIT_STDLIB_CALL __cdecl -#endif /* INCLUDE_msvc_compat__ */ +#endif diff --git a/src/win32/path_w32.h b/src/win32/path_w32.h index ac1fb4b9e..83ffd1f6f 100644 --- a/src/win32/path_w32.h +++ b/src/win32/path_w32.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_path_w32_h__ -#define INCLUDE_git_path_w32_h__ +#ifndef INCLUDE_win32_path_w32_h__ +#define INCLUDE_win32_path_w32_h__ #include "common.h" diff --git a/src/win32/posix.h b/src/win32/posix.h index 64769ecd3..d5ab2e8f5 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_posix__w32_h__ -#define INCLUDE_posix__w32_h__ +#ifndef INCLUDE_win32_posix_h__ +#define INCLUDE_win32_posix_h__ #include "common.h" #include "../posix.h" diff --git a/src/win32/reparse.h b/src/win32/reparse.h index 70f9fd652..5f7408a1b 100644 --- a/src/win32/reparse.h +++ b/src/win32/reparse.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_win32_reparse_h__ -#define INCLUDE_git_win32_reparse_h__ +#ifndef INCLUDE_win32_reparse_h__ +#define INCLUDE_win32_reparse_h__ /* This structure is defined on MSDN at * http://msdn.microsoft.com/en-us/library/windows/hardware/ff552012(v=vs.85).aspx diff --git a/src/win32/thread.h b/src/win32/thread.h index d217722ec..41cbf015b 100644 --- a/src/win32/thread.h +++ b/src/win32/thread.h @@ -61,4 +61,4 @@ int git_rwlock_wrlock(git_rwlock *); int git_rwlock_wrunlock(git_rwlock *); int git_rwlock_free(git_rwlock *); -#endif /* INCLUDE_win32_thread_h__ */ +#endif diff --git a/src/win32/utf-conv.h b/src/win32/utf-conv.h index bab7ba9fd..6090a4b35 100644 --- a/src/win32/utf-conv.h +++ b/src/win32/utf-conv.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_utfconv_h__ -#define INCLUDE_git_utfconv_h__ +#ifndef INCLUDE_win32_utf_conv_h__ +#define INCLUDE_win32_utf_conv_h__ #include "common.h" diff --git a/src/win32/w32_buffer.h b/src/win32/w32_buffer.h index e15ea6864..43298e4a7 100644 --- a/src/win32/w32_buffer.h +++ b/src/win32/w32_buffer.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_git_win32_buffer_h__ -#define INCLUDE_git_win32_buffer_h__ +#ifndef INCLUDE_win32_w32_buffer_h__ +#define INCLUDE_win32_w32_buffer_h__ #include "common.h" diff --git a/src/win32/w32_crtdbg_stacktrace.h b/src/win32/w32_crtdbg_stacktrace.h index bb869b347..3f580357e 100644 --- a/src/win32/w32_crtdbg_stacktrace.h +++ b/src/win32/w32_crtdbg_stacktrace.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_w32_crtdbg_stacktrace_h__ -#define INCLUDE_w32_crtdbg_stacktrace_h__ +#ifndef INCLUDE_win32_w32_crtdbg_stacktrace_h__ +#define INCLUDE_win32_w32_crtdbg_stacktrace_h__ #include "common.h" diff --git a/src/win32/w32_stack.h b/src/win32/w32_stack.h index a514ace6f..5f0009e0b 100644 --- a/src/win32/w32_stack.h +++ b/src/win32/w32_stack.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_w32_stack_h__ -#define INCLUDE_w32_stack_h__ +#ifndef INCLUDE_win32_w32_stack_h__ +#define INCLUDE_win32_w32_stack_h__ #include "common.h" @@ -137,4 +137,4 @@ int git_win32__stack( const char *prefix, const char *suffix); #endif /* GIT_MSVC_CRTDBG */ -#endif /* INCLUDE_w32_stack_h__ */ +#endif diff --git a/src/win32/w32_util.h b/src/win32/w32_util.h index d81e55a00..6531f47a7 100644 --- a/src/win32/w32_util.h +++ b/src/win32/w32_util.h @@ -5,8 +5,8 @@ * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_w32_util_h__ -#define INCLUDE_w32_util_h__ +#ifndef INCLUDE_win32_w32_util_h__ +#define INCLUDE_win32_w32_util_h__ #include "common.h" diff --git a/src/win32/win32-compat.h b/src/win32/win32-compat.h index f888fd69e..dee40a438 100644 --- a/src/win32/win32-compat.h +++ b/src/win32/win32-compat.h @@ -4,8 +4,8 @@ * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ -#ifndef INCLUDE_win32_compat__ -#define INCLUDE_win32_compat__ +#ifndef INCLUDE_win32_win32_compat_h__ +#define INCLUDE_win32_win32_compat_h__ #include <stdint.h> #include <time.h> @@ -49,4 +49,4 @@ struct p_stat { #define stat p_stat -#endif /* INCLUDE_win32_compat__ */ +#endif diff --git a/src/xdiff/xdiff.h b/src/xdiff/xdiff.h index b7dc05697..5b13e77a0 100644 --- a/src/xdiff/xdiff.h +++ b/src/xdiff/xdiff.h @@ -13,15 +13,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * */ -#include "../util.h" - #if !defined(XDIFF_H) #define XDIFF_H @@ -29,24 +27,29 @@ extern "C" { #endif /* #ifdef __cplusplus */ +/* xpparm_t.flags */ +#define XDF_NEED_MINIMAL (1 << 0) + +#define XDF_IGNORE_WHITESPACE (1 << 1) +#define XDF_IGNORE_WHITESPACE_CHANGE (1 << 2) +#define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 3) +#define XDF_IGNORE_CR_AT_EOL (1 << 4) +#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE | \ + XDF_IGNORE_WHITESPACE_CHANGE | \ + XDF_IGNORE_WHITESPACE_AT_EOL | \ + XDF_IGNORE_CR_AT_EOL) -#define XDF_NEED_MINIMAL (1 << 1) -#define XDF_IGNORE_WHITESPACE (1 << 2) -#define XDF_IGNORE_WHITESPACE_CHANGE (1 << 3) -#define XDF_IGNORE_WHITESPACE_AT_EOL (1 << 4) -#define XDF_WHITESPACE_FLAGS (XDF_IGNORE_WHITESPACE | XDF_IGNORE_WHITESPACE_CHANGE | XDF_IGNORE_WHITESPACE_AT_EOL) +#define XDF_IGNORE_BLANK_LINES (1 << 7) -#define XDF_PATIENCE_DIFF (1 << 5) -#define XDF_HISTOGRAM_DIFF (1 << 6) +#define XDF_PATIENCE_DIFF (1 << 14) +#define XDF_HISTOGRAM_DIFF (1 << 15) #define XDF_DIFF_ALGORITHM_MASK (XDF_PATIENCE_DIFF | XDF_HISTOGRAM_DIFF) #define XDF_DIFF_ALG(x) ((x) & XDF_DIFF_ALGORITHM_MASK) -#define XDF_IGNORE_BLANK_LINES (1 << 7) - -#define XDF_INDENT_HEURISTIC (1 << 8) +#define XDF_INDENT_HEURISTIC (1 << 23) +/* xdemitconf_t.flags */ #define XDL_EMIT_FUNCNAMES (1 << 0) -#define XDL_EMIT_COMMON (1 << 1) #define XDL_EMIT_FUNCCONTEXT (1 << 2) #define XDL_MMB_READONLY (1 << 0) @@ -83,6 +86,10 @@ typedef struct s_mmbuffer { typedef struct s_xpparam { unsigned long flags; + + /* See Documentation/diff-options.txt. */ + char **anchors; + size_t anchors_nr; } xpparam_t; typedef struct s_xdemitcb { diff --git a/src/xdiff/xdiffi.c b/src/xdiff/xdiffi.c index 3e65b6ce5..3a71ef678 100644 --- a/src/xdiff/xdiffi.c +++ b/src/xdiff/xdiffi.c @@ -13,15 +13,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * */ #include "xinclude.h" -#include "common.h" #include "integer.h" diff --git a/src/xdiff/xdiffi.h b/src/xdiff/xdiffi.h index 8b81206c9..8f1c7c8b0 100644 --- a/src/xdiff/xdiffi.h +++ b/src/xdiff/xdiffi.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * diff --git a/src/xdiff/xemit.c b/src/xdiff/xemit.c index 600fd1fdd..0ffa6553a 100644 --- a/src/xdiff/xemit.c +++ b/src/xdiff/xemit.c @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * @@ -22,15 +22,6 @@ #include "xinclude.h" - - - -static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec); -static int xdl_emit_record(xdfile_t *xdf, long ri, char const *pre, xdemitcb_t *ecb); - - - - static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec) { *rec = xdf->recs[ri]->ptr; @@ -110,7 +101,7 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv) if (len > 0 && (isalpha((unsigned char)*rec) || /* identifier? */ - *rec == '_' || /* also identifier? */ + *rec == '_' || /* also identifier? */ *rec == '$')) { /* identifiers from VMS and other esoterico */ if (len > sz) len = sz; @@ -122,22 +113,20 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv) return -1; } -static int xdl_emit_common(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, - xdemitconf_t const *xecfg) { - xdfile_t *xdf = &xe->xdf2; - const char *rchg = xdf->rchg; - long ix; - - (void)xscr; - (void)xecfg; +static long match_func_rec(xdfile_t *xdf, xdemitconf_t const *xecfg, long ri, + char *buf, long sz) +{ + const char *rec; + long len = xdl_get_rec(xdf, ri, &rec); + if (!xecfg->find_func) + return def_ff(rec, len, buf, sz, xecfg->find_func_priv); + return xecfg->find_func(rec, len, buf, sz, xecfg->find_func_priv); +} - for (ix = 0; ix < xdf->nrec; ix++) { - if (rchg[ix]) - continue; - if (xdl_emit_record(xdf, ix, "", ecb)) - return -1; - } - return 0; +static int is_func_rec(xdfile_t *xdf, xdemitconf_t const *xecfg, long ri) +{ + char dummy[1]; + return match_func_rec(xdf, xecfg, ri, dummy, sizeof(dummy)) >= 0; } struct func_line { @@ -148,7 +137,6 @@ struct func_line { static long get_func_line(xdfenv_t *xe, xdemitconf_t const *xecfg, struct func_line *func_line, long start, long limit) { - find_func_t ff = xecfg->find_func ? xecfg->find_func : def_ff; long l, size, step = (start > limit) ? -1 : 1; char *buf, dummy[1]; @@ -156,9 +144,7 @@ static long get_func_line(xdfenv_t *xe, xdemitconf_t const *xecfg, size = func_line ? sizeof(func_line->buf) : sizeof(dummy); for (l = start; l != limit && 0 <= l && l < xe->xdf1.nrec; l += step) { - const char *rec; - long reclen = xdl_get_rec(&xe->xdf1, l, &rec); - long len = ff(rec, reclen, buf, size, xecfg->find_func_priv); + long len = match_func_rec(&xe->xdf1, xecfg, l, buf, size); if (len >= 0) { if (func_line) func_line->len = len; @@ -168,6 +154,18 @@ static long get_func_line(xdfenv_t *xe, xdemitconf_t const *xecfg, return -1; } +static int is_empty_rec(xdfile_t *xdf, long ri) +{ + const char *rec; + long len = xdl_get_rec(xdf, ri, &rec); + + while (len > 0 && XDL_ISSPACE(*rec)) { + rec++; + len--; + } + return !len; +} + int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, xdemitconf_t const *xecfg) { long s1, s2, e1, e2, lctx; @@ -175,9 +173,6 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, long funclineprev = -1; struct func_line func_line = { 0 }; - if (xecfg->flags & XDL_EMIT_COMMON) - return xdl_emit_common(xe, xscr, ecb, xecfg); - for (xch = xscr; xch; xch = xche->next) { xche = xdl_get_hunk(&xch, xecfg); if (!xch) @@ -187,7 +182,33 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, s2 = XDL_MAX(xch->i2 - xecfg->ctxlen, 0); if (xecfg->flags & XDL_EMIT_FUNCCONTEXT) { - long fs1 = get_func_line(xe, xecfg, NULL, xch->i1, -1); + long fs1, i1 = xch->i1; + + /* Appended chunk? */ + if (i1 >= xe->xdf1.nrec) { + long i2 = xch->i2; + + /* + * We don't need additional context if + * a whole function was added. + */ + while (i2 < xe->xdf2.nrec) { + if (is_func_rec(&xe->xdf2, xecfg, i2)) + goto post_context_calculation; + i2++; + } + + /* + * Otherwise get more context from the + * pre-image. + */ + i1 = xe->xdf1.nrec - 1; + } + + fs1 = get_func_line(xe, xecfg, NULL, i1, -1); + while (fs1 > 0 && !is_empty_rec(&xe->xdf1, fs1 - 1) && + !is_func_rec(&xe->xdf1, xecfg, fs1 - 1)) + fs1--; if (fs1 < 0) fs1 = 0; if (fs1 < s1) { @@ -196,7 +217,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, } } - again: + post_context_calculation: lctx = xecfg->ctxlen; lctx = XDL_MIN(lctx, xe->xdf1.nrec - (xche->i1 + xche->chg1)); lctx = XDL_MIN(lctx, xe->xdf2.nrec - (xche->i2 + xche->chg2)); @@ -208,6 +229,8 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, long fe1 = get_func_line(xe, xecfg, NULL, xche->i1 + xche->chg1, xe->xdf1.nrec); + while (fe1 > 0 && is_empty_rec(&xe->xdf1, fe1 - 1)) + fe1--; if (fe1 < 0) fe1 = xe->xdf1.nrec; if (fe1 > e1) { @@ -221,11 +244,12 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb, * its new end. */ if (xche->next) { - long l = xche->next->i1; - if (l <= e1 || + long l = XDL_MIN(xche->next->i1, + xe->xdf1.nrec - 1); + if (l - xecfg->ctxlen <= e1 || get_func_line(xe, xecfg, NULL, l, e1) < 0) { xche = xche->next; - goto again; + goto post_context_calculation; } } } diff --git a/src/xdiff/xemit.h b/src/xdiff/xemit.h index d29710770..1b9887e67 100644 --- a/src/xdiff/xemit.h +++ b/src/xdiff/xemit.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * diff --git a/src/xdiff/xhistogram.c b/src/xdiff/xhistogram.c index 0c2edb89c..ca8605e31 100644 --- a/src/xdiff/xhistogram.c +++ b/src/xdiff/xhistogram.c @@ -44,7 +44,6 @@ #include "xinclude.h" #include "xtypes.h" #include "xdiff.h" -#include "common.h" #define MAX_PTR UINT_MAX #define MAX_CNT UINT_MAX diff --git a/src/xdiff/xinclude.h b/src/xdiff/xinclude.h index 4a1cde909..068ce42f8 100644 --- a/src/xdiff/xinclude.h +++ b/src/xdiff/xinclude.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * @@ -42,5 +42,6 @@ #include "xdiffi.h" #include "xemit.h" +#include "common.h" #endif /* #if !defined(XINCLUDE_H) */ diff --git a/src/xdiff/xmacros.h b/src/xdiff/xmacros.h index 165a895a9..2809a28ca 100644 --- a/src/xdiff/xmacros.h +++ b/src/xdiff/xmacros.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * diff --git a/src/xdiff/xmerge.c b/src/xdiff/xmerge.c index 6448b5542..6fec95aa3 100644 --- a/src/xdiff/xmerge.c +++ b/src/xdiff/xmerge.c @@ -13,15 +13,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * */ #include "xinclude.h" -#include "common.h" typedef struct s_xdmerge { struct s_xdmerge *next; @@ -110,7 +109,7 @@ static int xdl_merge_cmp_lines(xdfenv_t *xe1, int i1, xdfenv_t *xe2, int i2, return 0; } -static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int count, int add_nl, char *dest) +static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest) { xrecord_t **recs; size_t size = 0; @@ -132,6 +131,12 @@ static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int c if (add_nl) { i = recs[count - 1]->size; if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') { + if (needs_cr) { + if (dest) + dest[size] = '\r'; + GITERR_CHECK_ALLOC_ADD(&size, size, 1); + } + if (dest) dest[size] = '\n'; @@ -143,14 +148,58 @@ static int xdl_recs_copy_0(size_t *out, int use_orig, xdfenv_t *xe, int i, int c return 0; } -static int xdl_recs_copy(size_t *out, xdfenv_t *xe, int i, int count, int add_nl, char *dest) +static int xdl_recs_copy(size_t *out, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest) { - return xdl_recs_copy_0(out, 0, xe, i, count, add_nl, dest); + return xdl_recs_copy_0(out, 0, xe, i, count, needs_cr, add_nl, dest); } -static int xdl_orig_copy(size_t *out, xdfenv_t *xe, int i, int count, int add_nl, char *dest) +static int xdl_orig_copy(size_t *out, xdfenv_t *xe, int i, int count, int needs_cr, int add_nl, char *dest) { - return xdl_recs_copy_0(out, 1, xe, i, count, add_nl, dest); + return xdl_recs_copy_0(out, 1, xe, i, count, needs_cr, add_nl, dest); +} + +/* + * Returns 1 if the i'th line ends in CR/LF (if it is the last line and + * has no eol, the preceding line, if any), 0 if it ends in LF-only, and + * -1 if the line ending cannot be determined. + */ +static int is_eol_crlf(xdfile_t *file, int i) +{ + long size; + + if (i < file->nrec - 1) + /* All lines before the last *must* end in LF */ + return (size = file->recs[i]->size) > 1 && + file->recs[i]->ptr[size - 2] == '\r'; + if (!file->nrec) + /* Cannot determine eol style from empty file */ + return -1; + if ((size = file->recs[i]->size) && + file->recs[i]->ptr[size - 1] == '\n') + /* Last line; ends in LF; Is it CR/LF? */ + return size > 1 && + file->recs[i]->ptr[size - 2] == '\r'; + if (!i) + /* The only line has no eol */ + return -1; + /* Determine eol from second-to-last line */ + return (size = file->recs[i - 1]->size) > 1 && + file->recs[i - 1]->ptr[size - 2] == '\r'; +} + +static int is_cr_needed(xdfenv_t *xe1, xdfenv_t *xe2, xdmerge_t *m) +{ + int needs_cr; + + /* Match post-images' preceding, or first, lines' end-of-line style */ + needs_cr = is_eol_crlf(&xe1->xdf2, m->i1 ? m->i1 - 1 : 0); + if (needs_cr) + needs_cr = is_eol_crlf(&xe2->xdf2, m->i2 ? m->i2 - 1 : 0); + /* Look at pre-image's first line, unless we already settled on LF */ + if (needs_cr) + needs_cr = is_eol_crlf(&xe1->xdf1, 0); + /* If still undecided, use LF-only */ + return needs_cr < 0 ? 0 : needs_cr; } static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, @@ -162,6 +211,7 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, int marker1_size = (name1 ? (int)strlen(name1) + 1 : 0); int marker2_size = (name2 ? (int)strlen(name2) + 1 : 0); int marker3_size = (name3 ? (int)strlen(name3) + 1 : 0); + int needs_cr = is_cr_needed(xe1, xe2, m); size_t copied; *out = 0; @@ -170,14 +220,14 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, marker_size = DEFAULT_CONFLICT_MARKER_SIZE; /* Before conflicting part */ - if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, + if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, 0, dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); if (!dest) { - GITERR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, marker1_size); + GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker1_size); } else { memset(dest + size, '<', marker_size); size += marker_size; @@ -186,11 +236,13 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, memcpy(dest + size + 1, name1, marker1_size - 1); size += marker1_size; } + if (needs_cr) + dest[size++] = '\r'; dest[size++] = '\n'; } /* Postimage from side #1 */ - if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, 1, + if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, needs_cr, 1, dest ? dest + size : NULL) < 0) return -1; @@ -199,7 +251,7 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, if (style == XDL_MERGE_DIFF3) { /* Shared preimage */ if (!dest) { - GITERR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, marker3_size); + GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker3_size); } else { memset(dest + size, '|', marker_size); size += marker_size; @@ -208,32 +260,36 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, memcpy(dest + size + 1, name3, marker3_size - 1); size += marker3_size; } + if (needs_cr) + dest[size++] = '\r'; dest[size++] = '\n'; } - if (xdl_orig_copy(&copied, xe1, m->i0, m->chg0, 1, + if (xdl_orig_copy(&copied, xe1, m->i0, m->chg0, needs_cr, 1, dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); } if (!dest) { - GITERR_CHECK_ALLOC_ADD3(&size, size, marker_size, 1); + GITERR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, needs_cr); } else { memset(dest + size, '=', marker_size); size += marker_size; + if (needs_cr) + dest[size++] = '\r'; dest[size++] = '\n'; } /* Postimage from side #2 */ - if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 1, + if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, needs_cr, 1, dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); if (!dest) { - GITERR_CHECK_ALLOC_ADD4(&size, size, marker_size, 1, marker2_size); + GITERR_CHECK_ALLOC_ADD5(&size, size, marker_size, 1, needs_cr, marker2_size); } else { memset(dest + size, '>', marker_size); size += marker_size; @@ -242,6 +298,8 @@ static int fill_conflict_hunk(size_t *out, xdfenv_t *xe1, const char *name1, memcpy(dest + size + 1, name2, marker2_size - 1); size += marker2_size; } + if (needs_cr) + dest[size++] = '\r'; dest[size++] = '\n'; } @@ -275,14 +333,16 @@ static int xdl_fill_merge_buffer(size_t *out, } else if (m->mode & 3) { /* Before conflicting part */ - if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, + if (xdl_recs_copy(&copied, xe1, i, m->i1 - i, 0, 0, dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); /* Postimage from side #1 */ if (m->mode & 1) { - if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, (m->mode & 2), + int needs_cr = is_cr_needed(xe1, xe2, m); + + if (xdl_recs_copy(&copied, xe1, m->i1, m->chg1, needs_cr, (m->mode & 2), dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); @@ -290,7 +350,7 @@ static int xdl_fill_merge_buffer(size_t *out, /* Postimage from side #2 */ if (m->mode & 2) { - if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 0, + if (xdl_recs_copy(&copied, xe2, m->i2, m->chg2, 0, 0, dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); @@ -300,7 +360,7 @@ static int xdl_fill_merge_buffer(size_t *out, i = m->i1 + m->chg1; } - if (xdl_recs_copy(&copied, xe1, i, xe1->xdf2.nrec - i, 0, + if (xdl_recs_copy(&copied, xe1, i, xe1->xdf2.nrec - i, 0, 0, dest ? dest + size : NULL) < 0) return -1; GITERR_CHECK_ALLOC_ADD(&size, size, copied); diff --git a/src/xdiff/xpatience.c b/src/xdiff/xpatience.c index 04e1a1ab2..cedf39cc3 100644 --- a/src/xdiff/xpatience.c +++ b/src/xdiff/xpatience.c @@ -1,6 +1,6 @@ /* * LibXDiff by Davide Libenzi ( File Differential Library ) - * Copyright (C) 2003-2009 Davide Libenzi, Johannes E. Schindelin + * Copyright (C) 2003-2016 Davide Libenzi, Johannes E. Schindelin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * @@ -62,6 +62,12 @@ struct hashmap { * initially, "next" reflects only the order in file1. */ struct entry *next, *previous; + + /* + * If 1, this entry can serve as an anchor. See + * Documentation/diff-options.txt for more information. + */ + unsigned anchor : 1; } *entries, *first, *last; /* were common records found? */ unsigned long has_matches; @@ -70,8 +76,19 @@ struct hashmap { xpparam_t const *xpp; }; +static int is_anchor(xpparam_t const *xpp, const char *line) +{ + unsigned long i; + for (i = 0; i < xpp->anchors_nr; i++) { + if (!strncmp(line, xpp->anchors[i], strlen(xpp->anchors[i]))) + return 1; + } + return 0; +} + /* The argument "pass" is 1 for the first file, 2 for the second. */ -static void insert_record(int line, struct hashmap *map, int pass) +static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map, + int pass) { xrecord_t **records = pass == 1 ? map->env->xdf1.recs : map->env->xdf2.recs; @@ -110,6 +127,7 @@ static void insert_record(int line, struct hashmap *map, int pass) return; map->entries[index].line1 = line; map->entries[index].hash = record->ha; + map->entries[index].anchor = is_anchor(xpp, map->env->xdf1.recs[line - 1]->ptr); if (!map->first) map->first = map->entries + index; if (map->last) { @@ -147,11 +165,11 @@ static int fill_hashmap(mmfile_t *file1, mmfile_t *file2, /* First, fill with entries from the first file */ while (count1--) - insert_record(line1++, result, 1); + insert_record(xpp, line1++, result, 1); /* Then search for matches in the second file */ while (count2--) - insert_record(line2++, result, 2); + insert_record(xpp, line2++, result, 2); return 0; } @@ -166,7 +184,7 @@ static int binary_search(struct entry **sequence, int longest, int left = -1, right = longest; while (left + 1 < right) { - int middle = (left + right) / 2; + int middle = left + (right - left) / 2; /* by construction, no two entries can be equal */ if (sequence[middle]->line2 > entry->line2) right = middle; @@ -192,14 +210,28 @@ static struct entry *find_longest_common_sequence(struct hashmap *map) int longest = 0, i; struct entry *entry; + /* + * If not -1, this entry in sequence must never be overridden. + * Therefore, overriding entries before this has no effect, so + * do not do that either. + */ + int anchor_i = -1; + for (entry = map->first; entry; entry = entry->next) { if (!entry->line2 || entry->line2 == NON_UNIQUE) continue; i = binary_search(sequence, longest, entry); entry->previous = i < 0 ? NULL : sequence[i]; - sequence[++i] = entry; - if (i == longest) + ++i; + if (i <= anchor_i) + continue; + sequence[i] = entry; + if (entry->anchor) { + anchor_i = i; + longest = anchor_i + 1; + } else if (i == longest) { longest++; + } } /* No common unique lines were found */ diff --git a/src/xdiff/xprepare.c b/src/xdiff/xprepare.c index 13b55aba7..abeb8fb84 100644 --- a/src/xdiff/xprepare.c +++ b/src/xdiff/xprepare.c @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * diff --git a/src/xdiff/xprepare.h b/src/xdiff/xprepare.h index 8fb06a537..947d9fc1b 100644 --- a/src/xdiff/xprepare.h +++ b/src/xdiff/xprepare.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * diff --git a/src/xdiff/xtypes.h b/src/xdiff/xtypes.h index 2511aef8d..8442bd436 100644 --- a/src/xdiff/xtypes.h +++ b/src/xdiff/xtypes.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * diff --git a/src/xdiff/xutils.c b/src/xdiff/xutils.c index 30f2a30ac..17c9ae184 100644 --- a/src/xdiff/xutils.c +++ b/src/xdiff/xutils.c @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * @@ -62,14 +62,14 @@ int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize, void *xdl_mmfile_first(mmfile_t *mmf, long *size) { - *size = (long)mmf->size; + *size = mmf->size; return mmf->ptr; } long xdl_mmfile_size(mmfile_t *mmf) { - return (long)mmf->size; + return mmf->size; } @@ -154,6 +154,24 @@ int xdl_blankline(const char *line, long size, long flags) return (i == size); } +/* + * Have we eaten everything on the line, except for an optional + * CR at the very end? + */ +static int ends_with_optional_cr(const char *l, long s, long i) +{ + int complete = s && l[s-1] == '\n'; + + if (complete) + s--; + if (s == i) + return 1; + /* do not ignore CR at the end of an incomplete line */ + if (complete && s == i + 1 && l[i] == '\r') + return 1; + return 0; +} + int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags) { int i1, i2; @@ -168,7 +186,8 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags) /* * -w matches everything that matches with -b, and -b in turn - * matches everything that matches with --ignore-space-at-eol. + * matches everything that matches with --ignore-space-at-eol, + * which in turn matches everything that matches with --ignore-cr-at-eol. * * Each flavor of ignoring needs different logic to skip whitespaces * while we have both sides to compare. @@ -198,8 +217,18 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags) return 0; } } else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL) { - while (i1 < s1 && i2 < s2 && l1[i1++] == l2[i2++]) - ; /* keep going */ + while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { + i1++; + i2++; + } + } else if (flags & XDF_IGNORE_CR_AT_EOL) { + /* Find the first difference and see how the line ends */ + while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { + i1++; + i2++; + } + return (ends_with_optional_cr(l1, s1, i1) && + ends_with_optional_cr(l2, s2, i2)); } /* @@ -226,9 +255,16 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data, char const *top, long flags) { unsigned long ha = 5381; char const *ptr = *data; + int cr_at_eol_only = (flags & XDF_WHITESPACE_FLAGS) == XDF_IGNORE_CR_AT_EOL; for (; ptr < top && *ptr != '\n'; ptr++) { - if (XDL_ISSPACE(*ptr)) { + if (cr_at_eol_only) { + /* do not ignore CR at the end of an incomplete line */ + if (*ptr == '\r' && + (ptr + 1 < top && ptr[1] == '\n')) + continue; + } + else if (XDL_ISSPACE(*ptr)) { const char *ptr2 = ptr; int at_eol; while (ptr + 1 < top && XDL_ISSPACE(ptr[1]) @@ -260,7 +296,6 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data, return ha; } - unsigned long xdl_hash_record(char const **data, char const *top, long flags) { unsigned long ha = 5381; char const *ptr = *data; @@ -277,7 +312,6 @@ unsigned long xdl_hash_record(char const **data, char const *top, long flags) { return ha; } - unsigned int xdl_hashbits(unsigned int size) { unsigned int val = 1, bits = 0; @@ -305,23 +339,9 @@ int xdl_num_out(char *out, long val) { *str++ = '0'; *str = '\0'; - return (int)(str - out); -} - - -long xdl_atol(char const *str, char const **next) { - long val, base; - char const *top; - - for (top = str; XDL_ISDIGIT(*top); top++); - if (next) - *next = top; - for (val = 0, base = 1, top--; top >= str; top--, base *= 10) - val += base * (long)(*top - '0'); - return val; + return str - out; } - int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2, const char *func, long funclen, xdemitcb_t *ecb) { int nb = 0; @@ -356,8 +376,8 @@ int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2, nb += 3; if (func && funclen) { buf[nb++] = ' '; - if (funclen > (long)sizeof(buf) - nb - 1) - funclen = (long)sizeof(buf) - nb - 1; + if (funclen > (long)(sizeof(buf) - nb - 1)) + funclen = sizeof(buf) - nb - 1; memcpy(buf + nb, func, funclen); nb += funclen; } diff --git a/src/xdiff/xutils.h b/src/xdiff/xutils.h index 8f952a8e6..fba7bae03 100644 --- a/src/xdiff/xutils.h +++ b/src/xdiff/xutils.h @@ -13,8 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * License along with this library; if not, see + * <http://www.gnu.org/licenses/>. * * Davide Libenzi <davidel@xmailserver.org> * @@ -31,15 +31,12 @@ int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize, int xdl_cha_init(chastore_t *cha, long isize, long icount); void xdl_cha_free(chastore_t *cha); void *xdl_cha_alloc(chastore_t *cha); -void *xdl_cha_first(chastore_t *cha); -void *xdl_cha_next(chastore_t *cha); long xdl_guess_lines(mmfile_t *mf, long sample); int xdl_blankline(const char *line, long size, long flags); int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags); unsigned long xdl_hash_record(char const **data, char const *top, long flags); unsigned int xdl_hashbits(unsigned int size); int xdl_num_out(char *out, long val); -long xdl_atol(char const *str, char const **next); int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2, const char *func, long funclen, xdemitcb_t *ecb); int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp, diff --git a/src/zstream.h b/src/zstream.h index cfe2b395f..47ecc1322 100644 --- a/src/zstream.h +++ b/src/zstream.h @@ -50,4 +50,4 @@ void git_zstream_reset(git_zstream *zstream); int git_zstream_deflatebuf(git_buf *out, const void *in, size_t in_len); int git_zstream_inflatebuf(git_buf *out, const void *in, size_t in_len); -#endif /* INCLUDE_zstream_h__ */ +#endif diff --git a/tests/config/read.c b/tests/config/read.c index 25a4fcaf4..a34455a0c 100644 --- a/tests/config/read.c +++ b/tests/config/read.c @@ -703,3 +703,48 @@ void test_config_read__path(void) git_buf_free(&expected_path); git_config_free(cfg); } + +void test_config_read__crlf_style_line_endings(void) +{ + git_buf buf = GIT_BUF_INIT; + git_config *cfg; + + cl_set_cleanup(&clean_test_config, NULL); + cl_git_mkfile("./testconfig", "[some]\r\n var = value\r\n"); + cl_git_pass(git_config_open_ondisk(&cfg, "./testconfig")); + cl_git_pass(git_config_get_string_buf(&buf, cfg, "some.var")); + cl_assert_equal_s(buf.ptr, "value"); + + git_config_free(cfg); + git_buf_free(&buf); +} + +void test_config_read__trailing_crlf(void) +{ + git_buf buf = GIT_BUF_INIT; + git_config *cfg; + + cl_set_cleanup(&clean_test_config, NULL); + cl_git_mkfile("./testconfig", "[some]\r\n var = value\r\n\r\n"); + cl_git_pass(git_config_open_ondisk(&cfg, "./testconfig")); + cl_git_pass(git_config_get_string_buf(&buf, cfg, "some.var")); + cl_assert_equal_s(buf.ptr, "value"); + + git_config_free(cfg); + git_buf_free(&buf); +} + +void test_config_read__bom(void) +{ + git_buf buf = GIT_BUF_INIT; + git_config *cfg; + + cl_set_cleanup(&clean_test_config, NULL); + cl_git_mkfile("./testconfig", "\xEF\xBB\xBF[some]\n var = value\n"); + cl_git_pass(git_config_open_ondisk(&cfg, "./testconfig")); + cl_git_pass(git_config_get_string_buf(&buf, cfg, "some.var")); + cl_assert_equal_s(buf.ptr, "value"); + + git_config_free(cfg); + git_buf_free(&buf); +} diff --git a/tests/merge/conflict_data.h b/tests/merge/conflict_data.h index 7d404c81f..27f19c1b0 100644 --- a/tests/merge/conflict_data.h +++ b/tests/merge/conflict_data.h @@ -70,22 +70,22 @@ "This is a mighty fine recipe!\n" \ ">>>>>>> branchF-2\n" -#define CONFLICTING_RECURSIVE_H1_TO_H2_WITH_DIFF3 \ +#define CONFLICTING_RECURSIVE_H2_TO_H1_WITH_DIFF3 \ "VEAL SOUP.\n" \ "\n" \ "<<<<<<< HEAD\n" \ - "put into a pot three quarts of water, three onions cut small, one\n" \ + "Put Into A Pot Three Quarts of Water, Three Onions Cut Small, One\n" \ "||||||| merged common ancestors\n" \ "<<<<<<<<< Temporary merge branch 1\n" \ - "Put into a pot three quarts of water, THREE ONIONS CUT SMALL, one\n" \ + "PUT INTO A POT three quarts of water, three onions cut small, one\n" \ "||||||||| merged common ancestors\n" \ "Put into a pot three quarts of water, three onions cut small, one\n" \ "=========\n" \ - "PUT INTO A POT three quarts of water, three onions cut small, one\n" \ + "Put into a pot three quarts of water, THREE ONIONS CUT SMALL, one\n" \ ">>>>>>>>> Temporary merge branch 2\n" \ "=======\n" \ - "Put Into A Pot Three Quarts of Water, Three Onions Cut Small, One\n" \ - ">>>>>>> branchH-2\n" \ + "put into a pot three quarts of water, three onions cut small, one\n" \ + ">>>>>>> branchH-1\n" \ "spoonful of black pepper pounded, and two of salt, with two or three\n" \ "slices of lean ham; let it boil steadily two hours; skim it\n" \ "occasionally, then put into it a shin of veal, let it boil two hours\n" \ diff --git a/tests/merge/files.c b/tests/merge/files.c index daa73fada..6f5a1fd9c 100644 --- a/tests/merge/files.c +++ b/tests/merge/files.c @@ -377,3 +377,51 @@ void test_merge_files__handles_binaries_when_favored(void) git_merge_file_result_free(&result); } + +void test_merge_files__crlf_conflict_markers_for_crlf_files(void) +{ + git_merge_file_input ancestor = GIT_MERGE_FILE_INPUT_INIT, + ours = GIT_MERGE_FILE_INPUT_INIT, + theirs = GIT_MERGE_FILE_INPUT_INIT; + git_merge_file_options opts = GIT_MERGE_FILE_OPTIONS_INIT; + git_merge_file_result result = {0}; + + const char *expected = + "<<<<<<< file.txt\r\nThis file\r\ndoes, too.\r\n" + "=======\r\nAnd so does\r\nthis one.\r\n>>>>>>> file.txt\r\n"; + size_t expected_len = strlen(expected); + + const char *expected_diff3 = + "<<<<<<< file.txt\r\nThis file\r\ndoes, too.\r\n" + "||||||| file.txt\r\nThis file has\r\nCRLF line endings.\r\n" + "=======\r\nAnd so does\r\nthis one.\r\n>>>>>>> file.txt\r\n"; + size_t expected_diff3_len = strlen(expected_diff3); + + ancestor.ptr = "This file has\r\nCRLF line endings.\r\n"; + ancestor.size = 35; + ancestor.path = "file.txt"; + ancestor.mode = 0100644; + + ours.ptr = "This file\r\ndoes, too.\r\n"; + ours.size = 23; + ours.path = "file.txt"; + ours.mode = 0100644; + + theirs.ptr = "And so does\r\nthis one.\r\n"; + theirs.size = 24; + theirs.path = "file.txt"; + theirs.mode = 0100644; + + cl_git_pass(git_merge_file(&result, &ancestor, &ours, &theirs, &opts)); + cl_assert_equal_i(0, result.automergeable); + cl_assert_equal_i(expected_len, result.len); + cl_assert(memcmp(expected, result.ptr, expected_len) == 0); + git_merge_file_result_free(&result); + + opts.flags |= GIT_MERGE_FILE_STYLE_DIFF3; + cl_git_pass(git_merge_file(&result, &ancestor, &ours, &theirs, &opts)); + cl_assert_equal_i(0, result.automergeable); + cl_assert_equal_i(expected_diff3_len, result.len); + cl_assert(memcmp(expected_diff3, result.ptr, expected_len) == 0); + git_merge_file_result_free(&result); +} diff --git a/tests/merge/trees/recursive.c b/tests/merge/trees/recursive.c index 1d54d87b1..71f5af150 100644 --- a/tests/merge/trees/recursive.c +++ b/tests/merge/trees/recursive.c @@ -312,7 +312,7 @@ void test_merge_trees_recursive__conflicting_merge_base(void) { 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" }, { 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" }, { 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" }, - { 0100644, "ba5714aa3d5aebfd8e19d19cb1ddcfda63426a44", 1, "veal.txt" }, + { 0100644, "cfc01b0976122eae42a82064440bbf534eddd7a0", 1, "veal.txt" }, { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" }, { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" }, }; @@ -339,14 +339,14 @@ void test_merge_trees_recursive__conflicting_merge_base_with_diff3(void) { 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" }, { 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" }, { 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" }, - { 0100644, "adb1bf17d112a0b4ecbd4e75bef6db3335d8ddcf", 1, "veal.txt" }, - { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" }, - { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" }, + { 0100644, "0b01d2f70a1c6b9ab60c382f3f9cdc8173da6736", 1, "veal.txt" }, + { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 2, "veal.txt" }, + { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 3, "veal.txt" }, }; opts.file_flags |= GIT_MERGE_FILE_STYLE_DIFF3; - cl_git_pass(merge_commits_from_branches(&index, repo, "branchH-1", "branchH-2", &opts)); + cl_git_pass(merge_commits_from_branches(&index, repo, "branchH-2", "branchH-1", &opts)); cl_assert(merge_test_index(index, merge_index_entries, 8)); @@ -392,19 +392,67 @@ void test_merge_trees_recursive__recursionlimit(void) { 0100644, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d", 0, "asparagus.txt" }, { 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" }, { 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" }, - { 0100644, "ce7e553c6feb6e5f3bd67e3c3be04182fe3094b4", 1, "gravy.txt" }, - { 0100644, "d8dd349b78f19a4ebe3357bacb8138f00bf5ed41", 2, "gravy.txt" }, - { 0100644, "e50fbbd701458757bdfe9815f58ed717c588d1b5", 3, "gravy.txt" }, + { 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" }, { 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" }, - { 0100644, "a7b066537e6be7109abfe4ff97b675d4e077da20", 0, "veal.txt" }, + { 0100644, "53217e8ac3f52bccf7603b8fff0ed0f4817f9bb7", 1, "veal.txt" }, + { 0100644, "898d12687fb35be271c27c795a6b32c8b51da79e", 2, "veal.txt" }, + { 0100644, "68a2e1ee61a23a4728fe6b35580fbbbf729df370", 3, "veal.txt" }, }; opts.recursion_limit = 1; - cl_git_pass(merge_commits_from_branches(&index, repo, "branchE-1", "branchE-2", &opts)); + cl_git_pass(merge_commits_from_branches(&index, repo, "branchC-1", "branchC-2", &opts)); cl_assert(merge_test_index(index, merge_index_entries, 8)); git_index_free(index); } +/* There are multiple levels of criss-cross merges. This ensures + * that the virtual merge base parents are compared in the same + * order as git. If the base parents are created in the order as + * git does, then the file `targetfile.txt` is automerged. If not, + * `targetfile.txt` will be in conflict due to the virtual merge + * base. + */ +void test_merge_trees_recursive__merge_base_for_virtual_commit(void) +{ + git_index *index; + git_merge_options opts = GIT_MERGE_OPTIONS_INIT; + + struct merge_index_entry merge_index_entries[] = { + { 0100644, "1bde1883de4977ea3e664b315da951d1f614c3b1", 0, "targetfile.txt" }, + { 0100644, "b7de2b52ba055688061355fad1599a5d214ce8f8", 1, "version.txt" }, + { 0100644, "358efd6f589384fa8baf92234db9c7899a53916e", 2, "version.txt" }, + { 0100644, "a664873b1c0b9a1ed300f8644dde536fdaa3a34f", 3, "version.txt" }, + }; + + cl_git_pass(merge_commits_from_branches(&index, repo, "branchJ-1", "branchJ-2", &opts)); + + cl_assert(merge_test_index(index, merge_index_entries, 4)); + + git_index_free(index); +} + +/* This test is the same as above, but the graph is constructed such + * that the 1st-recursion merge bases of the two heads are + * in a different order. + */ +void test_merge_trees_recursive__merge_base_for_virtual_commit_2(void) +{ + git_index *index; + git_merge_options opts = GIT_MERGE_OPTIONS_INIT; + + struct merge_index_entry merge_index_entries[] = { + { 0100644, "4a06b258fed8a4d15967ec4253ae7366b70f727d", 0, "targetfile.txt" }, + { 0100644, "b6bd0f9952f396e757d3f91e08c59a7e91707201", 1, "version.txt" }, + { 0100644, "f0856993e005c0d8ed2dc7cdc222cc1d89fb3c77", 2, "version.txt" }, + { 0100644, "2cba583804a4a6fad1baf97c959be447238d1489", 3, "version.txt" }, + }; + + cl_git_pass(merge_commits_from_branches(&index, repo, "branchK-1", "branchK-2", &opts)); + + cl_assert(merge_test_index(index, merge_index_entries, 4)); + + git_index_free(index); +} diff --git a/tests/merge/workdir/recursive.c b/tests/merge/workdir/recursive.c index 3c745947c..d47a0c50b 100644 --- a/tests/merge/workdir/recursive.c +++ b/tests/merge/workdir/recursive.c @@ -62,22 +62,22 @@ void test_merge_workdir_recursive__conflicting_merge_base_with_diff3(void) { 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" }, { 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" }, { 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" }, - { 0100644, "adb1bf17d112a0b4ecbd4e75bef6db3335d8ddcf", 1, "veal.txt" }, - { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" }, - { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" }, + { 0100644, "0b01d2f70a1c6b9ab60c382f3f9cdc8173da6736", 1, "veal.txt" }, + { 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 2, "veal.txt" }, + { 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 3, "veal.txt" }, }; opts.file_flags |= GIT_MERGE_FILE_STYLE_DIFF3; checkout_opts.checkout_strategy |= GIT_CHECKOUT_CONFLICT_STYLE_DIFF3; - cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR "branchH-1", GIT_REFS_HEADS_DIR "branchH-2", &opts, &checkout_opts)); + cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR "branchH-2", GIT_REFS_HEADS_DIR "branchH-1", &opts, &checkout_opts)); cl_git_pass(git_repository_index(&index, repo)); cl_assert(merge_test_index(index, merge_index_entries, 8)); cl_git_pass(git_futils_readbuffer(&conflicting_buf, "merge-recursive/veal.txt")); - cl_assert_equal_s(CONFLICTING_RECURSIVE_H1_TO_H2_WITH_DIFF3, conflicting_buf.ptr); + cl_assert_equal_s(CONFLICTING_RECURSIVE_H2_TO_H1_WITH_DIFF3, conflicting_buf.ptr); git_index_free(index); git_buf_free(&conflicting_buf); diff --git a/tests/resources/merge-recursive/.gitted/objects/03/9d0da126f24b819a5a38186249c7f96be3824c b/tests/resources/merge-recursive/.gitted/objects/03/9d0da126f24b819a5a38186249c7f96be3824c Binary files differnew file mode 100644 index 000000000..79ad635ff --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/03/9d0da126f24b819a5a38186249c7f96be3824c diff --git a/tests/resources/merge-recursive/.gitted/objects/05/63b7706dcdcf94bc0c02cd96c137940278eca9 b/tests/resources/merge-recursive/.gitted/objects/05/63b7706dcdcf94bc0c02cd96c137940278eca9 Binary files differnew file mode 100644 index 000000000..c6d38a7d3 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/05/63b7706dcdcf94bc0c02cd96c137940278eca9 diff --git a/tests/resources/merge-recursive/.gitted/objects/08/f01e1bff7e442d574eb221913515b4bd27ccd6 b/tests/resources/merge-recursive/.gitted/objects/08/f01e1bff7e442d574eb221913515b4bd27ccd6 Binary files differnew file mode 100644 index 000000000..c2fbf5ba7 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/08/f01e1bff7e442d574eb221913515b4bd27ccd6 diff --git a/tests/resources/merge-recursive/.gitted/objects/0b/beee1982b493330e375a85bbfddaba3d561556 b/tests/resources/merge-recursive/.gitted/objects/0b/beee1982b493330e375a85bbfddaba3d561556 Binary files differnew file mode 100644 index 000000000..66b927246 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/0b/beee1982b493330e375a85bbfddaba3d561556 diff --git a/tests/resources/merge-recursive/.gitted/objects/0c/e202f64fa8356c1a32835fce4058ca76b0c7ed b/tests/resources/merge-recursive/.gitted/objects/0c/e202f64fa8356c1a32835fce4058ca76b0c7ed Binary files differnew file mode 100644 index 000000000..9a84b7149 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/0c/e202f64fa8356c1a32835fce4058ca76b0c7ed diff --git a/tests/resources/merge-recursive/.gitted/objects/0e/c39d71c1b074905350ce20ce3f0629f737a2a9 b/tests/resources/merge-recursive/.gitted/objects/0e/c39d71c1b074905350ce20ce3f0629f737a2a9 Binary files differnew file mode 100644 index 000000000..68808d2f3 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/0e/c39d71c1b074905350ce20ce3f0629f737a2a9 diff --git a/tests/resources/merge-recursive/.gitted/objects/17/946ad3088f931102e5d81f94cf2825fc188953 b/tests/resources/merge-recursive/.gitted/objects/17/946ad3088f931102e5d81f94cf2825fc188953 Binary files differnew file mode 100644 index 000000000..9cc133e94 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/17/946ad3088f931102e5d81f94cf2825fc188953 diff --git a/tests/resources/merge-recursive/.gitted/objects/18/2d0d250d1d7adcc60c178be5be98358b3a2fd1 b/tests/resources/merge-recursive/.gitted/objects/18/2d0d250d1d7adcc60c178be5be98358b3a2fd1 new file mode 100644 index 000000000..96674c89b --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/18/2d0d250d1d7adcc60c178be5be98358b3a2fd1 @@ -0,0 +1,5 @@ +xK +1]_>@H +^<j2i4Fg9ʼn ++3L6{vX +`F:?CtM`y"*iT)R3M!{3+ךqϷ%@m9I
{ܫvpx/E
\ No newline at end of file diff --git a/tests/resources/merge-recursive/.gitted/objects/1b/c7bcccf4bbdc8bfba2331a37ad5e9cf1dd321c b/tests/resources/merge-recursive/.gitted/objects/1b/c7bcccf4bbdc8bfba2331a37ad5e9cf1dd321c Binary files differnew file mode 100644 index 000000000..811716700 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/1b/c7bcccf4bbdc8bfba2331a37ad5e9cf1dd321c diff --git a/tests/resources/merge-recursive/.gitted/objects/1b/de1883de4977ea3e664b315da951d1f614c3b1 b/tests/resources/merge-recursive/.gitted/objects/1b/de1883de4977ea3e664b315da951d1f614c3b1 Binary files differnew file mode 100644 index 000000000..67daf36ae --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/1b/de1883de4977ea3e664b315da951d1f614c3b1 diff --git a/tests/resources/merge-recursive/.gitted/objects/23/b427bf6278724433e64ef4cf6dc166c4f2e246 b/tests/resources/merge-recursive/.gitted/objects/23/b427bf6278724433e64ef4cf6dc166c4f2e246 Binary files differnew file mode 100644 index 000000000..03be909e4 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/23/b427bf6278724433e64ef4cf6dc166c4f2e246 diff --git a/tests/resources/merge-recursive/.gitted/objects/23/cf2687a9327d55abbbd788ff04fa932072aebc b/tests/resources/merge-recursive/.gitted/objects/23/cf2687a9327d55abbbd788ff04fa932072aebc Binary files differnew file mode 100644 index 000000000..5cc665a0c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/23/cf2687a9327d55abbbd788ff04fa932072aebc diff --git a/tests/resources/merge-recursive/.gitted/objects/26/d3c94459b4faa08f009b15867993ca34153592 b/tests/resources/merge-recursive/.gitted/objects/26/d3c94459b4faa08f009b15867993ca34153592 new file mode 100644 index 000000000..dd7b1a245 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/26/d3c94459b4faa08f009b15867993ca34153592 @@ -0,0 +1,2 @@ +xA +1E]vڂ+O 3mF*x{\yZ܀7BH5Ț:sYB9D3Ohk1T-ؑpt>N"1[!#v_+\>uVo,ӭȼZ@2l1 N{`?Ts6_?B*
\ No newline at end of file diff --git a/tests/resources/merge-recursive/.gitted/objects/2c/ba583804a4a6fad1baf97c959be447238d1489 b/tests/resources/merge-recursive/.gitted/objects/2c/ba583804a4a6fad1baf97c959be447238d1489 Binary files differnew file mode 100644 index 000000000..c0a60a172 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/2c/ba583804a4a6fad1baf97c959be447238d1489 diff --git a/tests/resources/merge-recursive/.gitted/objects/2e/7ae0d42fb7b6126f6a08ac6314ac07833a52f6 b/tests/resources/merge-recursive/.gitted/objects/2e/7ae0d42fb7b6126f6a08ac6314ac07833a52f6 Binary files differnew file mode 100644 index 000000000..6a9651c76 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/2e/7ae0d42fb7b6126f6a08ac6314ac07833a52f6 diff --git a/tests/resources/merge-recursive/.gitted/objects/30/39c07db695c8c99d0a7c7e32f0afe40eae0be0 b/tests/resources/merge-recursive/.gitted/objects/30/39c07db695c8c99d0a7c7e32f0afe40eae0be0 new file mode 100644 index 000000000..cc21b5c31 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/30/39c07db695c8c99d0a7c7e32f0afe40eae0be0 @@ -0,0 +1,3 @@ +xQ +!@sB"茵mݾ +}^^Z"(J8iŌI]98Xd)QNX"[2^t|,pZ }5./[V]B
\ No newline at end of file diff --git a/tests/resources/merge-recursive/.gitted/objects/35/8efd6f589384fa8baf92234db9c7899a53916e b/tests/resources/merge-recursive/.gitted/objects/35/8efd6f589384fa8baf92234db9c7899a53916e Binary files differnew file mode 100644 index 000000000..aefc81ad5 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/35/8efd6f589384fa8baf92234db9c7899a53916e diff --git a/tests/resources/merge-recursive/.gitted/objects/35/dda4f3f9b3794d92a46d908790e550ed100eae b/tests/resources/merge-recursive/.gitted/objects/35/dda4f3f9b3794d92a46d908790e550ed100eae Binary files differnew file mode 100644 index 000000000..d6cabb419 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/35/dda4f3f9b3794d92a46d908790e550ed100eae diff --git a/tests/resources/merge-recursive/.gitted/objects/36/71e42c8c8302d1a71c0ed7bf2b0a938e9e20f9 b/tests/resources/merge-recursive/.gitted/objects/36/71e42c8c8302d1a71c0ed7bf2b0a938e9e20f9 Binary files differnew file mode 100644 index 000000000..4f70ad6d4 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/36/71e42c8c8302d1a71c0ed7bf2b0a938e9e20f9 diff --git a/tests/resources/merge-recursive/.gitted/objects/39/78944e4cd53edcc10a170ab2ff142f7295b958 b/tests/resources/merge-recursive/.gitted/objects/39/78944e4cd53edcc10a170ab2ff142f7295b958 Binary files differnew file mode 100644 index 000000000..b18fd4836 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/39/78944e4cd53edcc10a170ab2ff142f7295b958 diff --git a/tests/resources/merge-recursive/.gitted/objects/3a/0dc89a8bd20e74fae69d2e038b47360fafb02e b/tests/resources/merge-recursive/.gitted/objects/3a/0dc89a8bd20e74fae69d2e038b47360fafb02e Binary files differnew file mode 100644 index 000000000..fdff502d1 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/3a/0dc89a8bd20e74fae69d2e038b47360fafb02e diff --git a/tests/resources/merge-recursive/.gitted/objects/3a/8c70144d0334721154b1e0529716b368483d6f b/tests/resources/merge-recursive/.gitted/objects/3a/8c70144d0334721154b1e0529716b368483d6f Binary files differnew file mode 100644 index 000000000..958d17d35 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/3a/8c70144d0334721154b1e0529716b368483d6f diff --git a/tests/resources/merge-recursive/.gitted/objects/3e/eff81b57a0ac15a5ab6bb3a8e92511a01a429c b/tests/resources/merge-recursive/.gitted/objects/3e/eff81b57a0ac15a5ab6bb3a8e92511a01a429c Binary files differnew file mode 100644 index 000000000..6a6c65460 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/3e/eff81b57a0ac15a5ab6bb3a8e92511a01a429c diff --git a/tests/resources/merge-recursive/.gitted/objects/40/9f5d072decec684331672f2d6c0a9bc3640adb b/tests/resources/merge-recursive/.gitted/objects/40/9f5d072decec684331672f2d6c0a9bc3640adb Binary files differnew file mode 100644 index 000000000..b4c9005e1 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/40/9f5d072decec684331672f2d6c0a9bc3640adb diff --git a/tests/resources/merge-recursive/.gitted/objects/44/faf5fba1af850dae54f8b2345938d3c7ae479f b/tests/resources/merge-recursive/.gitted/objects/44/faf5fba1af850dae54f8b2345938d3c7ae479f Binary files differnew file mode 100644 index 000000000..d0bc09902 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/44/faf5fba1af850dae54f8b2345938d3c7ae479f diff --git a/tests/resources/merge-recursive/.gitted/objects/4a/06b258fed8a4d15967ec4253ae7366b70f727d b/tests/resources/merge-recursive/.gitted/objects/4a/06b258fed8a4d15967ec4253ae7366b70f727d Binary files differnew file mode 100644 index 000000000..d3e181501 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/4a/06b258fed8a4d15967ec4253ae7366b70f727d diff --git a/tests/resources/merge-recursive/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/tests/resources/merge-recursive/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 Binary files differnew file mode 100644 index 000000000..adf64119a --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 diff --git a/tests/resources/merge-recursive/.gitted/objects/4c/62e9482ed42c1a6d08891906b26126daa4a8f5 b/tests/resources/merge-recursive/.gitted/objects/4c/62e9482ed42c1a6d08891906b26126daa4a8f5 Binary files differnew file mode 100644 index 000000000..f3cee9a2d --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/4c/62e9482ed42c1a6d08891906b26126daa4a8f5 diff --git a/tests/resources/merge-recursive/.gitted/objects/50/4dd93fb5b9c2a28c094c6e84ef0606de1e9b5c b/tests/resources/merge-recursive/.gitted/objects/50/4dd93fb5b9c2a28c094c6e84ef0606de1e9b5c Binary files differnew file mode 100644 index 000000000..214d3076d --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/50/4dd93fb5b9c2a28c094c6e84ef0606de1e9b5c diff --git a/tests/resources/merge-recursive/.gitted/objects/50/dfa64a56b488fe8082371b182c8a3e3c942332 b/tests/resources/merge-recursive/.gitted/objects/50/dfa64a56b488fe8082371b182c8a3e3c942332 Binary files differnew file mode 100644 index 000000000..7c90c99af --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/50/dfa64a56b488fe8082371b182c8a3e3c942332 diff --git a/tests/resources/merge-recursive/.gitted/objects/51/135c5884d7dd132fef3b432cca5826bab98f37 b/tests/resources/merge-recursive/.gitted/objects/51/135c5884d7dd132fef3b432cca5826bab98f37 Binary files differnew file mode 100644 index 000000000..95818f144 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/51/135c5884d7dd132fef3b432cca5826bab98f37 diff --git a/tests/resources/merge-recursive/.gitted/objects/51/60ab78c1973dcd7cdebe2345dc8fcfc755e76d b/tests/resources/merge-recursive/.gitted/objects/51/60ab78c1973dcd7cdebe2345dc8fcfc755e76d Binary files differnew file mode 100644 index 000000000..f3f99d7fe --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/51/60ab78c1973dcd7cdebe2345dc8fcfc755e76d diff --git a/tests/resources/merge-recursive/.gitted/objects/56/fcbad344aafe519bafcc33c87b8e64849d82ab b/tests/resources/merge-recursive/.gitted/objects/56/fcbad344aafe519bafcc33c87b8e64849d82ab Binary files differnew file mode 100644 index 000000000..06bea32e6 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/56/fcbad344aafe519bafcc33c87b8e64849d82ab diff --git a/tests/resources/merge-recursive/.gitted/objects/5a/47615db824433f816ba62217dda6d46c5a7640 b/tests/resources/merge-recursive/.gitted/objects/5a/47615db824433f816ba62217dda6d46c5a7640 Binary files differnew file mode 100644 index 000000000..c1e30ce54 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/5a/47615db824433f816ba62217dda6d46c5a7640 diff --git a/tests/resources/merge-recursive/.gitted/objects/5c/27b5f7c6f6dd4e5b4d64976741d56c2df8f48a b/tests/resources/merge-recursive/.gitted/objects/5c/27b5f7c6f6dd4e5b4d64976741d56c2df8f48a Binary files differnew file mode 100644 index 000000000..783d085a7 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/5c/27b5f7c6f6dd4e5b4d64976741d56c2df8f48a diff --git a/tests/resources/merge-recursive/.gitted/objects/5d/998d5f278aff5693711bc48f6852aac4b603ad b/tests/resources/merge-recursive/.gitted/objects/5d/998d5f278aff5693711bc48f6852aac4b603ad Binary files differnew file mode 100644 index 000000000..a7795f59b --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/5d/998d5f278aff5693711bc48f6852aac4b603ad diff --git a/tests/resources/merge-recursive/.gitted/objects/61/6d1209afac499b005f68309e1593b44899b054 b/tests/resources/merge-recursive/.gitted/objects/61/6d1209afac499b005f68309e1593b44899b054 Binary files differnew file mode 100644 index 000000000..6a06214d7 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/61/6d1209afac499b005f68309e1593b44899b054 diff --git a/tests/resources/merge-recursive/.gitted/objects/71/c50785d8d512293bd3af838b131f3da5829ebc b/tests/resources/merge-recursive/.gitted/objects/71/c50785d8d512293bd3af838b131f3da5829ebc Binary files differnew file mode 100644 index 000000000..23c40332e --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/71/c50785d8d512293bd3af838b131f3da5829ebc diff --git a/tests/resources/merge-recursive/.gitted/objects/75/afa96db00c26c6ebf3b377615b4e2a20563ee4 b/tests/resources/merge-recursive/.gitted/objects/75/afa96db00c26c6ebf3b377615b4e2a20563ee4 Binary files differnew file mode 100644 index 000000000..11d7f94a9 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/75/afa96db00c26c6ebf3b377615b4e2a20563ee4 diff --git a/tests/resources/merge-recursive/.gitted/objects/76/6afbfd7d42f757f1fac9ea550c9fcbc8041b89 b/tests/resources/merge-recursive/.gitted/objects/76/6afbfd7d42f757f1fac9ea550c9fcbc8041b89 Binary files differnew file mode 100644 index 000000000..a5af38357 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/76/6afbfd7d42f757f1fac9ea550c9fcbc8041b89 diff --git a/tests/resources/merge-recursive/.gitted/objects/7c/61830f8b8632665bb44ae5d219f520f5aa5bb4 b/tests/resources/merge-recursive/.gitted/objects/7c/61830f8b8632665bb44ae5d219f520f5aa5bb4 Binary files differnew file mode 100644 index 000000000..04b10f7ee --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/7c/61830f8b8632665bb44ae5d219f520f5aa5bb4 diff --git a/tests/resources/merge-recursive/.gitted/objects/7c/9a30d8dcee320a3b1f9ed10b582479faa9d3a1 b/tests/resources/merge-recursive/.gitted/objects/7c/9a30d8dcee320a3b1f9ed10b582479faa9d3a1 Binary files differnew file mode 100644 index 000000000..7500a241e --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/7c/9a30d8dcee320a3b1f9ed10b582479faa9d3a1 diff --git a/tests/resources/merge-recursive/.gitted/objects/7e/2d2bad4fc21f2832ca2afd48b1f95ab37ffb92 b/tests/resources/merge-recursive/.gitted/objects/7e/2d2bad4fc21f2832ca2afd48b1f95ab37ffb92 Binary files differnew file mode 100644 index 000000000..11f96c9c8 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/7e/2d2bad4fc21f2832ca2afd48b1f95ab37ffb92 diff --git a/tests/resources/merge-recursive/.gitted/objects/7e/70a7872576bba7e299cde45abb7da1e4d7ba81 b/tests/resources/merge-recursive/.gitted/objects/7e/70a7872576bba7e299cde45abb7da1e4d7ba81 Binary files differnew file mode 100644 index 000000000..cab463975 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/7e/70a7872576bba7e299cde45abb7da1e4d7ba81 diff --git a/tests/resources/merge-recursive/.gitted/objects/7f/9c1d78d760cbfa99273bc1ef642d994c6baa5c b/tests/resources/merge-recursive/.gitted/objects/7f/9c1d78d760cbfa99273bc1ef642d994c6baa5c Binary files differnew file mode 100644 index 000000000..46c8e8523 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/7f/9c1d78d760cbfa99273bc1ef642d994c6baa5c diff --git a/tests/resources/merge-recursive/.gitted/objects/81/60cb53660b86c954144b8dbbb0b6e4db4ba6ba b/tests/resources/merge-recursive/.gitted/objects/81/60cb53660b86c954144b8dbbb0b6e4db4ba6ba Binary files differnew file mode 100644 index 000000000..19d32c770 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/81/60cb53660b86c954144b8dbbb0b6e4db4ba6ba diff --git a/tests/resources/merge-recursive/.gitted/objects/8f/1b918542a5fe9b3bb7a8770a7525ad5b3b5864 b/tests/resources/merge-recursive/.gitted/objects/8f/1b918542a5fe9b3bb7a8770a7525ad5b3b5864 Binary files differnew file mode 100644 index 000000000..5ecb3e57b --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/8f/1b918542a5fe9b3bb7a8770a7525ad5b3b5864 diff --git a/tests/resources/merge-recursive/.gitted/objects/97/5dd228fd1b0cacf2988167088fd1190c9ac0f5 b/tests/resources/merge-recursive/.gitted/objects/97/5dd228fd1b0cacf2988167088fd1190c9ac0f5 Binary files differnew file mode 100644 index 000000000..96658c4fb --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/97/5dd228fd1b0cacf2988167088fd1190c9ac0f5 diff --git a/tests/resources/merge-recursive/.gitted/objects/98/5b725cf91c6861b5e7a419415d03cbcf5f16ca b/tests/resources/merge-recursive/.gitted/objects/98/5b725cf91c6861b5e7a419415d03cbcf5f16ca Binary files differnew file mode 100644 index 000000000..bc95c6fc5 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/98/5b725cf91c6861b5e7a419415d03cbcf5f16ca diff --git a/tests/resources/merge-recursive/.gitted/objects/98/cacbdd1fac7bbab54a6c7c97aa2103219e08b8 b/tests/resources/merge-recursive/.gitted/objects/98/cacbdd1fac7bbab54a6c7c97aa2103219e08b8 Binary files differnew file mode 100644 index 000000000..13344d86c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/98/cacbdd1fac7bbab54a6c7c97aa2103219e08b8 diff --git a/tests/resources/merge-recursive/.gitted/objects/99/754e36599906b81b917447280c4918269e14ff b/tests/resources/merge-recursive/.gitted/objects/99/754e36599906b81b917447280c4918269e14ff Binary files differnew file mode 100644 index 000000000..40455efab --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/99/754e36599906b81b917447280c4918269e14ff diff --git a/tests/resources/merge-recursive/.gitted/objects/9a/228c1ee87f286202ec9a25de837a18550013b5 b/tests/resources/merge-recursive/.gitted/objects/9a/228c1ee87f286202ec9a25de837a18550013b5 Binary files differnew file mode 100644 index 000000000..d6bcd5262 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/9a/228c1ee87f286202ec9a25de837a18550013b5 diff --git a/tests/resources/merge-recursive/.gitted/objects/9c/dde216049c6a5ccddac0ad81f604419d8990ed b/tests/resources/merge-recursive/.gitted/objects/9c/dde216049c6a5ccddac0ad81f604419d8990ed new file mode 100644 index 000000000..9f2c92851 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/9c/dde216049c6a5ccddac0ad81f604419d8990ed @@ -0,0 +1,2 @@ +xQ +B!EvnPDbA϶繜Z箝Mo"7)Hvdq0!S,T( J𬞩ɣ8q`8>*}mi,K҇}4/;ZQѻzk1j#WuvCN
\ No newline at end of file diff --git a/tests/resources/merge-recursive/.gitted/objects/a0/ce8909834f389b4f8be6a6ec420868422d40a1 b/tests/resources/merge-recursive/.gitted/objects/a0/ce8909834f389b4f8be6a6ec420868422d40a1 Binary files differnew file mode 100644 index 000000000..5f6643c59 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/a0/ce8909834f389b4f8be6a6ec420868422d40a1 diff --git a/tests/resources/merge-recursive/.gitted/objects/a2/817ed0e8ca6fe52bf0a20b2f50eb94b9ea5415 b/tests/resources/merge-recursive/.gitted/objects/a2/817ed0e8ca6fe52bf0a20b2f50eb94b9ea5415 Binary files differnew file mode 100644 index 000000000..a043a8e03 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/a2/817ed0e8ca6fe52bf0a20b2f50eb94b9ea5415 diff --git a/tests/resources/merge-recursive/.gitted/objects/a3/5aa65d86215fce909fc0bcce8949d12becba44 b/tests/resources/merge-recursive/.gitted/objects/a3/5aa65d86215fce909fc0bcce8949d12becba44 Binary files differnew file mode 100644 index 000000000..e71e9ec44 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/a3/5aa65d86215fce909fc0bcce8949d12becba44 diff --git a/tests/resources/merge-recursive/.gitted/objects/a3/ca4c462e93fee824c8ad500917ae34b800dea4 b/tests/resources/merge-recursive/.gitted/objects/a3/ca4c462e93fee824c8ad500917ae34b800dea4 Binary files differnew file mode 100644 index 000000000..dff9e9750 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/a3/ca4c462e93fee824c8ad500917ae34b800dea4 diff --git a/tests/resources/merge-recursive/.gitted/objects/a6/64873b1c0b9a1ed300f8644dde536fdaa3a34f b/tests/resources/merge-recursive/.gitted/objects/a6/64873b1c0b9a1ed300f8644dde536fdaa3a34f Binary files differnew file mode 100644 index 000000000..f6b66dada --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/a6/64873b1c0b9a1ed300f8644dde536fdaa3a34f diff --git a/tests/resources/merge-recursive/.gitted/objects/a9/9bf55117ab1958171fccfeb19885f707bd08fd b/tests/resources/merge-recursive/.gitted/objects/a9/9bf55117ab1958171fccfeb19885f707bd08fd Binary files differnew file mode 100644 index 000000000..9c3a3ec28 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/a9/9bf55117ab1958171fccfeb19885f707bd08fd diff --git a/tests/resources/merge-recursive/.gitted/objects/b0/1de62cf11945685c98ec671edabdff3e90ddc5 b/tests/resources/merge-recursive/.gitted/objects/b0/1de62cf11945685c98ec671edabdff3e90ddc5 Binary files differnew file mode 100644 index 000000000..786c9a510 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b0/1de62cf11945685c98ec671edabdff3e90ddc5 diff --git a/tests/resources/merge-recursive/.gitted/objects/b0/4823b75c8220b89c2f8da54709cda262304cd3 b/tests/resources/merge-recursive/.gitted/objects/b0/4823b75c8220b89c2f8da54709cda262304cd3 Binary files differnew file mode 100644 index 000000000..81714b06d --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b0/4823b75c8220b89c2f8da54709cda262304cd3 diff --git a/tests/resources/merge-recursive/.gitted/objects/b1/71224a4f604b6091072007765419b14c232c1d b/tests/resources/merge-recursive/.gitted/objects/b1/71224a4f604b6091072007765419b14c232c1d Binary files differnew file mode 100644 index 000000000..987d5fec1 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b1/71224a4f604b6091072007765419b14c232c1d diff --git a/tests/resources/merge-recursive/.gitted/objects/b2/908343e3c16249d0036dd444fc0d4662cd8c0e b/tests/resources/merge-recursive/.gitted/objects/b2/908343e3c16249d0036dd444fc0d4662cd8c0e Binary files differnew file mode 100644 index 000000000..7f0e0aba6 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b2/908343e3c16249d0036dd444fc0d4662cd8c0e diff --git a/tests/resources/merge-recursive/.gitted/objects/b6/bd0f9952f396e757d3f91e08c59a7e91707201 b/tests/resources/merge-recursive/.gitted/objects/b6/bd0f9952f396e757d3f91e08c59a7e91707201 Binary files differnew file mode 100644 index 000000000..87cb8fa04 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b6/bd0f9952f396e757d3f91e08c59a7e91707201 diff --git a/tests/resources/merge-recursive/.gitted/objects/b7/de2b52ba055688061355fad1599a5d214ce8f8 b/tests/resources/merge-recursive/.gitted/objects/b7/de2b52ba055688061355fad1599a5d214ce8f8 Binary files differnew file mode 100644 index 000000000..6fbf58187 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b7/de2b52ba055688061355fad1599a5d214ce8f8 diff --git a/tests/resources/merge-recursive/.gitted/objects/b8/a3b657edcf31e6365a2f1c45d45e6c9ebe8f02 b/tests/resources/merge-recursive/.gitted/objects/b8/a3b657edcf31e6365a2f1c45d45e6c9ebe8f02 Binary files differnew file mode 100644 index 000000000..0b8404bf3 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/b8/a3b657edcf31e6365a2f1c45d45e6c9ebe8f02 diff --git a/tests/resources/merge-recursive/.gitted/objects/ba/9dcfe079848e8e5c1b53bc3b6e47ff57f6e481 b/tests/resources/merge-recursive/.gitted/objects/ba/9dcfe079848e8e5c1b53bc3b6e47ff57f6e481 Binary files differnew file mode 100644 index 000000000..c43b79da3 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/ba/9dcfe079848e8e5c1b53bc3b6e47ff57f6e481 diff --git a/tests/resources/merge-recursive/.gitted/objects/bb/4e0014fb09d24312f0af37c7a45e5488f19510 b/tests/resources/merge-recursive/.gitted/objects/bb/4e0014fb09d24312f0af37c7a45e5488f19510 new file mode 100644 index 000000000..ca45760cd --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/bb/4e0014fb09d24312f0af37c7a45e5488f19510 @@ -0,0 +1,4 @@ +xKj1)tVs}ղf2f'_WT-2
cSK v&8)`# +*ssMI (J%5BUx +!R
JbInMju~1OQd]t 1 +~h2OP#
\ No newline at end of file diff --git a/tests/resources/merge-recursive/.gitted/objects/c0/dcb4bfcd86e65a822090aa7a0455413828886b b/tests/resources/merge-recursive/.gitted/objects/c0/dcb4bfcd86e65a822090aa7a0455413828886b Binary files differnew file mode 100644 index 000000000..f8fe20180 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/c0/dcb4bfcd86e65a822090aa7a0455413828886b diff --git a/tests/resources/merge-recursive/.gitted/objects/c4/44758b02d4af6e3145ac2fc0e3ed02199cf7ec b/tests/resources/merge-recursive/.gitted/objects/c4/44758b02d4af6e3145ac2fc0e3ed02199cf7ec Binary files differnew file mode 100644 index 000000000..b2f6662a0 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/c4/44758b02d4af6e3145ac2fc0e3ed02199cf7ec diff --git a/tests/resources/merge-recursive/.gitted/objects/c7/f3257db72e885d6612080c003e0f2ef480e0c4 b/tests/resources/merge-recursive/.gitted/objects/c7/f3257db72e885d6612080c003e0f2ef480e0c4 Binary files differnew file mode 100644 index 000000000..255624e93 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/c7/f3257db72e885d6612080c003e0f2ef480e0c4 diff --git a/tests/resources/merge-recursive/.gitted/objects/ce/0d744cd2e18eacf883d43471636f231c0995e3 b/tests/resources/merge-recursive/.gitted/objects/ce/0d744cd2e18eacf883d43471636f231c0995e3 Binary files differnew file mode 100644 index 000000000..63c457a2c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/ce/0d744cd2e18eacf883d43471636f231c0995e3 diff --git a/tests/resources/merge-recursive/.gitted/objects/d0/97bcf99adb1022a6b7d2e94fed2031ebd9d89c b/tests/resources/merge-recursive/.gitted/objects/d0/97bcf99adb1022a6b7d2e94fed2031ebd9d89c Binary files differnew file mode 100644 index 000000000..51ffec090 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/d0/97bcf99adb1022a6b7d2e94fed2031ebd9d89c diff --git a/tests/resources/merge-recursive/.gitted/objects/d0/c9bd6e2a3e327d81a32de51201d3bd58909f7c b/tests/resources/merge-recursive/.gitted/objects/d0/c9bd6e2a3e327d81a32de51201d3bd58909f7c Binary files differnew file mode 100644 index 000000000..5a0508c5d --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/d0/c9bd6e2a3e327d81a32de51201d3bd58909f7c diff --git a/tests/resources/merge-recursive/.gitted/objects/d3/482dbdca5bb83aaf3e3768359855d55aef84d7 b/tests/resources/merge-recursive/.gitted/objects/d3/482dbdca5bb83aaf3e3768359855d55aef84d7 Binary files differnew file mode 100644 index 000000000..8442948fa --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/d3/482dbdca5bb83aaf3e3768359855d55aef84d7 diff --git a/tests/resources/merge-recursive/.gitted/objects/d5/015f9436b2d8c842bf6616e7cf5bc54eb79ced b/tests/resources/merge-recursive/.gitted/objects/d5/015f9436b2d8c842bf6616e7cf5bc54eb79ced Binary files differnew file mode 100644 index 000000000..6d4446ec4 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/d5/015f9436b2d8c842bf6616e7cf5bc54eb79ced diff --git a/tests/resources/merge-recursive/.gitted/objects/db/51adf2b699eed93e883d6425f5e6c50165a9c2 b/tests/resources/merge-recursive/.gitted/objects/db/51adf2b699eed93e883d6425f5e6c50165a9c2 Binary files differnew file mode 100644 index 000000000..41b481efb --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/db/51adf2b699eed93e883d6425f5e6c50165a9c2 diff --git a/tests/resources/merge-recursive/.gitted/objects/db/7e2af8ca83b8943adce7ba37d85f8fe7d7d2a9 b/tests/resources/merge-recursive/.gitted/objects/db/7e2af8ca83b8943adce7ba37d85f8fe7d7d2a9 Binary files differnew file mode 100644 index 000000000..0a0ad6527 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/db/7e2af8ca83b8943adce7ba37d85f8fe7d7d2a9 diff --git a/tests/resources/merge-recursive/.gitted/objects/de/de92a05a0841faa8e4ad6700285cd208184458 b/tests/resources/merge-recursive/.gitted/objects/de/de92a05a0841faa8e4ad6700285cd208184458 Binary files differnew file mode 100644 index 000000000..c275071e2 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/de/de92a05a0841faa8e4ad6700285cd208184458 diff --git a/tests/resources/merge-recursive/.gitted/objects/e0/15ebd79a72a88b9291df11771caf56f463e8f9 b/tests/resources/merge-recursive/.gitted/objects/e0/15ebd79a72a88b9291df11771caf56f463e8f9 Binary files differnew file mode 100644 index 000000000..a75a6b60e --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/e0/15ebd79a72a88b9291df11771caf56f463e8f9 diff --git a/tests/resources/merge-recursive/.gitted/objects/e5/20e6aaf8d1e68a433e29d4360c1e74aa4b24d1 b/tests/resources/merge-recursive/.gitted/objects/e5/20e6aaf8d1e68a433e29d4360c1e74aa4b24d1 Binary files differnew file mode 100644 index 000000000..bcf2dcfc5 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/e5/20e6aaf8d1e68a433e29d4360c1e74aa4b24d1 diff --git a/tests/resources/merge-recursive/.gitted/objects/e6/269ce9017816d67c7189a58b6d0d22bf4b8a1a b/tests/resources/merge-recursive/.gitted/objects/e6/269ce9017816d67c7189a58b6d0d22bf4b8a1a Binary files differnew file mode 100644 index 000000000..f9a0a27cc --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/e6/269ce9017816d67c7189a58b6d0d22bf4b8a1a diff --git a/tests/resources/merge-recursive/.gitted/objects/e9/30c8c67848df4aa66319c5752fab6b8fdec765 b/tests/resources/merge-recursive/.gitted/objects/e9/30c8c67848df4aa66319c5752fab6b8fdec765 Binary files differnew file mode 100644 index 000000000..c0ba76deb --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/e9/30c8c67848df4aa66319c5752fab6b8fdec765 diff --git a/tests/resources/merge-recursive/.gitted/objects/ea/3521485adfa0b0373deaaa06db9218a22edae8 b/tests/resources/merge-recursive/.gitted/objects/ea/3521485adfa0b0373deaaa06db9218a22edae8 Binary files differnew file mode 100644 index 000000000..40d89843c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/ea/3521485adfa0b0373deaaa06db9218a22edae8 diff --git a/tests/resources/merge-recursive/.gitted/objects/f0/856993e005c0d8ed2dc7cdc222cc1d89fb3c77 b/tests/resources/merge-recursive/.gitted/objects/f0/856993e005c0d8ed2dc7cdc222cc1d89fb3c77 Binary files differnew file mode 100644 index 000000000..22b1ad94c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/f0/856993e005c0d8ed2dc7cdc222cc1d89fb3c77 diff --git a/tests/resources/merge-recursive/.gitted/objects/f2/9ccca75754d8476e5dad8cf250e03d43fe9e6c b/tests/resources/merge-recursive/.gitted/objects/f2/9ccca75754d8476e5dad8cf250e03d43fe9e6c Binary files differnew file mode 100644 index 000000000..b91872905 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/f2/9ccca75754d8476e5dad8cf250e03d43fe9e6c diff --git a/tests/resources/merge-recursive/.gitted/objects/f3/2c284f537ff1a55d3cbfe9a37d431b6edfadc2 b/tests/resources/merge-recursive/.gitted/objects/f3/2c284f537ff1a55d3cbfe9a37d431b6edfadc2 Binary files differnew file mode 100644 index 000000000..be3ceccdc --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/f3/2c284f537ff1a55d3cbfe9a37d431b6edfadc2 diff --git a/tests/resources/merge-recursive/.gitted/objects/f4/c149e7d0983e90e9ee802ff57ae3c905ba63da b/tests/resources/merge-recursive/.gitted/objects/f4/c149e7d0983e90e9ee802ff57ae3c905ba63da Binary files differnew file mode 100644 index 000000000..e9c675b6d --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/f4/c149e7d0983e90e9ee802ff57ae3c905ba63da diff --git a/tests/resources/merge-recursive/.gitted/objects/f6/5de1834f57708e76d8dc25502b7f1ecbcce162 b/tests/resources/merge-recursive/.gitted/objects/f6/5de1834f57708e76d8dc25502b7f1ecbcce162 Binary files differnew file mode 100644 index 000000000..3d238fd8c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/f6/5de1834f57708e76d8dc25502b7f1ecbcce162 diff --git a/tests/resources/merge-recursive/.gitted/objects/f9/c04e4e9d4aaf1e6fe7478a7cc0756554974c2b b/tests/resources/merge-recursive/.gitted/objects/f9/c04e4e9d4aaf1e6fe7478a7cc0756554974c2b Binary files differnew file mode 100644 index 000000000..bc44fa73a --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/f9/c04e4e9d4aaf1e6fe7478a7cc0756554974c2b diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-1 new file mode 100644 index 000000000..64612d486 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-1 @@ -0,0 +1 @@ +f65de1834f57708e76d8dc25502b7f1ecbcce162 diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-2 new file mode 100644 index 000000000..bea674803 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchJ-2 @@ -0,0 +1 @@ +b01de62cf11945685c98ec671edabdff3e90ddc5 diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchK-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-1 new file mode 100644 index 000000000..309b38880 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-1 @@ -0,0 +1 @@ +182d0d250d1d7adcc60c178be5be98358b3a2fd1 diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchK-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-2 new file mode 100644 index 000000000..f958f131c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchK-2 @@ -0,0 +1 @@ +0ce202f64fa8356c1a32835fce4058ca76b0c7ed |