Commit Graph

585 Commits

Author SHA1 Message Date
Russell Belfer
fe67e404da Move enum comments next to actual values 2012-10-09 14:35:24 -07:00
Russell Belfer
0d64bef941 Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the
"typechanges" test repository, but that revealed numerous issues
with checkout, including:

* complete failure with submodules
* failure to create blobs with exec bits
* problems when replacing a tree with a blob because the tree
  "example/" sorts after the blob "example" so the delete was
  being processed after the single file blob was created

This fixes most of those problems and includes a number of other
minor changes that made it easier to do that, including improving
the TYPECHANGE support in diff/status, etc.
2012-10-09 11:59:34 -07:00
Russell Belfer
95f5f1e63a Cleanup TYPECHANGE support
This is just some cleanup code, rearranging some of the checkout
code where TYPECHANGE support was added and adding some comments
to the diff header regarding the constants.
2012-10-09 11:54:01 -07:00
Russell Belfer
bc16fd3ebf Introduce status/diff TYPECHANGE flags
When I wrote the diff code, I based it on core git's diff output
which tends to split a type change into an add and a delete.  But
core git's status has the notion of a T (typechange) flag for a
file.  This introduces that into our status APIs and modifies the
diff code so it can be forced to not split type changes.
2012-10-09 11:54:01 -07:00
Vicent Martí
21e0d297af Merge pull request #967 from arrbee/diff-submodule-tests-and-fixes
Diff submodule tests and fixes
2012-10-09 11:45:50 -07:00
Russell Belfer
5d1308f25f Add test for diffs with submodules and bug fixes
The adds a test for the submodule diff capabilities and then
fixes a few bugs with how the output is generated.  It improves
the accuracy of OIDs in the diff delta object and makes the
submodule output more closely mirror the OIDs that will be used
by core git.
2012-10-08 15:22:40 -07:00
Russell Belfer
dfbff793b8 Fix a few diff bugs with directory content
There are a few cases where diff should leave directories in
the diff list if we want to match core git, such as when the
directory contains a .git dir.  That feature was lost when I
introduced some of the new submodule handling.

This restores that and then fixes a couple of related to diff
output that are triggered by having diffs with directories in
them.

Also, this adds a new flag that can be passed to diff if you
want diff output to actually include the file content of any
untracked files.
2012-10-08 15:22:40 -07:00
nulltoken
0c78f685eb branch: introduce git_branch_is_head() 2012-10-07 21:03:51 +02:00
Russell Belfer
eada0762dd Merge pull request #939 from pwkelley/ignorecase
Support for the core.ignorecase flag
2012-10-02 10:45:40 -07:00
Carlos Martín Nieto
3230a44f4c remote: support downloading all tags
Also honor remote.$name.tagopt = --tags.
2012-09-30 12:05:28 +02:00
Carlos Martín Nieto
f70e466f68 remote: add accessors for the autotag setting 2012-09-30 12:04:49 +02:00
Carlos Martín Nieto
24f2f94e7d fetch: use the include-tag capability
This tells the remote to send us any tags that point to objects that
we are downloading.
2012-09-30 11:56:38 +02:00
Carlos Martín Nieto
3665ba8eeb refspec: add git_refspec__free, remove git_refspec_parse
The latter shouldn't be exposed and isn't used, git_refspec__parse
supersedes it.

Fix a leak in the refspec tests while we're at it.
2012-09-30 11:56:37 +02:00
Russell Belfer
bae957b95d Add const to all shared pointers in diff API
There are a lot of places where the diff API gives the user access
to internal data structures and many of these were being exposed
through non-const pointers.  This replaces them all with const
pointers for any object that the user can access but is still
owned internally to the git_diff_list or git_diff_patch objects.

This will probably break some bindings...  Sorry!
2012-09-25 16:35:05 -07:00
Russell Belfer
6428630865 Fix bugs in new diff patch code
This fixes all the bugs in the new diff patch code.  The only
really interesting one is that when we merge two diffs, we now
have to actually exclude diff delta records that are not supposed
to be tracked, as opposed to before where they could be included
because they would be skipped silently by `git_diff_foreach()`.
Other than that, there are just minor errors.
2012-09-25 16:35:05 -07:00
Russell Belfer
5f69a31f7d Initial implementation of new diff patch API
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.
2012-09-25 16:35:05 -07:00
Russell Belfer
9a12a6256e New take on iterating over diff content
Allow diff deltas to be accessed by index and make patch generation
explicit with hunk and line access by index as well.
2012-09-25 16:35:05 -07:00
Vicent Martí
5942bd18bf Merge pull request #947 from arrbee/public-error-set
Make giterr_set_str() and giterr_set_oom() public APIs
2012-09-25 14:53:13 -07:00
nulltoken
77e06d7e85 refs: introduce git_reference_is_valid_name() 2012-09-25 07:49:15 +02:00
nulltoken
c030ada7ff refs: make git_reference_normalize_name() accept refspec pattern 2012-09-25 07:49:14 +02:00
Sven Strickroth
f55af775ab Make clear that git_odb_hashfile does not use filters
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-22 01:16:10 +02:00
Russell Belfer
1a62810053 Make giterr_set_str public
There has been discussion for a while about making some set of
the `giterr_set` type functions part of the public API for code
that is implementing new backends to libgit2.  This makes the
`giterr_set_str()` and `giterr_set_oom()` functions public.
2012-09-21 15:04:39 -07:00
nulltoken
9e592583fc checkout: add notification callback for skipped files 2012-09-21 08:08:29 +02:00
Philip Kelley
ec40b7f99f Support for core.ignorecase 2012-09-17 15:42:41 -04:00
nulltoken
397837197d checkout: Mimic git_diff_options storage of paths 2012-09-17 20:27:28 +02:00
nulltoken
44af67a8b6 repository: introduce git_repository_set_head() 2012-09-17 10:48:35 +02:00
nulltoken
4ebe38bd58 repository: introduce git_repository_set_head_detached() 2012-09-17 10:48:35 +02:00
nulltoken
3f4c3072ea repository: introduce git_repository_detach_head() 2012-09-17 10:48:34 +02:00
nulltoken
cc548c7b0f repository: fix documentation typo 2012-09-17 10:48:33 +02:00
nulltoken
5af61863dd checkout: drop git_checkout_reference() 2012-09-17 10:48:30 +02:00
nulltoken
c214fa1caf checkout: segregate checkout strategies 2012-09-17 10:48:30 +02:00
nulltoken
ee8bb8ba64 reset: add support for GIT_RESET_HARD mode 2012-09-17 10:48:28 +02:00
nulltoken
e93af30411 checkout: introduce git_checkout_index() 2012-09-17 10:48:27 +02:00
nulltoken
3aa443a951 checkout: introduce git_checkout_tree() 2012-09-17 10:48:26 +02:00
Vicent Martí
9be2261eaa Merge pull request #927 from arrbee/hashfile-with-filters
Add git_repository_hashfile to hash with filters
2012-09-13 09:24:12 -07:00
Russell Belfer
a13fb55afd Add tests and improve param checks
Fixed some minor `git_repository_hashfile` issues:

- Fixed incorrect doc (saying that repo could be NULL)
- Added checking of object type value to acceptable ones
- Added more tests for various parameter permutations
2012-09-11 17:26:21 -07:00
Russell Belfer
47bfa0be6d Add git_repository_hashfile to hash with filters
The existing `git_odb_hashfile` does not apply text filtering
rules because it doesn't have a repository context to evaluate
the correct rules to apply.  This adds a new hashfile function
that will apply repository-specific filters (based on config,
attributes, and filename) before calculating the hash.
2012-09-11 15:01:09 -07:00
Vicent Martí
21d847d38f Merge pull request #920 from scunz/mergebase_const
git_mergebase: Constness-Fix for consistency
2012-09-11 14:56:13 -07:00
Vicent Marti
412293dcc9 Merge branch 'diff-crlf-filters' into development 2012-09-11 23:38:16 +02:00
Russell Belfer
1f35e89dbf Fix diff binary file detection
In the process of adding tests for the max file size threshold
(which treats files over a certain size as binary) there seem to
be a number of problems in the new code with detecting binaries.
This should fix those up, as well as add a test for the file
size threshold stuff.

Also, this un-deprecates `GIT_DIFF_LINE_ADD_EOFNL`, since I
finally found a legitimate situation where it would be returned.
2012-09-11 12:03:33 -07:00
Russell Belfer
eff14d384c Merge pull request #906 from nulltoken/topic/git_reference_peel
git reference peel
2012-09-10 23:15:54 -07:00
Russell Belfer
e597b1890e Move diff max_size to public API
This commit adds a max_size value in the public `git_diff_options`
structure so that the user can automatically flag blobs over a
certain size as binary regardless of other properties.

Also, and perhaps more importantly, this moves binary detection
to be as early as possible in the diff traversal inner loop and
makes sure that we stop loading objects as soon as we decide that
they are binary.
2012-09-10 11:49:12 -07:00
Russell Belfer
b36effa22e Replace git_diff_iterator_num_files with progress
The `git_diff_iterator_num_files` API was problematic, since we
don't actually know the exact number of files to be iterated over
until we load those files into memory.  This replaces it with a
new `git_diff_iterator_progress` API that goes from 0 to 1, and
moves and renamed the old API for the internal places that can
tolerate a max value instead of an exact value.
2012-09-10 09:59:14 -07:00
Sascha Cunz
857323d4db git_mergebase: Constness-Fix for consistency 2012-09-09 15:53:57 +02:00
Russell Belfer
17b06f4d47 Add missing accessor for fetchRecurseSubmodules
When `git_submodule` became an opaque structure, I forgot to add
accessor functions for the fetchRecurseSubmodules config setting.
This fixes that.
2012-09-07 15:49:08 -07:00
Russell Belfer
8f9b6a132b Better header comments 2012-09-06 15:34:02 -07:00
nulltoken
746642a6b3 checkout: fix documentation code alignment 2012-09-06 18:40:08 +02:00
nulltoken
bb2d305c20 errors: introduce GIT_EBAREREPO 2012-09-06 18:40:06 +02:00
nulltoken
316659489a refs: introduce git_reference_peel()
Fix #530
2012-09-06 18:40:05 +02:00
Vicent Martí
7a3fc9fb17 Merge pull request #900 from pwkelley/development
Expose a malloc function to 3rd party ODB backends
2012-09-06 01:17:23 -07:00