src


Log

Author Commit Date CI Message
Russell Belfer 7784bcbb 2012-04-11T11:52:59 Refactor git_repository_open with new options Add a new command `git_repository_open_ext` with extended options that control how searching for a repository will be done. The existing `git_repository_open` and `git_repository_discover` are reimplemented on top of it. We may want to change the default behavior of `git_repository_open` but this commit does not do that. Improve support for "gitdir" files where the work dir is separate from the repo and support for the "separate-git-dir" config. Also, add support for opening repos created with `git-new-workdir` script (although I have only confirmed that they can be opened, not that all functions work correctly). There are also a few minor changes that came up: - Fix `git_path_prettify` to allow in-place prettifying. - Fix `git_path_root` to support backslashes on Win32. This fix should help many repo open/discover scenarios - it is the one function called when opening before prettifying the path. - Tweak `git_config_get_string` to set the "out" pointer to NULL if the config value is not found. Allows some other cleanup. - Fix a couple places that should have been calling `git_repository_config__weakptr` and were not. - Fix `cl_git_sandbox_init` clar helper to support bare repos.
Vicent Martí 64b402f8 2012-04-11T19:19:12 status: Remove status_old This is Git yo. You can fetch stuff from the history if you need it.
Carlos Martín Nieto bd6585a7 2012-03-16T15:15:21 netops: show winsock error messages on Windows
Carlos Martín Nieto 56b7df10 2012-03-07T07:01:20 error-handling: netops
Carlos Martín Nieto a62053a0 2012-04-01T00:45:02 error-handling local transport
Carlos Martín Nieto 25530fca 2012-03-06T11:26:10 error-handling: http
Carlos Martín Nieto 2b386acd 2012-03-06T10:47:18 error-handling: git transport
Carlos Martín Nieto 5eb8affb 2012-03-30T18:37:19 error-handling: fetch
Carlos Martín Nieto 84d250bf 2012-03-06T10:23:02 error-handling: protocol, pkt
Carlos Martín Nieto 4376f7f6 2012-03-06T08:12:35 error-handling: remote, transport
nulltoken d4d648b0 2012-04-11T15:25:34 Fix compilation errors and warnings
Carlos Martín Nieto 1a2b8725 2012-04-11T14:27:40 Typedefs don't have enum in front
Vicent Martí 0a20eee9 2012-04-11T03:43:30 Merge pull request #619 from nulltoken/topic/branches Basic branch management API
nulltoken b78fb64d 2012-04-10T14:03:47 repository: make git_repository_set_workdir() prettify the path it is being passed
Vicent Martí dcfdb958 2012-04-11T12:38:45 Merge branch 'new-error-handling' of github.com:libgit2/libgit2 into new-error-handling
nulltoken 4615f0f7 2012-04-09T03:22:14 branch: add git_branch_move()
nulltoken 555aa453 2012-04-09T02:28:31 fileops: Make git_futils_mkdir_r() able to skip non-empty directories
nulltoken 731df570 2012-04-04T15:57:19 Add basic branch management API: git_branch_create(), git_branch_delete(), git_branch_list()
nulltoken 79fd4230 2012-04-06T15:23:18 transport/local: Fix peeling of nested tags
nulltoken 3f46f313 2012-04-06T14:34:26 tag: Add git_tag_peel() which recursively peel a tag until a non tag git_object is met
Carlos Martín Nieto 8e8b6b01 2012-04-04T13:13:43 Clean up valgrind warnings
Vicent Martí 73fe6a8e 2012-03-28T18:59:12 error-handling: Commit (WIP)
nulltoken 09719c50 2012-03-14T12:13:03 reference: Fix creation of references with extended ASCII characters in their name
Russell Belfer 952f94c8 2012-03-30T14:42:23 Fix bug when join_n refers to original buffer There was a bug in git_buf_join_n when the contents of the original buffer were joined into itself and the realloc moved the pointer to the original buffer.
Russell Belfer 95dfb031 2012-03-30T14:40:50 Improve config handling for diff,submodules,attrs This adds support for a bunch of core.* settings that affect diff and status, plus fixes up some incorrect implementations of those settings from before. Also, this cleans up the handling of config settings in the new submodules code and in the old attrs/ignore code.
Russell Belfer bfc9ca59 2012-03-28T16:45:36 Added submodule API and use in status When processing status for a newly checked out repo, it is possible that there will be submodules that have not yet been initialized. The only way to distinguish these from untracked directories is to have some knowledge of submodules. This commit adds a new submodule API which, given a name or path, can determine if it appears to be a submodule and can give information about the submodule.
Russell Belfer 277e3041 2012-03-26T11:22:27 Fix handling of submodules in trees
Russell Belfer 1db12b00 2012-03-25T23:04:26 Eliminate hairy COITERATE macro I decided that the COITERATE macro was, in the end causing more confusion that it would save and decided just to write out the loops that I needed for parallel diff list iteration. It is not that much code and this just feels less obfuscated.
Russell Belfer 875bfc5f 2012-03-25T21:26:48 Fix error in tree iterator when popping up trees There was an error in the tree iterator where it would delete two tree levels instead of just one when popping up a tree level. Unfortunately the test data for the tree iterator did not have any deep trees with subtrees in the middle of the tree items, so this problem went unnoticed. This contains the 1-line fix plus new test data and tests that reveal the issue.
Russell Belfer c8838ee9 2012-03-23T11:03:01 Restore default status recursion behavior This gives `git_status_foreach()` back its old behavior of emulating the "--untracked=all" behavior of git. You can get any of the various --untracked options by passing flags to `git_status_foreach_ext()` but the basic version will keep the behavior it has always had.
Russell Belfer 4b136a94 2012-03-23T09:26:09 Fix crash in new status and add recurse option This fixes the bug that @nulltoken found (thank you!) where if there were untracked directories alphabetically after the last tracked item, the diff implementation would deref a NULL pointer. The fix involved the code which decides if it is necessary to recurse into a directory in the working dir, so it was easy to add a new option `GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS` to control if the contents of untracked directories should be included in status.
Russell Belfer 66142ae0 2012-03-22T10:44:36 New status fixes This adds support for roughly-right tracking of submodules (although it does not recurse into submodules to detect internal modifications a la core git), and it adds support for including unmodified files in diff iteration if requested.
Russell Belfer a48ea31d 2012-03-21T12:33:09 Reimplment git_status_foreach using git diff This is an initial reimplementation of status using diff a la the way that core git does it.
Russell Belfer a4c291ef 2012-03-20T21:57:38 Convert reflog to new errors Cleaned up some other issues.
Russell Belfer 4aa7de15 2012-03-19T17:49:46 Convert indexer, notes, sha1_lookup, and signature More files moved to new error handling style.
Russell Belfer 7c7ff7d1 2012-03-19T16:10:11 Migrate index, oid, and utils to new errors This includes a few cleanups that came up while converting these files. This commit introduces a could new git error classes, including the catchall class: GITERR_INVALID which I'm using as the class for invalid and out of range values which are detected at too low a level of library to use a higher level classification. For example, an overflow error in parsing an integer or a bad letter in parsing an OID string would generate an error in this class.
Russell Belfer 0d0fa7c3 2012-03-16T15:56:01 Convert attr, ignore, mwindow, status to new errors Also cleaned up some previously converted code that still had little things to polish.
nulltoken 7b93079b 2012-03-16T15:16:52 Make git_path_root() cope with windows network paths Fix libgit2/libgit2sharp#125
Russell Belfer deafee7b 2012-03-14T17:36:15 Continue error conversion This converts blob.c, fileops.c, and all of the win32 files. Also, various minor cleanups throughout the code. Plus, in testing the win32 build, I cleaned up a bunch (although not all) of the warnings with the 64-bit build.
Russell Belfer ab43ad2f 2012-03-14T11:07:14 Convert attr and other files to new errors This continues to add other files to the new error handling style. I think the only real concerns here are that there are a couple of error return cases that I have converted to asserts, but I think that it was the correct thing to do given the new error style.
Russell Belfer e3c47510 2012-03-13T14:23:24 Resolve comments from pull request This converts the map validation function into a macro, tweaks the GITERR_OS system error automatic appending, and adds a tentative new error access API and some quick unit tests for both the old and new error APIs.
Russell Belfer 1736799d 2012-03-12T23:06:31 Add map.c with shared p_mmap param validation Forgot to add this file in the previous commit
Russell Belfer e1de726c 2012-03-12T22:55:40 Migrate ODB files to new error handling This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
Vicent Martí dda708e7 2012-03-09T19:55:50 error-handling: On-disk config file backend Includes: - Proper error reporting when encountering syntax errors in a config file (file, line number, column). - Rewritten `config_write`, now with 99% less goto-spaghetti - Error state in `git_filebuf`: filebuf write functions no longer need to be checked for error returns. If any of the writes performed on a buffer fail, the last call to `git_filebuf_commit` or `git_filebuf_hash` will fail accordingly and set the appropiate error message. Baller!
Russell Belfer 6af24ce3 2012-03-07T10:55:18 Merge pull request #590 from arrbee/new-error-handling Migrating diff to new error handling
Russell Belfer 998f7b3d 2012-03-07T10:52:17 Fix issues raised on pull request This resolves the comments on pull request #590
Vicent Martí e54d8d89 2012-03-07T01:37:09 error-handling: Config
Russell Belfer ae9e29fd 2012-03-06T16:14:31 Migrating diff to new error handling Ended up migrating a bunch of upstream functions as well including vector, attr_file, and odb in order to get this to work right.
Vicent Martí cb8a7961 2012-03-07T00:02:55 error-handling: Repository This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
Vicent Martí 9d160ba8 2012-03-06T01:37:56 diff: Fix rebase breackage
Vicent Martí 1a481123 2012-02-17T00:13:34 error-handling: References Yes, this is error handling solely for `refs.c`, but some of the abstractions leak all ofer the code base.
Vicent Martí 45d387ac 2012-02-15T16:54:17 refs: Error handling rework. WIP
Vicent Martí 60bc2d20 2012-02-14T21:23:11 error-handling: Add new routines Obviously all the old throw routines are still in place, so we can gradually port over.
Russell Belfer 529df4df 2012-03-02T15:57:06 Fixes for merge of filters branch
Russell Belfer e1bcc191 2012-03-01T11:45:00 Revert GIT_STATUS constants to avoid issues This reverts the changes to the GIT_STATUS constants and adds a new enumeration to describe the type of change in a git_diff_delta. I don't love this solution, but it should prevent strange errors from occurring for now. Eventually, I would like to unify the various status constants, but it needs a larger plan and I just wanted to eliminate this breakage quickly.
Russell Belfer c19bc93c 2012-02-29T14:19:39 Fixing memory leaks indicated by valgrind This clears up the memory leaks that valgrind seems to find on my machine.
Russell Belfer da9abdd6 2012-02-29T13:19:31 Fix a win32 warning message
Russell Belfer 854eccbb 2012-02-29T12:04:59 Clean up GIT_UNUSED macros on all platforms It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
Russell Belfer 74fa4bfa 2012-02-28T16:14:47 Update diff to use iterators This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
Russell Belfer e47329b6 2012-02-13T17:29:30 First pass of diff index to workdir implementation This is an initial version of git_diff_workdir_to_index. It also includes renaming some structures and some refactoring of the existing code so that it could be shared better with the new function. This is not complete since it needs a rebase to get some new odb functions from the upstream branch.
Russell Belfer caf71ec0 2012-02-07T15:30:18 Add tests and fix bugs for diff whitespace options Once I added tests for the whitespace handling options of diff, I realized that there were some bugs. This fixes those and adds the new tests into the test suite.
Russell Belfer a2e895be 2012-02-07T12:14:28 Continue implementation of git-diff * Implemented git_diff_index_to_tree * Reworked git_diff_options structure to handle more options * Made most of the options in git_diff_options actually work * Reorganized code a bit to remove some redundancy * Added option parsing to examples/diff.c to test most options
Russell Belfer 5a2f097f 2012-02-03T17:05:05 Fix minor WIN32 incompatibility File mode flags are not all defined on WIN32, but since git is so rigid in how it uses file modes, there is no reason not to hard code a particular value. Also, this is only used in the git_diff_print_compact helper function, so it is really really not important.
Russell Belfer 3a437590 2012-02-03T16:53:01 Clean up diff implementation for review This fixes several bugs, updates tests and docs, eliminates the FILE* assumption in favor of printing callbacks for the diff patch formatter helpers, and adds a "diff" example function that can perform a diff from the command line.
Russell Belfer 65b09b1d 2012-02-02T18:03:43 Implement diff lists and formatters This reworks the diff API to separate the steps of producing a diff descriptions from formatting the diff. This will allow us to share diff output code with the various diff creation scenarios and will allow us to implement rename detection as an optional pass that can be run on a diff list.
Russell Belfer cd33323b 2012-01-27T11:29:25 Initial implementation of git_diff_blob This gets the basic plumbing in place for git_diff_blob. There is a known issue where additional parameters like the number of lines of context to display on the diff are not working correctly (which leads one of the new unit tests to fail).
Russell Belfer 8b75f7f3 2012-01-24T14:08:20 Eliminate xdiff compiler warnings This cleans up the various GCC compiler warnings with the xdiff code that was copied in.
Russell Belfer 2705576b 2012-01-24T14:06:42 Simplify GIT_UNUSED macros Since casting to void works to eliminate errors with unused parameters on all platforms, avoid the various special cases. Over time, it will make sense to eliminate the GIT_UNUSED macro completely and just have GIT_UNUSED_ARG.
Russell Belfer 3a5ad90a 2012-01-24T12:23:20 Import xdiff library from git This is the initial import of the xdiff code (LGPL) from core git as of rev f349b562086e2b7595d8a977d2734ab2ef9e71ef
Vicent Martí e3d55b2a 2012-03-02T15:44:15 Merge pull request #575 from libgit2/filters Filters, yo
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
Carlos Martín Nieto f7367993 2012-02-27T22:22:45 revwalk: add convenience function to push/hide HEAD It's not unusual to want the walker to act on HEAD, so add a convencience function for the case that the user doesn't already have a resolved HEAD reference.
Carlos Martín Nieto 155aca2d 2012-02-27T21:17:13 revwalk: introduce pushing and hiding by glob git_revwalk_{push,hide}_glob() lets you push the OIDs of references that match the specified glob. This is the basics for what git.git does with the rev-list options --branches, --tags, --remotes and --glob.
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