summaryrefslogtreecommitdiff
path: root/src/submodule.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename diff objects and split patch.hRussell Belfer2013-10-111-3/+3
| | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* More filemode cleanups for FAT on MacOSRussell Belfer2013-10-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | This cleans up some additional issues. The main change is that on a filesystem that doesn't support mode bits, libgit2 will now create new blobs with GIT_FILEMODE_BLOB always instead of being at the mercy to the filesystem driver to report executable or not. This means that if "core.filemode" lies and claims that filemode is not supported, then we will ignore the executable bit from the filesystem. Previously we would have allowed it. This adds an option to the new git_repository_reset_filesystem to recurse through submodules if desired. There may be other types of APIs that would like a "recurse submodules" option, but this one is particularly useful. This also has a number of cleanups, etc., for related things including trying to give better error messages when problems come up from the filesystem. For example, the FAT filesystem driver on MacOS appears to return errno EINVAL if you attempt to write a filename with invalid UTF-8 in it. We try to capture that with a better error message now.
* No such thing as an orphan branchCarlos Martín Nieto2013-09-171-1/+1
| | | | | | | | | | | Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
* submodule: check alloc and name presenseNikolai Vladimirov2013-08-051-1/+4
|
* submodule: Fix memory leaksnulltoken2013-07-131-1/+2
|
* Clean up left over alloc changeRussell Belfer2013-07-101-1/+1
|
* Add ignore_submodules to diff optionsRussell Belfer2013-07-101-36/+76
| | | | | | | | | | | | | | | | | | | | This adds correct support for an equivalent to --ignore-submodules in diff, where an actual ignore value can be passed to diff to override the per submodule settings in the configuration. This required tweaking the constants for ignore values so that zero would not be used and could represent an unset option to the diff. This was an opportunity to move the submodule values into include/git2/types.h and to rename the poorly named DEFAULT values for ignore and update constants to RESET instead. Now the GIT_DIFF_IGNORE_SUBMODULES flag is exactly the same as setting the ignore_submodules option to GIT_SUBMODULE_IGNORE_ALL (which is actually a minor change from the old behavior in that submodules will now be treated as UNMODIFIED deltas instead of being left out totally - if you set GIT_DIFF_INCLUDE_UNMODIFIED). This includes tests for the various new settings.
* Submodule status improvementsRussell Belfer2013-07-101-309/+307
| | | | | | | | | | | | | | | This fixes the way that submodule status is checked to bypass just about all of the caching in the submodule object. Based on the ignore value, it will try to do the minimum work necessary to find the current status of the submodule - but it will actually go to disk to get all of the current values. This also removes the custom refcounting stuff in favor of the common git_refcount style. Right now, it is still for internal purposes only, but it should make it easier to add true submodule refcounting in the future with a public git_submodule_free call that will allow bindings not to worry about the submodule object getting freed from underneath them.
* Add timestamp check to submodule statusRussell Belfer2013-07-101-5/+37
| | | | | | | | This is probably not the final form of this change, but this is a preliminary version of checking a timestamp to see if the cached working directory HEAD OID matches the current. Right now, this uses the timestamp on the index and is, like most of our timestamp checking, subject to having only second accuracy.
* Test submodules with empty index or orphaned headRussell Belfer2013-06-271-2/+5
| | | | | | | | In both of these cases, the submodule data should still be loaded just (obviously) without the data that comes from either the index or the HEAD. This fixes a bug in the orphaned head case.
* Add status flags to force output sort orderRussell Belfer2013-06-201-1/+1
| | | | | | | | | | | | | | | | Files in status will, be default, be sorted according to the case insensitivity of the filesystem that we're running on. However, in some cases, this is not desirable. Even on case insensitive file systems, 'git status' at the command line will generally use a case sensitive sort (like 'ls'). Some GUIs prefer to display a list of file case insensitively even on case-sensitive platforms. This adds two new flags: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY and GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY that will override the default sort order of the status output and give the user control. This includes tests for exercising these new options and makes the examples/status.c program emulate core Git and always use a case sensitive sort.
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-0/+2
| | | | | | | | | | | | | | | | | | This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
* Make iterators use GIT_ITEROVER & smart advanceRussell Belfer2013-05-311-10/+8
| | | | | | | | | | | | | | | 1. internal iterators now return GIT_ITEROVER when you go past the last item in the iteration. 2. git_iterator_advance will "advance" to the first item in the iteration if it is called immediately after creating the iterator, which allows a simpler idiom for basic iteration. 3. if git_iterator_advance encounters an error reading data (e.g. a missing tree or an unreadable file), it returns the error but also attempts to advance past the invalid data to prevent an infinite loop. Updated all tests and internal usage of iterators to account for these new behaviors.
* Add error messages for failed submodule lookupRussell Belfer2013-05-011-0/+4
|
* Move git_config_backend to include/git2/sysRussell Belfer2013-04-211-0/+1
| | | | | | Moving backend implementor objects into include/git2/sys so the APIs can be isolated from the ones that normal libgit2 users would be likely to use.
* branch: rename 'tracking' to 'upstream'Carlos Martín Nieto2013-03-301-1/+1
| | | | | The term 'tracking' is overloaded. Help distinguish what we mean by using 'upstream' for this part of the library.
* Implement GIT_STATUS_OPT_EXCLUDE_SUBMODULESRussell Belfer2013-03-251-1/+1
| | | | | | | | | | | This option has been sitting unimplemented for a while, so I finally went through and implemented it along with some tests. As part of this, I improved the implementation of GIT_DIFF_IGNORE_SUBMODULES so it be more diligent about avoiding extra work and about leaving off delta records for submodules to the greatest extent possible (though it may include them still if you are request TYPECHANGE records).
* Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-1/+1
| | | | | | | Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0
* Make iterator APIs consistent with standardsRussell Belfer2013-03-061-6/+6
| | | | | | | | | | | | The iterator APIs are not currently consistent with the parameter ordering of the rest of the codebase. This rearranges the order of parameters, simplifies the naming of a number of functions, and makes somewhat better use of macros internally to clean up the iterator code. This also expands the test coverage of iterator functionality, making sure that case sensitive range-limited iteration works correctly.
* Vector improvements and their falloutPhilip Kelley2013-01-271-4/+4
|
* Merge pull request #1239 from ethomson/index_removeVicent Martí2013-01-171-1/+1
|\ | | | | add an index_remove_bypath that removes conflicts
| * add an index_remove_bypath that removes conflicts, renamed add_from_workdir ↵Edward Thomson2013-01-121-1/+1
| | | | | | | | to match
* | Minor iterator API cleanupsRussell Belfer2013-01-151-1/+3
|/ | | | | | | | | In preparation for further iterator changes, this cleans up a few small things in the iterator API: * removed the git_iterator_for_repo_index_range API * made git_iterator_free not be inlined * minor param name and test function name tweaks
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Submodule caching fix and location APIRussell Belfer2013-01-041-6/+21
| | | | | | | | | | This adds a new API to the submodule interface that just returns where information about the submodule was found (e.g. config file only or in the HEAD, index, or working directory). Also, the old "refresh" call was potentially keeping some stale submodule data around, so this simplfies that code and literally discards the old cache, then reallocates.
* Fix diff constructor name order confusionRussell Belfer2012-12-171-2/+2
| | | | | | | | | | | | The diff constructor functions had some confusing names, where the "old" side of the diff was coming after the "new" side. This reverses the order in the function name to make it less confusing. Specifically... * git_diff_index_to_tree becomes git_diff_tree_to_index * git_diff_workdir_to_index becomes git_diff_index_to_workdir * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
* Clean up iterator APIsRussell Belfer2012-12-101-1/+1
| | | | | | | | This removes the need to explicitly pass the repo into iterators where the repo is implied by the other parameters. This moves the repo to be owned by the parent struct. Also, this has some iterator related updates to the internal diff API to lay the groundwork for checkout improvements.
* Deploy GIT_REPOSITORY_INIT_OPTIONS_INITBen Straub2012-11-301-2/+1
|
* Deploy GIT_DIFF_OPTIONS_INITBen Straub2012-11-301-2/+1
|
* Consolidate text buffer functionsRussell Belfer2012-11-281-1/+2
| | | | | | | | | | | | | There are many scattered functions that look into the contents of buffers to do various text manipulations (such as escaping or unescaping data, calculating text stats, guessing if content is binary, etc). This groups all those functions together into a new file and converts the code to use that. This has two enhancements to existing functionality. The old text stats function is significantly rewritten and the BOM detection code was extended (although largely we can't deal with anything other than a UTF8 BOM).
* Fix uninitialized variableSascha Cunz2012-11-281-1/+1
| | | | | | | clang-SVN HEAD kindly provided my the info, that sm_repo maybe uninitialized when we want to free it (If the expression in line 358 or 359/360 evaluate to true, we jump to "cleanup", where we'd use sm_repo uninitialized).
* API updates for index.hBen Straub2012-11-271-1/+1
|
* API updates for submodule.hRussell Belfer2012-11-271-8/+8
|
* Clean up config.hBen Straub2012-11-271-8/+8
|
* Rename ref and reflog apis for consistencyBen Straub2012-11-271-3/+3
|
* Add explicit git_index ptr to diff and checkoutRussell Belfer2012-11-141-2/+2
| | | | | | | | A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
* Add iterator for git_index objectRussell Belfer2012-11-141-1/+1
| | | | | | The index iterator could previously only be created from a repo object, but this allows creating an iterator from a `git_index` object instead (while keeping, though renaming, the old function).
* Fix diff API to better parameter orderRussell Belfer2012-11-141-2/+2
| | | | | The diff API is not in the parameter order one would expect from other libgit2 APIs. This fixes that.
* Some diff refactorings to help code reuseRussell Belfer2012-11-091-1/+1
| | | | | | | | | | | | | | | | | There are some diff functions that are useful in a rewritten checkout and this lays some groundwork for that. This contains three main things: 1. Share the function diff uses to calculate the OID for a file in the working directory (now named `git_diff__oid_for_file` 2. Add a `git_diff__paired_foreach` function to iterator over two diff lists concurrently. Convert status to use it. 3. Move all the string/prefix/index entry comparisons into function pointers inside the `git_diff_list` object so they can be switched between case sensitive and insensitive versions. This makes them easier to reuse in various functions without replicating logic. As part of this, move a couple of index functions out of diff.c and into index.c.
* index refactoringEdward Thomson2012-10-291-3/+3
|
* Add config level support in the config APIyorah2012-10-231-5/+6
| | | | | | | Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found. Added `git_config_open_level`: build a single-level focused config object from a multi-level one. We are now storing `git_config_entry`s in the khash of the config_file
* refs: use constants for well-known namesnulltoken2012-10-071-2/+2
|
* Clean up Win64 warningsRussell Belfer2012-09-281-1/+1
|
* Initial implementation of new diff patch APIRussell Belfer2012-09-251-3/+4
| | | | | | | | Replacing the `git_iterator` object, this creates a simple API for accessing the "patch" for any file pair in a diff list and then gives indexed access to the hunks in the patch and the lines in the hunk. This is the initial implementation of this revised API - it is still broken, but at least builds cleanly.
* Add missing accessor for fetchRecurseSubmodulesRussell Belfer2012-09-071-0/+20
| | | | | | When `git_submodule` became an opaque structure, I forgot to add accessor functions for the fetchRecurseSubmodules config setting. This fixes that.
* Diff iteratorsRussell Belfer2012-09-051-0/+1
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* Fix valgrind warnings and spurious error messagesRussell Belfer2012-08-241-0/+2
| | | | | | Just clean up valgrind warnings about uninitialized memory and also clear out errno in some cases where it results in a false error message being generated at a later point.
* Working implementation of git_submodule_statusRussell Belfer2012-08-241-191/+176
| | | | | | | | | | | | | This is a big redesign of the git_submodule_status API and the implementation of the redesigned API. It also fixes a number of bugs that I found in other parts of the submodule API while writing the tests for the status part. This also fixes a couple of bugs in the iterators that had not been noticed before - one with iterating when there is a gitlink (i.e. separate-work-dir) and one where I was treating anything even vaguely submodule-like as a submodule, more aggressively than core git does.
* Fix valgrind issues and leaksRussell Belfer2012-08-241-112/+115
| | | | | | This fixes up a number of problems flagged by valgrind and also cleans up the internal `git_submodule` allocation handling overall with a simpler model.
* Major submodule rewriteRussell Belfer2012-08-241-143/+1238
| | | | | This replaces the old submodule API with a new extended API that supports most of the things that can be done with `git submodule`.