diff options
| author | Russell Belfer <rb@github.com> | 2012-10-05 15:56:57 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-10-09 11:59:34 -0700 |
| commit | 0d64bef941928046d114c4da1acb70bd2907855e (patch) | |
| tree | 4ae0ac6484c62b0a63ca44f937d67ba15f97d7f0 /include/git2 | |
| parent | f3a04e0f49d0f46e578613d1c27161abc4c2bf22 (diff) | |
| download | libgit2-0d64bef941928046d114c4da1acb70bd2907855e.tar.gz | |
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.
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/checkout.h | 19 | ||||
| -rw-r--r-- | include/git2/diff.h | 7 | ||||
| -rw-r--r-- | include/git2/tree.h | 4 |
3 files changed, 25 insertions, 5 deletions
diff --git a/include/git2/checkout.h b/include/git2/checkout.h index ef3badbe9..fb1a23030 100644 --- a/include/git2/checkout.h +++ b/include/git2/checkout.h @@ -21,12 +21,27 @@ */ GIT_BEGIN_DECL -enum { +/** + * Checkout behavior flags + * + * These flags control what checkout does with files. Pass in a + * combination of these values OR'ed together. + * + * - GIT_CHECKOUT_DEFAULT: With this value, checkout does not update + * any files in the working directory. + * - GIT_CHECKOUT_OVERWRITE_MODIFIED: When a file exists and is modified, + * replace the modifications with the new version. + * - GIT_CHECKOUT_CREATE_MISSING: When a file does not exist in the + * working directory, create it. + * - GIT_CHECKOUT_REMOVE_UNTRACKED: If an untracked file in encountered + * in the working directory, delete it. + */ +typedef enum { GIT_CHECKOUT_DEFAULT = (1 << 0), GIT_CHECKOUT_OVERWRITE_MODIFIED = (1 << 1), GIT_CHECKOUT_CREATE_MISSING = (1 << 2), GIT_CHECKOUT_REMOVE_UNTRACKED = (1 << 3), -}; +} git_checkout_strategy_t; /* Use zeros to indicate default settings */ typedef struct git_checkout_opts { diff --git a/include/git2/diff.h b/include/git2/diff.h index 551e525ef..1d32d9ad2 100644 --- a/include/git2/diff.h +++ b/include/git2/diff.h @@ -56,6 +56,9 @@ GIT_BEGIN_DECL * - GIT_DIFF_DONT_SPLIT_TYPECHANGE: normally, a type change between files * will be converted into a DELETED record for the old file and an ADDED * record for the new one; this option enabled TYPECHANGE records. + * - GIT_DIFF_SKIP_BINARY_CHECK: the binary flag in the delta record will + * not be updated. This is useful if iterating over a diff without hunk + * and line callbacks and you want to avoid loading files completely. */ enum { GIT_DIFF_NORMAL = 0, @@ -73,7 +76,9 @@ enum { GIT_DIFF_DISABLE_PATHSPEC_MATCH = (1 << 11), GIT_DIFF_DELTAS_ARE_ICASE = (1 << 12), GIT_DIFF_INCLUDE_UNTRACKED_CONTENT = (1 << 13), - GIT_DIFF_DONT_SPLIT_TYPECHANGE = (1 << 14), + GIT_DIFF_SKIP_BINARY_CHECK = (1 << 14), + GIT_DIFF_INCLUDE_TYPECHANGE = (1 << 15), + GIT_DIFF_INCLUDE_TYPECHANGE_TREES = (1 << 16), }; /** diff --git a/include/git2/tree.h b/include/git2/tree.h index e5261417c..2ee1f4afa 100644 --- a/include/git2/tree.h +++ b/include/git2/tree.h @@ -100,7 +100,7 @@ GIT_EXTERN(git_tree_entry *) git_tree_entry_dup(const git_tree_entry *entry); * @param tree a previously loaded tree. * @return object identity for the tree. */ -GIT_EXTERN(const git_oid *) git_tree_id(git_tree *tree); +GIT_EXTERN(const git_oid *) git_tree_id(const git_tree *tree); /** * Get the number of entries listed in a tree @@ -108,7 +108,7 @@ GIT_EXTERN(const git_oid *) git_tree_id(git_tree *tree); * @param tree a previously loaded tree. * @return the number of entries in the tree */ -GIT_EXTERN(unsigned int) git_tree_entrycount(git_tree *tree); +GIT_EXTERN(unsigned int) git_tree_entrycount(const git_tree *tree); /** * Lookup a tree entry by its filename |
