summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* config: write out section headers with subsections correctlyCarlos Martín Nieto2012-03-091-10/+6
| | | | | | | | | | write_section() mistakenly treated is input as the whole variable name instead of simply the section (and possibly subsection) and would confuse "section.subsection" as a section plus variable name and produce a wrong section header. Fix this and include a test for writing "section.subsection.var" and reading it from the file.
* Rename git_oid_to_string to git_oid_tostrAuthmillenon2012-03-063-5/+5
| | | | | To conform the naming scheme of git_oid_fromstr we should change the name of git_oid_to_string to git_oid_tostr.
* Merge branch 'ssh-urls' into developmentCarlos Martín Nieto2012-03-052-7/+22
|\
| * Make git_remote_supported_url() public and shorten error stringCarlos Martín Nieto2012-03-052-9/+1
| |
| * introduced new function: git_remote_supported_url() <-- returns true if this ↵Ryan Wilcox2012-03-012-0/+18
| | | | | | | | version of libgit2 supports the correct transport mechanism for a URL or path
| * fix up previous SSH path parsing commit based on @carlosmn feedbackRyan Wilcox2012-03-011-26/+9
| |
| * implement support for username@host:path URLs in transport_find_fn()Ryan Wilcox2012-02-291-3/+25
| |
* | Convert from strnlen to git_text_is_binaryRussell Belfer2012-03-051-4/+16
| | | | | | | | | | | | Since strnlen is not supported on all platforms and since we now have the shiny new git_text_is_binary in the filtering code, let's convert diff binary detection to use the new stuff.
* | Copy values to avoid strict aliasing warningRussell Belfer2012-03-051-1/+6
| | | | | | | | | | | | To make this code more resilient to future changes, we'll explicitly translate the libgit2 structure to the libxdiff structure.
* | Fix usage of "new" for fieldname in public headerRussell Belfer2012-03-042-175/+177
| | | | | | | | | | This should restore the ability to include libgit2 headers in C++ projects.
* | Fixes for merge of filters branchRussell Belfer2012-03-021-2/+2
| |
* | Revert GIT_STATUS constants to avoid issuesRussell Belfer2012-03-023-40/+40
| | | | | | | | | | | | | | | | | | 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.
* | Fixing memory leaks indicated by valgrindRussell Belfer2012-03-021-0/+2
| | | | | | | | | | This clears up the memory leaks that valgrind seems to find on my machine.
* | Fix a win32 warning messageRussell Belfer2012-03-021-2/+5
| |
* | Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-0215-70/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Update diff to use iteratorsRussell Belfer2012-03-0218-1019/+1311
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | First pass of diff index to workdir implementationRussell Belfer2012-03-022-57/+321
| | | | | | | | | | | | | | | | | | | | 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.
* | Add tests and fix bugs for diff whitespace optionsRussell Belfer2012-03-021-8/+8
| | | | | | | | | | | | 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.
* | Continue implementation of git-diffRussell Belfer2012-03-022-147/+328
| | | | | | | | | | | | | | | | * 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
* | Fix minor WIN32 incompatibilityRussell Belfer2012-03-021-1/+4
| | | | | | | | | | | | | | | | 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.
* | Clean up diff implementation for reviewRussell Belfer2012-03-021-62/+261
| | | | | | | | | | | | | | 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.
* | Implement diff lists and formattersRussell Belfer2012-03-022-29/+477
| | | | | | | | | | | | | | | | 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.
* | Initial implementation of git_diff_blobRussell Belfer2012-03-022-1/+109
| | | | | | | | | | | | | | | | 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).
* | Eliminate xdiff compiler warningsRussell Belfer2012-03-024-13/+26
| | | | | | | | | | This cleans up the various GCC compiler warnings with the xdiff code that was copied in.
* | Simplify GIT_UNUSED macrosRussell Belfer2012-03-022-18/+5
| | | | | | | | | | | | | | 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.
* | Import xdiff library from gitRussell Belfer2012-03-0215-0/+3542
| | | | | | | | | | This is the initial import of the xdiff code (LGPL) from core git as of rev f349b562086e2b7595d8a977d2734ab2ef9e71ef
* | Merge pull request #575 from libgit2/filtersVicent Martí2012-03-0221-246/+1076
|\ \ | |/ |/| Filters, yo
| * Add filter tests and fix some bugsRussell Belfer2012-03-026-56/+51
| | | | | | | | | | This adds some initial unit tests for file filtering and fixes some simple bugs in filter application.
| * config: Add missing fileVicent Martí2012-03-021-0/+95
| |
| * config: Implement a proper cvar cacheVicent Martí2012-03-025-78/+75
| |
| * attr: Change the attribute check macrosVicent Martí2012-03-022-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * filter: Beautiful refactoringVicent Martí2012-03-014-115/+235
| | | | | | | | Comments soothe my soul.
| * filter: Properly cache filter settingsVicent Martí2012-03-012-2/+9
| |
| * filter: Precache the filter config options on loadVicent Martí2012-03-013-3/+47
| |
| * config: Refactor & add `git_config_get_mapped`Vicent Martí2012-03-011-51/+121
| | | | | | | | Sane API for real-world usage.
| * filter: Add write-to CRLF filterVicent Martí2012-02-294-115/+254
| |
| * filter: Load attributes for fileVicent Martí2012-02-283-0/+129
| |
| * buffer: Null terminate on rtrimVicent Martí2012-02-271-0/+2
| |
| * filter: Apply filters before writing a file to the ODBVicent Martí2012-02-274-49/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * buffer: Unify `git_fbuffer` and `git_buf`Vicent Martí2012-02-2713-142/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | revwalk: add convenience function to push/hide HEADCarlos Martín Nieto2012-02-271-0/+33
| | | | | | | | | | | | 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.
* | revwalk: introduce pushing and hiding by globCarlos Martín Nieto2012-02-271-0/+87
|/ | | | | | | 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.
* Add git_remote_list()Carlos Martín Nieto2012-02-261-0/+69
| | | | | Loops through the configuration and generates a list of configured remotes.
* config: correctly deal with setting a multivar with regex where there are no ↵Carlos Martín Nieto2012-02-251-52/+61
| | | | | | | | | | | | 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.
* A remote exists with an URL aloneCarlos Martín Nieto2012-02-241-0/+3
| | | | | | | 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.
* Ensure that commits don't fail if committing content that already existsPaul Betts2012-02-231-0/+2
| | | | | | | | | | | | | 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).
* tree: break out on write errorCarlos Martín Nieto2012-02-231-0/+1
| | | | | If write_tree() returs an error, we used to set the error message and continued looping. Exit the loop so we return the error.
* Fix readdir usage across platformsRussell Belfer2012-02-234-14/+30
| | | | | | This fixes the missing readdir_r from win32 and fixes other platforms to always use the reentrant readdir_r form for reading directory contents.
* Fix warnings about type conversion on win32Russell Belfer2012-02-232-5/+5
|
* Fix -Wuninitialized warningschu2012-02-231-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>