summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* merge: virtual commit should be last argument to merge-baseethomson/recursiveTyrie Vella2018-02-041-2/+8
| | | | | | | | | | | | | | Our virtual commit must be the last argument to merge-base: since our algorithm pushes _both_ parents of the virtual commit, it needs to be the last argument, since merge-base: > Given three commits A, B and C, git merge-base A B C will compute the > merge base between A and a hypothetical commit M We want to calculate the merge base between the actual commit ("two") and the virtual commit ("one") - since one actually pushes its parents to the merge-base calculation, we need to calculate the merge base of "two" and the parents of one.
* Add failing test case for virtual commit merge base issueEdward Thomson2018-02-0427-0/+32
|
* merge::trees::recursive: test for virtual base buildingEdward Thomson2018-02-041-0/+25
| | | | | Virtual base building: ensure that the virtual base is created and revwalked in the same way as git.
* merge: reverse merge bases for recursive mergeEdward Thomson2018-02-044-28/+32
| | | | | | | | | | | | | | | | | | When the commits being merged have multiple merge bases, reverse the order when creating the virtual merge base. This is for compatibility with git's merge-recursive algorithm, and ensures that we build identical trees. Git does this to try to use older merge bases first. Per 8918b0c: > It seems to be the only sane way to do it: when a two-head merge is > done, and the merge-base and one of the two branches agree, the > merge assumes that the other branch has something new. > > If we start creating virtual commits from newer merge-bases, and go > back to older merge-bases, and then merge with newer commits again, > chances are that a patch is lost, _because_ the merge-base and the > head agree on it. Unlikely, yes, but it happened to me.
* oidarray: introduce git_oidarray__reverseEdward Thomson2018-02-042-0/+13
| | | | Provide a simple function to reverse an oidarray.
* Introduce additional criss-cross merge branchesEdward Thomson2018-02-0468-0/+11
|
* Merge pull request #4489 from libgit2/ethomson/conflicts_crlfEdward Thomson2018-02-0417-133/+326
|\ | | | | Conflict markers should match EOL style in conflicting files
| * merge: test CR/LF conflicts for CR/LF filesethomson/conflicts_crlfEdward Thomson2018-01-211-0/+48
| | | | | | | | | | | | Ensure that when the files being merged have CR/LF line endings that the conflict markers produced in the conflict file also have CR/LF line endings.
| * xdiff: upgrade to git's included xdiffEdward Thomson2018-01-2116-133/+278
| | | | | | | | | | | | Upgrade xdiff to git's most recent version, which includes changes to CR/LF handling. Now CR/LF included in the input files will be detected and conflict markers will be emitted with CR/LF when appropriate.
* | Merge pull request #4499 from pks-t/pks/setuid-configEdward Thomson2018-02-021-7/+74
|\ \ | | | | | | sysdir: do not use environment in setuid case
| * | sysdir: do not use environment in setuid casePatrick Steinhardt2018-02-021-7/+74
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to derive the location of some Git directories, we currently use the environment variables $HOME and $XDG_CONFIG_HOME. This might prove to be problematic whenever the binary is run with setuid, that is when the effective user does not equal the real user. In case the environment variables do not get sanitized by the caller, we thus might end up using the real user's configuration when doing stuff as the effective user. The fix is to use the passwd entry's directory instead of $HOME in this situation. As this might break scenarios where the user explicitly sets $HOME to another path, this fix is only applied in case the effective user does not equal the real user.
* | Merge pull request #4512 from libgit2/ethomson/header_guardsEdward Thomson2018-02-0248-86/+92
|\ \ | | | | | | Consistent header guards
| * | consistent header guardsethomson/header_guardsEdward Thomson2018-02-0148-86/+92
| | | | | | | | | | | | use consistent names for the #include / #define header guard pattern.
* | | Merge pull request #4510 from pks-t/pks/attr-file-bare-statEdward Thomson2018-02-022-4/+20
|\ \ \ | |/ / |/| | attr: avoid stat'ting files for bare repositories
| * | attr: avoid stat'ting files for bare repositoriesPatrick Steinhardt2018-02-012-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on whether the path we want to look up an attribute for is a file or a directory, the fnmatch function will be called with different flags. Because of this, we have to first stat(3) the path to determine whether it is a file or directory in `git_attr_path__init`. This is wasteful though in bare repositories, where we can already be assured that the path will never exist at all due to there being no worktree. In this case, we will execute an unnecessary syscall, which might be noticeable on networked file systems. What happens right now is that we always pass the `GIT_DIR_FLAG_UNKOWN` flag to `git_attr_path__init`, which causes it to `stat` the file itself to determine its type. As it is calling `git_path_isdir` on the path, which will always return `false` in case the path does not exist, we end up with the path always being treated as a file in case of a bare repository. As such, we can just check the bare-repository case in all callers and then pass in `GIT_DIR_FLAG_FALSE` ourselves, avoiding the need to `stat`. While this may not always be correct, it at least is no different from our current behavior.
* | | Merge pull request #4040 from tiennou/examples/mergePatrick Steinhardt2018-02-017-36/+447
|\ \ \ | | | | | | | | Merge example
| * | | examples: zero out our options memory before useEtienne Samson2018-01-251-0/+2
| | | |
| * | | examples: our/their can be NULLEtienne Samson2018-01-251-2/+4
| | | |
| * | | examples: fix remaining review commentsEtienne Samson2018-01-251-0/+2
| | | |
| * | | examples: move support code into static functionsEtienne Samson2018-01-251-81/+97
| | | |
| * | | examples: hoist the merge analysis back into mainEtienne Samson2018-01-251-58/+39
| | | |
| * | | examples: minor review fixupsEtienne Samson2018-01-251-10/+12
| | | |
| * | | examples: add mergeEtienne Samson2018-01-251-0/+391
| | | |
| * | | examples: Dead code & warningsEtienne Samson2018-01-251-7/+0
| | | |
| * | | examples: Move xrealloc to common example codeEtienne Samson2018-01-253-10/+15
| | | |
| * | | examples: Switch to the nifty argv helpers from commonEtienne Samson2018-01-252-19/+36
| | |/ | |/|
* | | Merge pull request #4507 from tomas/patch-1Edward Thomson2018-01-311-2/+7
|\ \ \ | | | | | | | | Honor 'GIT_USE_NSEC' option in `filesystem_iterator_set_current`
| * | | Set ctime/mtime nanosecs to 0 if USE_NSEC is not definedTomás Pollak2018-01-311-0/+3
| | | |
| * | | Honor 'GIT_USE_NSEC' option in `filesystem_iterator_set_current`Tomás Pollak2018-01-301-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | This should have been part of PR #3638. Without this we still get nsec-related errors, even when using -DGIT_USE_NSEC: error: ‘struct stat’ has no member named ‘st_mtime_nsec’
* | | | Merge pull request #4488 from libgit2/ethomson/conflict_marker_sizeEdward Thomson2018-01-317-8/+23
|\ \ \ \ | | | | | | | | | | Use longer conflict markers in recursive merge base
| * | | | CHANGELOG: include merge_file conflict marker sizeethomson/conflict_marker_sizeEdward Thomson2018-01-211-0/+6
| | | | |
| * | | | merge: recursive uses larger conflict markersEdward Thomson2018-01-214-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git uses longer conflict markers in the recursive merge base - two more than the default (thus, 9 character long conflict markers). This allows users to tell the difference between the recursive merge conflicts and conflicts between the ours and theirs branches. This was introduced in git d694a17986a28bbc19e2a6c32404ca24572e400f. Update our tests to expect this as well.
| * | | | merge: allow custom conflict marker sizeEdward Thomson2018-01-212-0/+8
| | |/ / | |/| | | | | | | | | | | | | | | | | | Allow for a custom conflict marker size, allowing callers to override the default size of the "<<<<<<<" and ">>>>>>>" markers in the conflicted output file.
* | | | Merge pull request #4490 from libgit2/ethomson/apfs_precompose_fixesEdward Thomson2018-01-311-1/+7
|\ \ \ \ | |_|/ / |/| | | status::renames: test update for APFS (write NFD instead of NFC filename)
| * | | status::renames: write NFD instead of NFC filenameethomson/apfs_precompose_fixesEdward Thomson2018-01-211-1/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the status::renames test to create an NFD format filename in the core.precomposedunicode tests. Previously, we would create an NFC format filename. This was to take advantage of HFS+ filesystems, which always use canonically decomposed formats, and would actually write the filename to disk as an NFD filename. So previously, we could create an NFC filename, but read it normally as an NFD filename. But APFS formats do not force canonically decomposed formats for filenames, so creating an NFC filename does not get converted to NFD. Instead, the filename will be written in NFC format. Our test, therefore, does not work - when we write an NFC filename, it will _remain_ NFC. Update the test to write NFD always. This will ensure that the file will actually be canonically decomposed on all platforms: HFS+, which forces NFD, and APFS, which does not. Thus, our test will continue to ensure that an NFD filename is canonically precomposed on all filesystems.
* | | Merge pull request #4474 from pks-t/pks/null-oidEdward Thomson2018-01-294-1/+60
|\ \ \ | | | | | | | | Special-casing null OIDs
| * | | odb: reject reading and writing null OIDsPatrick Steinhardt2018-01-262-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The null OID (hash with all zeroes) indicates a missing object in upstream git and is thus not a valid object ID. Add defensive measurements to avoid writing such a hash to the object database in the very unlikely case where some data results in the null OID. Furthermore, add shortcuts when reading the null OID from the ODB to avoid ever returning an object when a faulty repository may contain the null OID.
| * | | tree: reject writing null-OID entries to a treePatrick Steinhardt2018-01-262-0/+17
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit a96d3cc3f (cache-tree: reject entries with null sha1, 2017-04-21), the git.git project has changed its stance on null OIDs in tree objects. Previously, null OIDs were accepted in tree entries to help tools repair broken history. This resulted in some problems though in that many code paths mistakenly passed null OIDs to be added to a tree, which was not properly detected. Align our own code base according to the upstream change and reject writing tree entries early when the OID is all-zero.
* | | Merge pull request #4502 from pks-t/pks/security-reportingEdward Thomson2018-01-291-0/+6
|\ \ \ | |/ / |/| | README.md: add notes on how to report security issues
| * | README.md: add notes on how to report security issuesPatrick Steinhardt2018-01-291-0/+6
|/ /
* | Merge pull request #4497 from medranocalvo/export-mempackPatrick Steinhardt2018-01-252-4/+6
|\ \ | |/ |/| odb: export mempack backend
| * odb: export mempack backendAdrián Medraño Calvo2018-01-222-4/+6
|/ | | | Fixes #4492, #4496.
* Merge pull request #4484 from pks-t/pks/fail-creating-branch-HEADEdward Thomson2018-01-201-0/+6
|\ | | | | branch: refuse creating branches named 'HEAD'
| * branch: refuse creating branches named 'HEAD'Patrick Steinhardt2018-01-191-0/+6
| | | | | | | | | | | | | | | | Since a625b092c (branch: correctly reject refs/heads/{-dash,HEAD}, 2017-11-14), which is included in v2.16.0, upstream git refuses to create branches which are named HEAD to avoid ambiguity with the symbolic HEAD reference. Adjust our own code to match that behaviour and reject creating branches names HEAD.
* | Merge pull request #4478 from libgit2/cmn/packed-refs-sortedEdward Thomson2018-01-201-1/+1
|\ \ | | | | | | refs: include " sorted " in our packed-refs header
| * | refs: include " sorted " in our packed-refs headercmn/packed-refs-sortedCarlos Martín Nieto2018-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | This lets git know that we do in fact have written our packed-refs file sorted (which is apparently not necessarily the case) and it can then use the new-ish mmaped access which lets it avoid significant amounts of effort parsing potentially large files to get to a single piece of data.
* | | Merge pull request #4483 from libgit2/cmn/prettify-docsEdward Thomson2018-01-201-3/+2
|\ \ \ | | | | | | | | message: update docs for git_message_prettify
| * | | message: update docs for git_message_prettifycmn/prettify-docsCarlos Martín Nieto2018-01-191-3/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | We used to hard-code the octothorpe as the comment character and the documentation still mentions this even though we accept the comment character as a parameter. Update the line to indicate this and clean up the first paragraph a bit.
* | | Merge pull request #4481 from pks-t/pks/tests-online-clone-url-memleakCarlos Martín Nieto2018-01-191-0/+2
|\ \ \ | |/ / |/| | tests: online::clone: fix memory leak due to not freeing URL
| * | tests: online::clone: fix memory leak due to not freeing URLPatrick Steinhardt2018-01-181-0/+2
|/ /