src


Log

Author Commit Date CI Message
Edward Thomson 4aaae935 2016-07-22T12:53:13 index: cast to avoid warning
Edward Thomson 581a4d39 2016-07-14T23:32:35 apply: safety check files that dont end with eol
Edward Thomson c065f6a1 2016-07-14T23:04:47 apply: check allocation properly
Edward Thomson 60e15ecd 2016-07-15T17:18:39 packbuilder: `size_t` all the things After 1cd65991, we were passing a pointer to an `unsigned long` to a function that now expected a pointer to a `size_t`. These types differ on 64-bit Windows, which means that we trash the stack. Use `size_t`s in the packbuilder to avoid this.
Edward Thomson 531be3e8 2016-07-14T22:59:37 apply: compare preimage to image Compare the preimage to the image; don't compare the preimage to itself.
Edward Thomson c18a2bc4 2016-07-05T15:51:01 Merge pull request #3851 from txdv/get-user-agent Add get user agent functionality.
Edward Thomson b57c176a 2016-07-05T12:46:27 Merge pull request #3846 from rkrp/fix_bug_parsing_int64min Fixed bug while parsing INT64_MIN
Andrius Bentkus f1dba144 2016-07-05T09:41:51 Add get user agent functionality.
Edward Thomson d8243465 2016-07-01T18:47:06 Merge pull request #3836 from joshtriplett/cleanup-find_repo find_repo: Clean up and simplify logic
Edward Thomson ebeb56f0 2016-07-01T18:45:10 Merge pull request #3711 from joshtriplett/git_repository_discover_default Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars
Edward Thomson 6249d960 2016-06-29T17:55:44 index: include conflicts in `git_index_read_index` Ensure that we include conflicts when calling `git_index_read_index`, which will remove conflicts in the index that do not exist in the new target, and will add conflicts from the new target.
Edward Thomson 6f7ec728 2016-06-29T17:01:47 index: refactor common `read_index` functionality Most of `git_index_read_index` is common to reading any iterator. Refactor it out in case we want to implement `read_tree` in terms of it in the future.
Edward Thomson 59a0005d 2016-06-29T10:01:26 Merge pull request #3813 from stinb/submodule-update-fetch submodule: Try to fetch when update fails to find the target commit.
Patrick Steinhardt 21766702 2016-06-27T15:20:20 blame: do not decrement commit refcount in make_origin When we create a blame origin, we try to look up the blob that is to be blamed at a certain revision. When this lookup fails, e.g. because the file did not exist at that certain revision, we fail to create the blame origin and return `NULL`. The blame origin that we have just allocated is thereby free'd with `origin_decref`. The `origin_decref` function does not only decrement reference counts for the blame origin, though, but also for its commit and blob. When this is done in the error case, we will cause an uneven reference count for these objects. This may result in hard-to-debug failures at seemingly unrelated code paths, where we try to access these objects when they in fact have already been free'd. Fix the issue by refactoring `make_origin` such that we only allocate the object after the only function that may fail so that we do not have to call `origin_decref` at all. Also fix the `pass_blame` function, which indirectly calls `make_origin`, to free the commit when `make_origin` failed.
Krishna Ram Prakash R 70b9b841 2016-06-28T20:19:52 Fixed bug while parsing INT64_MIN
Jason Haslam de43efcf 2016-06-28T16:07:25 submodule: Try to fetch when update fails to find the target commit in the submodule.
Edward Thomson 20302aa4 2016-06-25T23:33:05 Merge pull request #3223 from ethomson/apply Reading patch files
Edward Thomson 1a79cd95 2016-04-26T01:18:01 patch: show copy information for identical copies When showing copy information because we are duplicating contents, for example, when performing a `diff --find-copies-harder -M100 -B100`, then show copy from/to lines in a patch, and do not show context. Ensure that we can also parse such patches.
Edward Thomson 38a347ea 2016-04-25T17:52:39 patch::parse: handle patches with no hunks Patches may have no hunks when there's no modifications (for example, in a rename). Handle them.
Josh Triplett 2b490284 2016-06-24T15:59:37 find_repo: Clean up and simplify logic find_repo had a complex loop and heavily nested conditionals, making it difficult to follow. Simplify this as much as possible: - Separate assignments from conditionals. - Check the complex loop condition in the only place it can change. - Break out of the loop on error, rather than going through the rest of the loop body first. - Handle error cases by immediately breaking, rather than nesting conditionals. - Free repo_link unconditionally on the way out of the function, rather than in multiple places. - Add more comments on the remaining complex steps.
Josh Triplett 0dd98b69 2016-04-03T17:22:07 Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars git_repository_open_ext provides parameters for the start path, whether to search across filesystems, and what ceiling directories to stop at. git commands have standard environment variables and defaults for each of those, as well as various other parameters of the repository. To avoid duplicate environment variable handling in users of libgit2, add a GIT_REPOSITORY_OPEN_FROM_ENV flag, which makes git_repository_open_ext automatically handle the appropriate environment variables. Commands that intend to act just like those built into git itself can use this flag to get the expected default behavior. git_repository_open_ext with the GIT_REPOSITORY_OPEN_FROM_ENV flag respects $GIT_DIR, $GIT_DISCOVERY_ACROSS_FILESYSTEM, $GIT_CEILING_DIRECTORIES, $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the future, when libgit2 gets worktree support, git_repository_open_env will also respect $GIT_WORK_TREE and $GIT_COMMON_DIR; until then, git_repository_open_ext with this flag will error out if either $GIT_WORK_TREE or $GIT_COMMON_DIR is set.
Josh Triplett 39c6fca3 2016-04-03T16:01:01 Add GIT_REPOSITORY_OPEN_NO_DOTGIT flag to avoid appending /.git GIT_REPOSITORY_OPEN_NO_SEARCH does not search up through parent directories, but still tries the specified path both directly and with /.git appended. GIT_REPOSITORY_OPEN_BARE avoids appending /.git, but opens the repository in bare mode even if it has a working directory. To support the semantics git uses when given $GIT_DIR in the environment, provide a new GIT_REPOSITORY_OPEN_NO_DOTGIT flag to not try appending /.git.
Josh Triplett ed577134 2016-04-03T19:24:15 Fix repository discovery with ceiling_dirs at current directory git only checks ceiling directories when its search ascends to a parent directory. A ceiling directory matching the starting directory will not prevent git from finding a repository in the starting directory or a parent directory. libgit2 handled the former case correctly, but differed from git in the latter case: given a ceiling directory matching the starting directory, but no repository at the starting directory, libgit2 would stop the search at that point rather than finding a repository in a parent directory. Test case using git command-line tools: /tmp$ git init x Initialized empty Git repository in /tmp/x/.git/ /tmp$ cd x/ /tmp/x$ mkdir subdir /tmp/x$ cd subdir/ /tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x git rev-parse --git-dir fatal: Not a git repository (or any of the parent directories): .git /tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x/subdir git rev-parse --git-dir /tmp/x/.git Fix the testsuite to test this case (in one case fixing a test that depended on the current behavior), and then fix find_repo to handle this case correctly. In the process, simplify and document the logic in find_repo(): - Separate the concepts of "currently checking a .git directory" and "number of iterations left before going further counts as a search" into two separate variables, in_dot_git and min_iterations. - Move the logic to handle in_dot_git and append /.git to the top of the loop. - Only search ceiling_dirs and find ceiling_offset after running out of min_iterations; since ceiling_offset only tracks the longest matching ceiling directory, if ceiling_dirs contained both the current directory and a parent directory, this change makes find_repo stop the search at the parent directory.
Patrick Steinhardt fe345c73 2016-02-09T12:29:31 Remove unused static functions
Patrick Steinhardt 8fd74c08 2016-02-09T12:18:28 Avoid old-style function definitions Avoid declaring old-style functions without any parameters. Functions not accepting any parameters should be declared with `void fn(void)`. See ISO C89 $3.5.4.3.
Edward Thomson bb0edf87 2016-06-20T22:50:46 Merge pull request #3830 from pks-t/pks/thread-namespacing Thread namespacing
Patrick Steinhardt aab266c9 2016-06-20T20:07:33 threads: add platform-independent thread initialization function
Patrick Steinhardt 8aaa9fb6 2016-06-20T18:21:42 win32: rename pthread.{c,h} to thread.{c,h} The old pthread-file did re-implement the pthreads API with exact symbol matching. As the thread-abstraction has now been split up between Unix- and Windows-specific files within the `git_` namespace to avoid symbol-clashes between libgit2 and pthreads, the rewritten wrappers have nothing to do with pthreads anymore. Rename the Windows-specific pthread-files to honor this change.
Patrick Steinhardt a342e870 2016-06-20T18:28:00 threads: remove now-useless typedefs
Patrick Steinhardt 4f10c1e6 2016-06-20T19:40:45 threads: remove unused function pthread_num_processors_np The function pthread_num_processors_np is currently unused and superseded by the function `git_online_cpus`. Remove the function.
Patrick Steinhardt 6551004f 2016-06-20T17:49:47 threads: split up OS-dependent rwlock code
Patrick Steinhardt 139bffa0 2016-06-20T17:20:13 threads: split up OS-dependent thread-condition code
Patrick Steinhardt 20d078df 2016-06-20T19:48:19 threads: remove unused function pthread_cond_broadcast
Patrick Steinhardt 1c135405 2016-06-20T17:07:14 threads: split up OS-dependent mutex code
Patrick Steinhardt faebc1c6 2016-06-20T17:44:04 threads: split up OS-dependent thread code
Edward Thomson c80efb5f 2016-06-20T11:16:49 Merge pull request #3818 from meatcoder/fix_odb_read_error Fix truncation of SHA in error message for git_odb_read
Sim Domingo 2076d329 2016-06-09T22:50:53 fix error message SHA truncation in git_odb__error_notfound()
David Brooks 6c9eb86f 2016-06-19T11:46:43 HTTP authentication scheme name is case insensitive.
Edward Thomson bb0bd71a 2016-06-15T15:47:28 checkout: use empty baseline when no index When no index file exists and a baseline is not explicitly provided, use an empty baseline instead of trying to load `HEAD`.
Edward Thomson abb6f72a 2016-06-14T11:42:00 Merge pull request #3812 from stinb/fetch-tag-update-callback fetch: Fixed spurious update callback for existing tags.
Jason Haslam 7f9673e4 2016-06-14T14:46:12 fetch: Fixed spurious update callback for existing tags.
Edward Thomson 2a09de91 2016-06-14T04:33:55 Merge pull request #3816 from pks-t/pks/memory-leaks Memory leak fixes
Patrick Steinhardt 43c55111 2016-06-07T14:14:07 winhttp: plug several memory leaks
Patrick Steinhardt 432af52b 2016-06-07T12:55:17 global: clean up crt only after freeing tls data The thread local storage is used to hold some global state that is dynamically allocated and should be freed upon exit. On Windows, we clean up the C run-time right after execution of registered shutdown callbacks and before cleaning up the TLS. When we clean up the CRT, we also cause it to analyze for memory leaks. As we did not free the TLS yet this will lead to false positives. Fix the issue by first freeing the TLS and cleaning up the CRT only afterwards.
Patrick Steinhardt 13deb874 2016-06-07T08:35:26 index: fix NULL pointer access in index_remove_entry When removing an entry from the index by its position, we first retrieve the position from the index's entries and then try to remove the retrieved value from the index map with `DELETE_IN_MAP`. When `index_remove_entry` returns `NULL` we try to feed it into the `DELETE_IN_MAP` macro, which will unconditionally call `idxentry_hash` and then happily dereference the `NULL` entry pointer. Fix the issue by not passing a `NULL` entry into `DELETE_IN_MAP`.
Patrick Steinhardt 7d02019a 2016-06-06T12:59:17 transports: smart: fix potential invalid memory dereferences When we receive a packet of exactly four bytes encoding its length as those four bytes it can be treated as an empty line. While it is not really specified how those empty lines should be treated, we currently ignore them and do not return an error when trying to parse it but simply advance the data pointer. Callers invoking `git_pkt_parse_line` are currently not prepared to handle this case as they do not explicitly check this case. While they could always reset the passed out-pointer to `NULL` before calling `git_pkt_parse_line` and determine if the pointer has been set afterwards, it makes more sense to update `git_pkt_parse_line` to set the out-pointer to `NULL` itself when it encounters such an empty packet. Like this it is guaranteed that there will be no invalid memory references to free'd pointers. As such, the issue has been fixed such that `git_pkt_parse_line` always sets the packet out pointer to `NULL` when an empty packet has been received and callers check for this condition, skipping such packets.
Edward Thomson 46082c38 2016-06-02T02:34:03 index_read_index: invalidate new paths in tree cache When adding a new entry to an existing index via `git_index_read_index`, be sure to remove the tree cache entry for that new path. This will mark all parent trees as dirty.
Edward Thomson 9167c145 2016-06-02T01:04:58 index_read_index: set flags for path_len correctly Update the flags to reset the path_len (to emulate `index_insert`)
Edward Thomson 046ec3c9 2016-06-02T00:47:51 index_read_index: differentiate on mode Treat index entries with different modes as different, which they are, at least for the purposes of up-to-date calculations.
Edward Thomson 93de20b8 2016-06-01T14:56:27 index_read_index: reset error correctly Clear any error state upon each iteration. If one of the iterations ends (with an error of `GIT_ITEROVER`) we need to reset that error to 0, lest we stop the whole process prematurely.
Edward Thomson 14cf05da 2016-05-26T12:52:29 win32: clean up unused warnings in DllMain
Edward Thomson 4505a42a 2016-05-26T12:42:43 rebase: change assertion to avoid It looks like we're getting the operation and not doing anything with it, when in fact we are asserting that it's not null. Simply assert that we are within the operation boundary instead of using the `git_array_get` macro to do this for us.
Edward Thomson e3c42fee 2016-05-26T12:39:09 filebuf: fix uninitialized warning
Edward Thomson 0d77a56f 2016-05-26T12:28:32 checkout: drop unused repo
Edward Thomson 853e585f 2016-04-25T16:32:30 patch: zero id and abbrev length for empty files
Edward Thomson 33ae8762 2016-04-25T13:07:18 patch: identify non-binary patches as `NOT_BINARY`
Edward Thomson 72827490 2016-04-25T12:40:19 Introduce `git_diff_to_buf` Like `git_patch_to_buf`, provide a simple helper method that can print an entire diff directory to a `git_buf`.
Edward Thomson 7166bb16 2016-04-25T00:35:48 introduce `git_diff_from_buffer` to parse diffs Parse diff files into a `git_diff` structure.
Edward Thomson 94e488a0 2016-04-24T16:14:25 patch: differentiate not found and invalid patches
Edward Thomson 17572f67 2016-04-21T00:04:14 git_patch_parse_ctx: refcount the context
Edward Thomson 9be638ec 2016-04-19T15:12:18 git_diff_generated: abstract generated diffs
Edward Thomson aa4bfb32 2016-02-07T15:08:16 parse: introduce parse_ctx_contains_s
Edward Thomson 8d44f8b7 2015-11-24T15:19:59 patch: `patch_diff` -> `patch_generated`
Edward Thomson 53571f2f 2015-11-21T15:16:01 vector: more sensible names for `grow_at`/`shrink_at`
Edward Thomson 440e3bae 2015-11-21T12:27:03 patch: `git_patch_from_patchfile` -> `git_patch_from_buffer`
Edward Thomson 00e63b36 2015-11-21T12:37:01 patch: provide static string `advance_expected`
Edward Thomson a03952f0 2015-09-25T12:44:14 patch: formatting cleanups
Edward Thomson e564fc65 2015-09-25T12:41:15 git_vector_grow/shrink: correct shrink, and tests
Edward Thomson 8cb27223 2015-09-25T10:48:19 git_buf_quote/unquote: handle > \177 Parse values up to and including `\377` (`0xff`) when unquoting. Print octal values as an unsigned char when quoting, lest `printf` think we're talking about negatives.
Edward Thomson 0267c34c 2015-09-25T10:19:50 patch application: drop unnecessary `patch_image_init`
Edward Thomson 4117a235 2015-09-24T10:32:15 patch parse: dup the patch from the callers
Edward Thomson 6278fbc5 2015-09-24T09:40:42 patch parsing: squash some memory leaks
Edward Thomson f941f035 2015-09-24T09:25:10 patch: drop some warnings
Edward Thomson 040ec883 2015-09-23T18:20:17 patch: use strlen to mean string length `oid_strlen` has meant one more than the length of the string. This is mighty confusing. Make it mean only the string length! Whomsoever needs to allocate a buffer to hold a string can null terminate it like normal.
Edward Thomson e2cdc145 2015-09-23T17:48:52 patch: show modes when only the mode has changed
Edward Thomson 4ac2d8ac 2015-09-23T16:33:02 patch: quote filenames when necessary
Edward Thomson d3d95d5a 2015-09-23T16:30:48 git_buf_quote: quote ugly characters
Edward Thomson 72806f4c 2015-09-23T13:56:48 patch: don't print some headers on pure renames
Edward Thomson 82175084 2015-09-23T13:40:12 Introduce git_patch_options, handle prefixes Handle prefixes (in terms of number of path components) for patch parsing.
Edward Thomson 19e46645 2015-09-23T11:07:04 patch printing: include rename information
Edward Thomson d536ceac 2015-09-23T10:47:34 patch_parse: don't set new mode when deleted
Edward Thomson 28f70443 2015-09-23T10:38:51 patch_parse: use names from `diff --git` header When a text file is added or deleted, use the file names from the `diff --git` header instead of the `---` or `+++` lines. This is for compatibility with git.
Edward Thomson 1462c95a 2015-09-23T09:54:25 patch_parse: set binary flag We may have parsed binary data, set the `SHOW_BINARY` flag which indicates that we have actually computed a binary diff.
Edward Thomson bc6a31c9 2015-09-22T18:29:14 patch: when parsing, set nfiles correctly in delta
Edward Thomson d68cb736 2015-09-22T18:25:03 diff: include oid length in deltas Now that `git_diff_delta` data can be produced by reading patch file data, which may have an abbreviated oid, allow consumers to know that the id is abbreviated.
Edward Thomson 5d17d726 2015-07-09T19:22:28 patch parsing: parse binary patch files
Edward Thomson b8dc2fdb 2015-07-09T18:36:53 zstream: fail when asked to inflate garbage When we are provided some input buffer (with a length) to inflate, and it contains more data than simply the deflated data, fail. zlib will helpfully tell us when it is done reading (via Z_STREAM_END), so if there is data leftover in the input buffer, fail lest we continually try to inflate it.
Edward Thomson 5b78dbdb 2015-07-09T13:04:10 git_buf: decode base85 inputs
Edward Thomson e7ec327d 2015-09-22T17:56:42 patch parse: unset path prefix
Edward Thomson b85bd8ce 2015-09-16T11:37:03 patch: use delta's old_file/new_file members No need to replicate the old_file/new_file members, or plumb them strangely up.
Edward Thomson 804d5fe9 2015-09-11T08:37:12 patch: abstract patches into diff'ed and parsed Patches can now come from a variety of sources - either internally generated (from diffing two commits) or as the results of parsing some external data.
Edward Thomson 3149ff6f 2015-06-17T18:13:10 patch application: apply binary patches Handle the application of binary patches. Include tests that produce a binary patch (an in-memory `git_patch` object), then enusre that the patch applies correctly.
Edward Thomson b88f1713 2015-06-17T08:07:34 zstream: offer inflating, `git_zstream_inflatebuf` Introduce `git_zstream_inflatebuf` for simple uses.
Edward Thomson 1cd65991 2015-06-17T07:31:47 delta: refactor git_delta functions for consistency Refactor the git_delta functions to have consistent naming and parameters with the rest of the library.
Edward Thomson 6a2d2f8a 2015-06-17T06:42:20 delta: move delta application to delta.c Move the delta application functions into `delta.c`, next to the similar delta creation functions. Make the `git__delta_apply` functions adhere to other naming and parameter style within the library.
Edward Thomson 0004386f 2015-06-17T06:03:01 apply: handle empty patches When a patch is empty, simply copy the source into the destination.
Edward Thomson d34f6826 2014-04-08T17:18:47 Patch parsing from patch files
Edward Thomson 7cb904ba 2014-04-01T23:58:59 Introduce git_apply_patch The beginnings of patch application from an existing (diff-created) git_patch object: applies the hunks of a git_patch to a buffer.
Jason Haslam c864b4ab 2016-05-12T13:18:07 Ignore submodules when checking for merge conflicts in the workdir.
Jason Haslam afab1fff 2016-02-16T21:02:41 checkout: handle dirty submodules correctly Don't generate conflicts when checking out a modified submodule and the submodule is dirty or modified in the workdir.