summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* documentation: improve docs for `checkout_head`ethomson/checkout_head_docsEdward Thomson2016-06-151-0/+7
| | | | | `git_checkout_head` is sadly misunderstood as something that can switch branches. It cannot. Update the documentation to reflect this.
* Merge pull request #3816 from pks-t/pks/memory-leaksEdward Thomson2016-06-143-9/+23
|\ | | | | Memory leak fixes
| * winhttp: plug several memory leaksPatrick Steinhardt2016-06-071-2/+16
| |
| * global: clean up crt only after freeing tls dataPatrick Steinhardt2016-06-071-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * tests: fix memory leaks in checkout::typechangePatrick Steinhardt2016-06-071-2/+2
| |
* | Merge pull request #3814 from pks-t/pks/invalid-memrefsEdward Thomson2016-06-143-2/+15
|\ \ | |/ |/| Fix invalid memory references
| * index: fix NULL pointer access in index_remove_entryPatrick Steinhardt2016-06-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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`.
| * transports: smart: fix potential invalid memory dereferencesPatrick Steinhardt2016-06-072-0/+12
|/ | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge pull request #3808 from ethomson/read_index_fixesEdward Thomson2016-06-0210-1/+151
|\ | | | | `git_index_read_index` fixes
| * index_read_index: invalidate new paths in tree cacheEdward Thomson2016-06-021-0/+6
| | | | | | | | | | | | 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.
| * rebase: test rebasing a new commit with subfolderEdward Thomson2016-06-028-0/+83
| | | | | | | | | | Test a rebase (both a merge rebase and an inmemory rebase) with a new commit that adds files underneath a new subfolder.
| * test: ensure we can round-trip a written treeEdward Thomson2016-06-021-0/+23
| | | | | | | | | | Read a tree into an index, write the index, then re-open the index and ensure that we are treesame to the original.
| * index_read_index: set flags for path_len correctlyEdward Thomson2016-06-021-0/+3
| | | | | | | | Update the flags to reset the path_len (to emulate `index_insert`)
| * index_read_index: differentiate on modeEdward Thomson2016-06-021-1/+2
| | | | | | | | | | Treat index entries with different modes as different, which they are, at least for the purposes of up-to-date calculations.
| * index_read_index: reset error correctlyEdward Thomson2016-06-021-0/+2
| | | | | | | | | | | | 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.
| * round-trip trees through index_read_indexEdward Thomson2016-06-021-0/+32
|/ | | | | | | Read a tree into an index using `git_index_read_index` (by reading a tree into a new index, then reading that index into the current index), then write the index back out, ensuring that our new index is treesame to the tree that we read.
* Merge pull request #3796 from mmuman/haikuEdward Thomson2016-06-011-0/+4
|\ | | | | Preliminary Haiku port
| * CMakeLists: Add libnetwork for HaikuFrançois Revol2016-05-221-0/+4
| |
* | Merge pull request #3801 from ethomson/warningEdward Thomson2016-06-015-9/+11
|\ \ | | | | | | cleanup: unused warning
| * | win32: clean up unused warnings in DllMainEdward Thomson2016-06-011-0/+3
| | |
| * | rebase: change assertion to avoidEdward Thomson2016-06-011-4/+1
| | | | | | | | | | | | | | | | | | | | | 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.
| * | filebuf: fix uninitialized warningEdward Thomson2016-06-011-1/+1
| | |
| * | checkout: drop unused repoEdward Thomson2016-06-011-4/+3
| | |
| * | cleanup: unused warningEdward Thomson2016-06-011-0/+3
|/ /
* | Merge pull request #3803 from glensc/patch-1Edward Thomson2016-05-271-1/+1
|\ \ | | | | | | Update CMakeLists.txt
| * | Update CMakeLists.txtElan Ruusamäe2016-05-271-1/+1
|/ / | | | | typo fix
* | Merge pull request #3799 from sschuberth/masterEdward Thomson2016-05-261-1/+1
|\ \ | | | | | | Use AppVeyor's Start-FileDownload cmdlet
| * | Use AppVeyor's Start-FileDownload cmdletSebastian Schuberth2016-05-251-1/+1
| | | | | | | | | | | | | | | | | | | | | Start-FileDownload maintains current directory context and allows specifying a request timeout, see [1]. [1] https://www.appveyor.com/docs/how-to/download-file#start-filedownload-cmdlet
* | | Merge pull request #3798 from mmuman/stat-test-fixEdward Thomson2016-05-261-2/+3
|\ \ \ | | | | | | | | test: Fix stat() test to mask out unwanted bits
| * | | test: Fix stat() test to mask out unwanted bitsFrançois Revol2016-05-241-2/+3
| |/ / | | | | | | | | | Haiku and Hurd both pass extra bits in struct stat::st_mode.
* | | Merge branch 'checkout_submodules'Edward Thomson2016-05-264-10/+105
|\ \ \
| * | | Ignore submodules when checking for merge conflicts in the workdir.Jason Haslam2016-05-261-0/+1
| | | |
| * | | checkout: handle dirty submodules correctlyJason Haslam2016-05-263-10/+104
|/ / / | | | | | | | | | | | | Don't generate conflicts when checking out a modified submodule and the submodule is dirty or modified in the workdir.
* | | Merge pull request #3792 from edquist/miscEdward Thomson2016-05-261-1/+1
|\ \ \ | |/ / |/| | Fix comment for GIT_FILEMODE_LINK
| * | Fix comment for GIT_FILEMODE_LINKCarl Edquist2016-05-181-1/+1
| |/ | | | | | | 0120000 is symbolic link, not commit
* | Merge pull request #3797 from libgit2/cmn/remove-single-entryCarlos Martín Nieto2016-05-242-0/+41
|\ \ | | | | | | tree: handle removal of all entries in the updater
| * | tree: handle removal of all entries in the updatercmn/remove-single-entryCarlos Martín Nieto2016-05-242-0/+41
|/ / | | | | | | | | When we remove all entries in a tree, we should remove that tree from its parent rather than include the empty tree.
* | Merge pull request #3794 from libgit2/cmn/tree-update-basenameCarlos Martín Nieto2016-05-232-13/+51
|\ \ | |/ |/| Tree updater fixups
| * tree: plug leaks in the tree updatercmn/tree-update-basenameCarlos Martín Nieto2016-05-192-4/+13
| |
| * tree: use the basename for the entry removalCarlos Martín Nieto2016-05-191-1/+1
| | | | | | | | | | | | When we want to remove the file, use the basename as the name of the entry to remove, instead of the full one, which includes the directories we've inserted into the stack.
| * tree: use testrepo2 for the tree updater testsCarlos Martín Nieto2016-05-191-9/+38
|/ | | | This gives us trees with subdirectories, which the new test needs.
* Merge pull request #3770 from libgit2/cmn/tree-updateEdward Thomson2016-05-183-0/+458
|\ | | | | Add a method specifically for modifying trees
| * Introduce a function to create a tree based on a different onecmn/tree-updateCarlos Martín Nieto2016-05-173-0/+458
|/ | | | | | | | | | | Instead of going through the usual steps of reading a tree recursively into an index, modifying it and writing it back out as a tree, introduce a function to perform simple updates more efficiently. `git_tree_create_updated` avoids reading trees which are not modified and supports upsert and delete operations. It is not as versatile as modifying the index, but it makes some common operations much more efficient.
* Merge pull request #3767 from pks-t/pks/misc-fixesEdward Thomson2016-05-096-23/+21
|\ | | | | Misc fixes
| * diff: simplify code for handling empty dirsPatrick Steinhardt2016-05-031-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When determining diffs between two iterators we may need to recurse into an unmatched directory for the "new" iterator when it is either a prefix to the current item of the "old" iterator or when untracked/ignored changes are requested by the user and the directory is untracked/ignored. When advancing into the directory and no files are found, we will get back `GIT_ENOTFOUND`. If so, we simply skip the directory, handling resulting unmatched old items in the next iteration. The other case of `iterator_advance_into` returning either `GIT_NOERROR` or any other error but `GIT_ENOTFOUND` will be handled by the caller, which will now either compare the first directory entry of the "new" iterator in case of `GIT_ENOERROR` or abort on other cases. Improve readability of the code to make the above logic more clear.
| * delta-apply: fix sign extensionPatrick Steinhardt2016-05-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We compute offsets by executing `off |= (*delta++ << 24)` for multiple constants, where `off` is of type `size_t` and `delta` is of type `unsigned char`. The usual arithmetic conversions (see ISO C89 §3.2.1.5 "Usual arithmetic conversions") kick in here, causing us to promote both operands to `int` and then extending the result to an `unsigned long` when OR'ing it with `off`. The integer promotion to `int` may result in wrong size calculations for big values. Fix the issue by making the constants `unsigned long`, causing both operands to be promoted to `unsigned long`.
| * odb_loose: fix undefined behavior when computing sizePatrick Steinhardt2016-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An object's size is computed by reading the object header's size field until the most significant bit is not set anymore. To get the total size, we increase the shift on each iteration and add the shifted value to the total size. We read the current value into a variable of type `unsigned char`, from which we then take all bits except the most significant bit and shift the result. We will end up with a maximum shift of 60, but this exceeds the width of the value's type, resulting in undefined behavior. Fix the issue by instead reading the values into a variable of type `unsigned long`, which matches the required width. This is equivalent to git.git, which uses an `unsigned long` as well.
| * checkout: set ignorecase=0 when config lookup failsPatrick Steinhardt2016-05-021-2/+4
| | | | | | | | | | | | | | | | | | | | When `git_repository__cvar` fails we may end up with a `ignorecase` value of `-1`. As we subsequently check if `ignorecase` is non-zero, we may end up reporting that data should be removed when in fact it should not. Err on the safer side and set `ignorecase = 0` when `git_repository__cvar` fails.
| * merge_file: do not unnecessarily check ours/theirs for NULLPatrick Steinhardt2016-05-021-4/+4
| | | | | | | | | | | | | | | | | | The `merge_file__xdiff` function checks if either `ours` or `theirs` is `NULL`. The function is to be called with existing files, though, and in fact already unconditionally dereferences both pointers. Remove the unnecessary check to silence warnings.
| * index: fix memory leak on error casePatrick Steinhardt2016-05-021-1/+1
| |