src


Log

Author Commit Date CI Message
Russell Belfer ce49c7a8 2012-03-02T15:09:40 Add filter tests and fix some bugs This adds some initial unit tests for file filtering and fixes some simple bugs in filter application.
Vicent Martí 97da3eae 2012-03-02T21:12:00 config: Add missing file
Vicent Martí f2c25d18 2012-03-02T20:08:00 config: Implement a proper cvar cache
Vicent Martí c63793ee 2012-03-02T03:51:45 attr: Change the attribute check macros The point of having `GIT_ATTR_TRUE` and `GIT_ATTR_FALSE` macros is to be able to change the way that true and false values are stored inside of the returned gitattributes value pointer. However, if these macros are implemented as a simple rename for the `git_attr__true` pointer, they will always be used with the `==` operator, and hence we cannot really change the implementation to any other way that doesn't imply using special pointer values and comparing them! We need to do the same thing that core Git does, which is using a function macro. With `GIT_ATTR_TRUE(attr)`, we can change internally the way that these values are stored to anything we want. This commit does that, and rewrites a large chunk of the attributes test suite to remove duplicated code for expected attributes, and to properly test the function macro behavior instead of comparing pointers.
Vicent Martí 47a899ff 2012-03-01T21:19:51 filter: Beautiful refactoring Comments soothe my soul.
Vicent Martí 788430c8 2012-03-01T05:06:47 filter: Properly cache filter settings
Vicent Martí c5266eba 2012-03-01T01:16:25 filter: Precache the filter config options on load
Vicent Martí c5e94482 2012-03-01T00:52:21 config: Refactor & add `git_config_get_mapped` Sane API for real-world usage.
Vicent Martí 27950fa3 2012-02-29T01:26:03 filter: Add write-to CRLF filter
Vicent Martí 450b40ca 2012-02-28T01:13:32 filter: Load attributes for file
Vicent Martí eb8f90e5 2012-02-27T17:22:51 buffer: Null terminate on rtrim
Vicent Martí 44b1ff4c 2012-02-27T04:31:05 filter: Apply filters before writing a file to the ODB Initial implementation. The relevant code is in `blob.c`: the blob write function has been split into smaller functions. - Directly write a file to the ODB in streaming mode - Directly write a symlink to the ODB in direct mode - Apply a filter, and write a file to the ODB in direct mode When trying to write a file, we first call `git_filter__load_for_file`, which populates a filters array with the required filters based on the filename. If no filters are resolved to the filename, we can write to the ODB in streaming mode straight from disk. Otherwise, we load the whole file in memory and use double-buffering to apply the filter chain. We finish by writing the file as a whole to the ODB.
Vicent Martí 13224ea4 2012-02-27T04:28:31 buffer: Unify `git_fbuffer` and `git_buf` This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
Carlos Martín Nieto 8171998f 2012-02-26T19:15:36 Add git_remote_list() Loops through the configuration and generates a list of configured remotes.
Carlos Martín Nieto 0a43d7cb 2012-02-25T18:52:28 config: correctly deal with setting a multivar with regex where there are no matches We used to erroneously consider "^$" as a special case for appending a value to a multivar. This was a misunderstanding and we should always append a value if there are no existing values that match. While we're in the area, replace all the variables in-memory in one swoop and then replace them on disk so as to avoid matching a value we've just introduced.
Carlos Martín Nieto 9554cd51 2012-02-24T12:14:26 A remote exists with an URL alone We used to consider it an error if a remote didn't have at least a fetch refspec. This was too much checking, as a remote doesn't in fact need to have anything other than an URL configured to be considered a remote.
Paul Betts 1db9d2c3 2012-02-23T17:11:20 Ensure that commits don't fail if committing content that already exists Making a commit that results in a blob that already exists in the ODB (i.e. committing something, then making a revert commit) will result in us trying to p_rename -> MoveFileExW a temp file into the existing ODB entry. Despite the MOVEFILE_REPLACE_EXISTING flag is passed in, Win32 does not care and fails it with STATUS_ACCESS_DENIED. To fix this, we p_unlink the ODB entry before attempting to rename it. This call will typically fail, but we don't care, we'll let the p_rename fail if the file actually does exist and we couldn't delete it for some reason (ACLs, etc).
Carlos Martín Nieto 82ccb87e 2012-02-23T22:56:04 tree: break out on write error If write_tree() returs an error, we used to set the error message and continued looping. Exit the loop so we return the error.
Russell Belfer 290f240e 2012-02-23T11:16:47 Fix readdir usage across platforms This fixes the missing readdir_r from win32 and fixes other platforms to always use the reentrant readdir_r form for reading directory contents.
Russell Belfer 1ec1de6d 2012-02-23T11:15:45 Fix warnings about type conversion on win32
schu 01269540 2012-02-23T16:51:07 Fix -Wuninitialized warning Signed-off-by: schu <schu-github@schulog.org>
Vicent Martí 36d72a51 2012-02-22T16:06:33 Merge pull request #570 from arrbee/uniform-iterators Uniform iterators for trees, index, and workdir
Russell Belfer 0534641d 2012-02-22T15:15:35 Fix iterators based on pull request feedback This update addresses all of the feedback in pull request #570. The biggest change was to create actual linked list stacks for storing the tree and workdir iterator state. This cleaned up the code a ton. Additionally, all of the static functions had their 'git_' prefix removed, and a lot of other unnecessary changes were removed from the original patch.
Russell Belfer da337c80 2012-02-22T11:22:33 Iterator improvements from diff implementation This makes two changes to iterator behavior: first, advance can optionally do the work of returning the new current value. This is such a common pattern that it really cleans up usage. Second, for workdir iterators, this removes automatically iterating into directories. That seemed like a good idea, but when an entirely new directory hierarchy is introduced into the workdir, there is no reason to iterate into it if there are no corresponding entries in the tree/index that it is being compared to. This second change actually wasn't a lot of code because not descending into directories was already the behavior for ignored directories. This just extends that to all directories.
Vicent Martí 8d36b253 2012-02-22T11:12:20 Merge pull request #565 from carlosmn/multimap Add config multivar support
Jay Freeman (saurik) b60deb02 2012-02-22T04:41:08 Export parse_tag_buffer as git_tag__parse_buffer.
Russell Belfer b6c93aef 2012-02-21T14:46:24 Uniform iterators for trees, index, and workdir This create a new git_iterator type of object that provides a uniform interface for iterating over the index, an arbitrary tree, or the working directory of a repository. As part of this, git ignore support was extended to support push and pop of directory-based ignore files as the working directory is being traversed (so the array of ignores does not have to be recreated at each directory during traveral). There are a number of other small utility functions in buffer, path, vector, and fileops that are included in this patch that made the iterator implementation cleaner.
Carlos Martín Nieto 9c94a356 2012-02-21T12:15:23 Fix check for writing remote's fetch and push configurations Fix copy-paste error
Carlos Martín Nieto f0f3a18a 2012-02-20T19:42:27 Move git_remote_load() to git_buf
Carlos Martín Nieto 89e5ed98 2012-02-20T19:04:45 Add git_remote_save()
Carlos Martín Nieto bcb8c007 2012-02-20T18:37:07 Add git_remote_set_{fetch,push}spec() Allow setting the fetch and push refspecs, which is useful for creating new refspecs.
Carlos Martín Nieto 3005855f 2012-02-05T00:29:26 Implement setting multivars
Carlos Martín Nieto 5e0dc4af 2012-02-04T23:18:30 Support getting multivars
Carlos Martín Nieto 0774d94d 2012-02-01T17:21:28 Store multivars in the multimap
Carlos Martín Nieto fefd4551 2012-01-23T04:26:49 First round of config multimap changes Move the configuration to use a multimap instead of a list. This commit doesn't provide any functional changes but changes the support structures.
schu 0691966a 2012-02-16T11:48:14 notes: fix assert Hopefully fix issue "Don't sleep and code" - #558. Signed-off-by: schu <schu-github@schulog.org>
Vicent Martí 6117895f 2012-02-15T11:38:40 Merge pull request #558 from schu/notes-api Notes API
schu bf477ed4 2012-02-15T00:33:38 Add git notes API This commit adds basic git notes support to libgit2, namely: * git_note_read * git_note_message * git_note_oid * git_note_create * git_note_remove In the long run, we probably want to provide some convenience callback mechanism for merging and moving (filter-branch) notes. Signed-off-by: schu <schu-github@schulog.org>
Vicent Martí 0c3bae62 2012-02-15T16:56:56 zlib: Remove custom `git2/zlib.h` header This is legacy compat stuff for when `deflateBound` is not defined, but we're not embedding zlib and that function is always available. Kill that with fire.
schu 905919e6 2012-02-14T20:44:22 util: add git__ishex git__ishex allows to check if a string is a hexadecimal representation. Signed-off-by: schu <schu-github@schulog.org>
schu b4b79ac3 2012-02-15T00:12:53 commit: actually allow yet to be born update_ref git_commit_create is supposed to update the given reference "update_ref", but segfaulted in case of a yet to be born reference. Fix it. Signed-off-by: schu <schu-github@schulog.org>
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
schu 15f52ae1 2011-12-19T15:59:13 config_file: fix clang sizeof-pointer-memaccess
Vicent Martí 6d39c0dd 2012-02-11T06:44:54 Merge pull request #554 from carlosmn/revwalk-reset revwalk: unmark commits as uninteresting on reset
Vicent Martí f19e3ca2 2012-02-10T20:16:42 odb: Proper symlink hashing
Vicent Martí 18e5b854 2012-02-10T19:47:02 odb: Add internal `git_odb__hashfd`
Carlos Martín Nieto 97313ce2 2012-02-07T10:51:57 revwalk: unmark commits as uninteresting on reset Not doing so hides commits we want to get at during a second walk.
Vicent Martí 199b7d94 2012-02-05T07:42:06 Merge pull request #551 from schu/treebuilder-entries treebuilder: remove needless variable entry_count
schu b3408e3e 2012-02-05T14:59:45 treebuilder: remove needless variable entry_count Signed-off-by: schu <schu-github@schulog.org>
nulltoken 99abb79d 2012-02-03T12:45:43 repository: ensure that the path to the .git directory ends with a forward slash when opening a repository through a working directory path This fixes an issue which was detected while using one of the libgit2 bindings [0]. The lack of the trailing forward slash led the name of references returned by git_reference_listall() to be prefixed with a forward slash. [0]: https://github.com/libgit2/libgit2sharp/pull/108
Ehsan Akhgari 31ffc141 2012-02-02T00:14:59 Fix the build on Emscripten struct timeval is used in this file, which requires <sys/time.h> to be included.
Russell Belfer e8c96ed2 2012-02-01T12:30:35 Add unit tests for recent bug fixes Add unit tests to confirm ignore directory pattern matches and to confirm that ignore and attribute files are loaded properly into the attribute file cache.
Russell Belfer 62a1f713 2012-02-01T11:54:42 Fix memory leak in attr file cache Actually look for the file by the same cache key that we store it under. Rocket science!
Vicent Martí 4ea79a9d 2012-02-01T17:41:54 status: Document submodule TODOs
Russell Belfer e4eb94a2 2012-01-31T14:02:52 Fix issue with ignoring whole directories Now that is_dir is calculated correctly for attr/ignore paths, it is possible to use it so that ignoring "dir/" will properly match the directory name and ignore the entire directory.
Russell Belfer adc9bdb3 2012-01-31T13:59:32 Fix attr path is_dir check When building an attr path object, the code that checks if the file is a directory was evaluating the file as a relative path to the current working directory, instead of using the repo root. This lead to inconsistent behavior.
Russell Belfer 5d3cd4e3 2012-01-31T13:09:39 Convert status assert to skip file When status encounters a submodule, right now it is asserting. This changes it to just skip the file that it can't deal with.
Carlos Martín Nieto 279afd2a 2012-01-31T17:21:49 refspec: a ref name includes the refs/ prefix git_refspec_transform_r assumed that the reference name passed would be only a branch or tag name. This is not the case, and we need to take into consideration what's in the refspec's source to know how much of the prefix to ignore.
Vicent Martí e4b4da14 2012-01-27T18:28:02 cache: Simplify locking mechanics The object cache is mostly IO-bound, so it makes no sense to have a lock per node.
Vicent Martí 7a6f51de 2012-01-26T18:03:14 win32: Use the Windows Atomic API on MinGW too
Vicent Martí a53420e4 2012-01-26T17:53:46 msvc: Move `ssize_t` typedef to MSVC-only This is a MSVC-only issue. All other compilers we support work properly.
nulltoken 5663e61a 2012-01-25T16:44:21 repository: add minimal reinitialization of repository This currently only ensures that the version of the repository format isn't greater than zero.
Carlos Martín Nieto a9fe8ae0 2012-01-23T22:14:04 config: don't use 'section "subsection"' internal form on config_set This had been left over from a time when I believed what the git documentation had to say about case-sensitivity. The rest of the code doesn't recognize this form and we hadn't noticed because most tests don't try to get a recently-set variable but free and reload the configuration, causing the right format to be used.
Russell Belfer 63ab73be 2012-01-20T11:13:17 Merge branch 'fix-subdir-attr-paths' into development This resolves issue #535 and issue #533.
Carlos Martín Nieto 9269ccce 2012-01-19T23:44:52 diff-index: fix leak The buffer wasn't getting freed if the last difference was a deletion.
Carlos Martín Nieto 860de004 2012-01-19T23:26:20 http: use PRIuZ MSVC doesn't think %zd is a valid specifier.
Carlos Martín Nieto 20c50b9e 2012-01-19T19:09:47 refs: don't leak the packref when deleting/renaming When we remove the ref from the hashtable, we need to free the packref.
Carlos Martín Nieto 3f2bf4d6 2012-01-19T19:06:15 hashtable: add remove2 to retrieve the value that was removed
Carlos Martín Nieto d0ec3fb8 2012-01-19T17:07:49 indexer: save the pack index with the right name Truncate at the slash; otherwise we get ppack-*.idx filenames.
Carlos Martín Nieto 585a2eb7 2012-01-19T17:05:16 remote: don't try to free the ref on error On error, the pointer could be pointing anywhere.
nulltoken c3ec2ec2 2012-01-19T00:09:47 transport: prevent git_remote_download() from segfaulting when being passed a lightweight remote built with git_remote_new()
Russell Belfer 1744fafe 2012-01-17T15:49:47 Move path related functions from fileops to path This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
nulltoken 0b44c065 2012-01-17T14:35:04 repository: add the invalid repository path to the error message
nulltoken 86360ffd 2012-01-17T14:33:26 transport: prevent the transport determination mechanism from segfaulting when being passed an url starting with an unknown prefix
nulltoken fdc8a7db 2012-01-17T14:06:35 Fix MSVC compilation warning
Russell Belfer 83bfbdf5 2012-01-16T18:00:18 Remove poor git__removechar function Going back over this, the git__removechar function was not needed (only invoked once) and is actually mislabeled. As implemented, it really only made sense for removing backslash characters, since two of the "removed" characters in a row would include the second one -- i.e. it really implements stripping backslash-escaped strings where a backslash allows internal whitespace in a word.
Russell Belfer a51cd8e6 2012-01-16T16:58:27 Fix handling of relative paths for attrs Per issue #533, the handling of relative paths in attribute and ignore files was not right. Fixed this by pre-joining the relative path of the attribute/ignore file onto the match string when a full path match is required. Unfortunately, fixing this required a bit more code than I would have liked because I had to juggle things around so that the fnmatch parser would have sufficient information to prepend the relative path when it was needed.
Russell Belfer 6e03b12f 2012-01-16T15:34:35 Merge pull request #531 from arrbee/gitignore Initial implementation of gitignore support git_status_foreach() and git_status_file() will now be gitignore aware.
Russell Belfer cfbc880d 2012-01-16T15:16:44 Patch cleanup for merge After reviewing the gitignore support with Vicent, we came up with a list of minor cleanups to prepare for merge, including: * checking git_repository_config error returns * renaming git_ignore_is_ignored and moving to status.h * fixing next_line skipping to include \r skips * commenting on where ignores are and are not included
Carlos Martín Nieto d9e5430e 2012-01-16T11:45:34 Windows: store all 64 bits of the size in the stat structure We force stat to be a stat64 structure, so we can and should put all 64 bits of the size in st_size.
Vicent Martí 1af56d7d 2012-01-15T15:48:36 Fix #534: 64-bit issues in Windows off_t is always 32 bits in Windows, which is beyond stupid, but we just don't care anymore because we're using `git_off_t` which is assured to be 64 bits on all platforms, regardless of compilation mode. Just ensure that no casts to `off_t` are performed. Also, the check for `off_t` overflows has been dropped, once again, because the size of our offsets is always 64 bits on all platforms. Fixes #534
Carlos Martín Nieto c1c399cf 2012-01-13T19:33:54 config: handle EOF properly In the main loop we peek to see what kind of line the next one is. If there are multiple newlines before the end of the file, the eof marker won't be set after we read the last line with data and we'll try to peek again. This peek will return LF (as it pretends that we have a newline at EOF so other function don't need any special handling). Fix cfg_getchar so it doesn't try to read past the last character in the file and config_parse so it considers LF as EOF on peek (as we're ignoring spaces) and sets the reader's EOF flag to exit the parsing loop.
Russell Belfer 1dbcc9fc 2012-01-11T21:07:16 Fix several memory issues This contains fixes for several issues discovered by MSVC and by valgrind, including some bad data access, some memory leakage (in where certain files were not being successfully added to the cache), and some code simplification.
Russell Belfer 0cfcff5d 2012-01-11T20:41:55 Convert git_path_walk_up to regular function This gets rid of the crazy macro version of git_path_walk_up and makes it into a normal function that takes a callback parameter. This turned out not to be too messy.
Russell Belfer 15debaf5 2012-01-11T17:28:25 Fix bug in dir_for_path The last checkin accidentally broke dir_for_path by propogating the dirname return code even when there was no error.
Russell Belfer 6a67a812 2012-01-11T16:01:48 Allow ignores (and attribs) for nonexistent files This fixes issue 532 that attributes (and gitignores) could not be checked for files that don't exist. It should be possible to query such things regardless of the existence of the file.
Russell Belfer df743c7d 2012-01-09T15:37:19 Initial implementation of gitignore support Adds support for .gitignore files to git_status_foreach() and git_status_file(). This includes refactoring the gitattributes code to share logic where possible. The GIT_STATUS_IGNORED flag will now be passed in for files that are ignored (provided they are not already in the index or the head of repo).
Russell Belfer 7e443f69 2012-01-09T15:46:06 Restore portability to git_path_prettify. It turns out that passing NULL for the second parameter of realpath(3) is not as portable as one might like. Notably, Mac OS 10.5 and earlier does not support it. So this moves us back to a large buffer to get the realpath info.
Vicent Martí 1d175074 2012-01-05T17:46:06 Merge pull request #528 from arrbee/valgrind-fixes-2 Valgrind fixes in smaller pieces
Russell Belfer fa3cb0da 2012-01-05T15:15:43 Fix memory leak in git_index_remove. Missed freeing the entry.
Russell Belfer 2d840502 2012-01-05T15:03:42 Throw first error in chain, not rethrow. This is the first time this error is throw, so use git__throw instead of git__rethrow.
Jeff King 671bbdd3 2012-01-05T17:31:13 reflog_write: don't access free()'d memory We get the oid of a reference, free the reference, then convert the oid to a string. We need to convert the oid before freeing the memory.
Vicent Martí f2114d0a 2012-01-04T22:40:59 Merge remote-tracking branch 'nulltoken/topix/path_fromurl' into development Conflicts: tests-clay/clay.h tests-clay/clay_main.c
nulltoken f46e6226 2012-01-04T21:15:12 Fix Windows specific off-by-one error The value returned by MultiByteToWideChar includes the NULL termination character.
nulltoken acb159e1 2012-01-04T17:59:48 Fix MSVC compilation warnings
Vincent Lee c6a437ea 2012-01-03T19:44:13 Add missing semicolon
Vicent Martí 7a704309 2012-01-02T09:58:39 Merge remote-tracking branch 'drizzd/diff-index-tests' into development Conflicts: tests-clay/clay.h tests-clay/clay_main.c
Vicent Martí 9191a6d2 2012-01-02T09:56:48 Merge remote-tracking branch 'arrbee/git-attributes' into development Conflicts: tests-clay/clay_main.c
Vicent Martí 9dd4c3e8 2011-12-31T05:56:39 config: Rename the `delete` callback name `delete` is a reserved keyword in C++.
Russell Belfer bd370b14 2011-12-30T15:00:14 Improved gitattributes macro implementation This updates to implementation of gitattribute macros to be much more similar to core git (albeit not 100%) and to handle expansion of macros within macros, etc. It also cleans up the refcounting usage with macros to be much cleaner. Also, this adds a new vector function `git_vector_insert_sorted()` which allows you to maintain a sorted list as you go. In order to write that function, this changes the function `git__bsearch()` to take a somewhat different set of parameters, although the core functionality is still the same.