|
b747eb14
|
2014-01-29T12:55:33
|
|
Give index_isrch the same semantics as index_srch
In case insensitive index mode, we would stop at a prefixed entry,
treating the provided search key length as a substring, not the
length of the string to match.
|
|
1eefd356
|
2014-01-29T18:44:29
|
|
index: Implement folder-file checks
|
|
53bec813
|
2014-01-29T18:17:08
|
|
index: Compare with given len
|
|
d541170c
|
2014-01-24T11:36:41
|
|
index: rename an entry's id to 'id'
This was not converted when we converted the rest, so do it now.
|
|
26c1cb91
|
2013-12-09T09:44:03
|
|
One more rename/cleanup for callback err functions
|
|
25e0b157
|
2013-12-06T15:07:57
|
|
Remove converting user error to GIT_EUSER
This changes the behavior of callbacks so that the callback error
code is not converted into GIT_EUSER and instead we propagate the
return value through to the caller. Instead of using the
giterr_capture and giterr_restore functions, we now rely on all
functions to pass back the return value from a callback.
To avoid having a return value with no error message, the user
can call the public giterr_set_str or some such function to set
an error message. There is a new helper 'giterr_set_callback'
that functions can invoke after making a callback which ensures
that some error message was set in case the callback did not set
one.
In places where the sign of the callback return value is
meaningful (e.g. positive to skip, negative to abort), only the
negative values are returned back to the caller, obviously, since
the other values allow for continuing the loop.
The hardest parts of this were in the checkout code where positive
return values were overloaded as meaningful values for checkout.
I fixed this by adding an output parameter to many of the internal
checkout functions and removing the overload. This added some
code, but it is probably a better implementation.
There is some funkiness in the network code where user provided
callbacks could be returning a positive or a negative value and
we want to rely on that to cancel the loop. There are still a
couple places where an user error might get turned into GIT_EUSER
there, I think, though none exercised by the tests.
|
|
dab89f9b
|
2013-12-04T21:22:57
|
|
Further EUSER and error propagation fixes
This continues auditing all the places where GIT_EUSER is being
returned and making sure to clear any existing error using the
new giterr_user_cancel helper. As a result, places that relied
on intercepting GIT_EUSER but having the old error preserved also
needed to be cleaned up to correctly stash and then retrieve the
actual error.
Additionally, as I encountered places where error codes were not
being propagated correctly, I tried to fix them up. A number of
those fixes are included in the this commit as well.
|
|
bd15b513
|
2013-11-19T13:24:10
|
|
index: Free the index on git_index_open() failure
|
|
1d3a8aeb
|
2013-11-04T18:28:57
|
|
move mode_t to filebuf_open instead of _commit
|
|
8e5a8ef8
|
2013-11-01T09:51:01
|
|
Convert git_index_read to have a "force" flag
This is a little more intuitive than the turned-around option that
I originally wrote.
|
|
4bf630b6
|
2013-10-31T14:36:52
|
|
Make diff and status perform soft index reload
This changes `git_index_read` to have two modes - a hard index
reload that always resets the index to match the on-disk data
(which was the old behavior) and a soft index reload that uses
the timestamp / file size information and only replaces the index
data if the file on disk has been modified.
This then updates the git_status code to do a soft reload unless
the new GIT_STATUS_OPT_NO_REFRESH flag is passed in.
This also changes the behavior of the git_diff functions that use
the index so that when an index is not explicitly passed in (i.e.
when the functions call git_repository_index for you), they will
also do a soft reload for you.
This intentionally breaks the file signature of git_index_read
because there has been some confusion about the behavior previously
and it seems like all existing uses of the API should probably be
examined to select the desired behavior.
|
|
95c148b2
|
2013-10-08T17:03:12
|
|
Merge pull request #1886 from libgit2/precompose-utf8
Add support for core.precomposeunicode on Mac
|
|
14997dc5
|
2013-10-08T12:45:43
|
|
More filemode cleanups for FAT on MacOS
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.
|
|
da7b78fa
|
2013-10-04T14:03:12
|
|
index: Make _read() cope with index file creation
|
|
1ca3e49f
|
2013-09-23T13:34:01
|
|
Clean up newly introduced warnings
The attempt to "clean up warnings" seems to have introduced some
new warnings on compliant compilers. This fixes those in a way
that I suspect will also be okay for the non-compliant compilers.
Also this fixes what appears to be an extra semicolon in the
repo initialization template dir handling (and as part of that
fix, handles the case where an error occurs correctly).
|
|
66566516
|
2013-09-08T17:15:42
|
|
Fix warning
|
|
f240acce
|
2013-09-05T11:20:12
|
|
Add more file mode permissions macros
This adds some more macros for some standard operations on file
modes, particularly related to permissions, and then updates a
number of places around the code base to use the new macros.
|
|
3d276874
|
2013-08-19T10:30:44
|
|
index: report when it's locked
Report the index being locked with its own error code in order to be
able to differentiate, as a locked index is typically the result of a
crashed process or concurrent access, both of which often require user
intervention to fix.
|
|
57f31f05
|
2013-08-08T11:05:00
|
|
Fixes to safely reading the index
Avoid wrapping around extension size when reading, avoid walking off
the end of the buffer when reading names.
|
|
a16e4172
|
2013-07-25T12:27:39
|
|
Fix rename detection to use actual blob size
The size data in the index may not reflect the actual size of the
blob data from the ODB when content filtering comes into play.
This commit fixes rename detection to use the actual blob size when
calculating data signatures instead of the value from the index.
Because of a misunderstanding on my part, I first converted the
git_index_add_bypath API to use the post-filtered blob data size
in creating the index entry. I backed that change out, but I
kept the overall refactoring of that routine and the new internal
git_blob__create_from_paths API because it eliminates an extra
stat() call from the code that adds a file to the index.
The existing tests actually cover this code path, at least when
running on Windows, so at this point I'm not adding new tests to
cover the changes.
|
|
8d6ef4bf
|
2013-07-15T15:59:35
|
|
index: fix potential memory leaks
|
|
41f1f9d7
|
2013-06-27T16:52:00
|
|
Add API to get path to index file
|
|
d2ce27dd
|
2013-06-24T23:16:06
|
|
Add public API for pathspec matching
This adds a new public API for compiling pathspecs and matching
them against the working directory, the index, or a tree from the
repository. This also reworks the pathspec internals to allow the
sharing of code between the existing internal usage of pathspec
matching and the new external API.
While this is working and the new API is ready for discussion, I
think there is still an incorrect behavior in which patterns are
always matched against the full path of an entry without taking
the subdirectories into account (so "s*" will match "subdir/file"
even though it wouldn't with core Git). Further enhancements are
coming, but this was a good place to take a functional snapshot.
|
|
178aa39c
|
2013-07-03T11:42:43
|
|
Be more thread aware with some index updates
The index isn't really thread safe for the most part, but we can
easily be more careful and avoid double frees and the like, which
are serious problems (as opposed to a lookup which might return
the incorrect value but if the index in being updated, that is
much harder to avoid).
|
|
22b6b82f
|
2013-06-20T12:16:06
|
|
Add status flags to force output sort order
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.
|
|
7863523a
|
2013-06-19T15:54:19
|
|
Add tests and fix use of freed memory
This adds some tests for updating the index and having it remove
items to make sure that the iteration over the index still works
even as earlier items are removed.
In testing with valgrind, this found a path that would use the
path string from the index entry after it had been freed. The
bug fix is simply to copy the path of the index entry before
doing any actual index manipulation.
|
|
f30fff45
|
2013-06-19T15:27:25
|
|
Add index pathspec-based operations
This adds three new public APIs for manipulating the index:
1. `git_index_add_all` is similar to `git add -A` and will add
files in the working directory that match a pathspec to the
index while honoring ignores, etc.
2. `git_index_remove_all` removes files from the index that match
a pathspec.
3. `git_index_update_all` updates entries in the index based on
the current contents of the working directory, either added
the new information or removing the entry from the index.
|
|
6ea999bb
|
2013-06-13T15:52:12
|
|
Make index_insert keep existing case
In a case insensitive index, if you attempt to add a file from
disk with a different case pattern, the old case pattern in the
index should be preserved.
This fixes that (and a couple of minor warnings).
|
|
6de9b2ee
|
2013-06-12T21:10:33
|
|
util: It's called `memzero`
|
|
eb58e2d0
|
2013-06-12T21:05:48
|
|
Merge remote-tracking branch 'arrbee/minor-paranoia' into development
|
|
2f77d8f1
|
2013-06-10T14:16:56
|
|
Fix some memory leaks
|
|
3e9e6cda
|
2013-06-07T09:54:33
|
|
Add safe memset and use it
This adds a `git__memset` routine that will not be optimized away
and updates the places where I memset() right before a free() call
to use it.
|
|
03a89070
|
2013-05-31T21:49:40
|
|
Make git_index_read_tree preserve stat cache
Instead of just blowing away the stat cache data when loading a
new tree into the index, this checks if each loaded item has a
corresponding existing item with the same OID and if so, copies
the stat data from the old item to the new one so it will not be
blown away.
|
|
f658dc43
|
2013-05-31T14:09:58
|
|
Zero memory for major objects before freeing
By zeroing out the memory when we free larger objects (i.e. those
that serve as collections of other data, such as repos, odb, refdb),
I'm hoping that it will be easier for libgit2 bindings to find
errors in their object management code.
|
|
8c2458be
|
2013-05-31T11:41:33
|
|
improve test for index extension truncation
|
|
43efc449
|
2013-05-16T11:03:55
|
|
Ensure reuc vector is always valid
In theory, if there was a problem reading the REUC data, the
read_reuc() routine could have left uninitialized and invalid
data in the git_index vector. This moves the line that inserts a
new entry into the vector down to the bottom of the routine so we
know all the content is already valid. Also, per @linquize, this
uses calloc to ensure no uninitialized data.
|
|
0e0108f7
|
2013-05-17T15:59:57
|
|
introduce git_conflict_iterator
|
|
57908bb3
|
2013-05-16T11:03:55
|
|
Ensure reuc vector is always valid
In theory, if there was a problem reading the REUC data, the
read_reuc() routine could have left uninitialized and invalid
data in the git_index vector. This moves the line that inserts a
new entry into the vector down to the bottom of the routine so we
know all the content is already valid. Also, per @linquize, this
uses calloc to ensure no uninitialized data.
|
|
96c01991
|
2013-05-15T09:24:51
|
|
Remove entry dup/free functions and fix comments
This removes the functions to duplicate and free copies of a
git_index_entry and updates the comments to explain that you
should just use the public definition of the struct as needed.
|
|
797dfb28
|
2013-05-13T16:09:33
|
|
Add APIs to dup and free git_index_entrys
This adds git_index_entry_dup to make a copy of an existing entry
and git_index_entry_free to release the memory of the copy. It
also updates the documentation for git_index_get_bypath and
git_index_get_byindex to make it clear that the returned structure
should *not* be modified.
|
|
71596200
|
2013-05-15T15:47:46
|
|
Merge pull request #1588 from arrbee/fixes-for-checkout-and-diff
Bug fixes for checkout and diff
|
|
72b3dd4a
|
2013-05-15T15:23:33
|
|
Use GIT_IDXENTRY_STAGE macro
Since I added the GIT_IDXENTRY_STAGE macro to extract the stage
from a git_index_entry, we probably don't need an internal inline
function to do the same thing.
|
|
dcb0f7c0
|
2013-05-15T14:54:02
|
|
Fix checkout of submodules with no .gitmodules
It is possible for there to be a submodule in a repository with
no .gitmodules file (for example, if the user forgot to commit
the .gitmodules file). In this case, core Git will just create
an empty directory as a placeholder for the submodule but
otherwise ignore it. We were generating an error and stopping
the checkout. This makes our behavior match that of core git.
|
|
1fed6b07
|
2013-05-13T21:57:37
|
|
Fix trailing whitespaces
|
|
03c28d92
|
2013-05-06T06:45:53
|
|
Merge pull request #1526 from arrbee/cleanup-error-return-without-msg
Make sure error messages are set for most error returns
|
|
d8041638
|
2013-05-02T17:22:13
|
|
fix some leaks
|
|
81b7dec4
|
2013-05-02T03:06:34
|
|
Fix some compile warnings and trailing whitespace
|
|
e1807113
|
2013-05-01T15:31:23
|
|
merge: Warning noise
|
|
ae99f5e2
|
2013-05-01T04:57:24
|
|
Make sure error messages get set
|
|
75d1c8c6
|
2013-04-30T17:33:11
|
|
move NAME and REUC extensions to sys/
|
|
0462fba5
|
2013-04-30T14:56:41
|
|
renames!
|
|
bec65a5e
|
2013-04-01T22:16:21
|
|
merge!
|
|
b7f167da
|
2013-04-29T13:52:12
|
|
Make git_oid_cmp public and add git_oid__cmp
|
|
eac76c23
|
2013-04-22T14:27:36
|
|
Use config cache where possible
This converts many of the config lookups that are done around the
library to use the repository config cache. This was everything I
could find that wasn't part of diff (which requires a larger fix).
|
|
2aee1aa4
|
2013-04-18T14:35:13
|
|
Fix uninitialized var warnings
|
|
10c06114
|
2013-03-17T04:46:46
|
|
Several warnings detected by static code analyzer fixed
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
|
|
169dc616
|
2013-03-05T16:10:05
|
|
Make iterator APIs consistent with standards
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.
|
|
b8daa9e0
|
2013-03-04T16:19:38
|
|
Merge pull request #1380 from phkelley/index_icase
Disable ignore_case when writing the index to a tree
|
|
5bddabcc
|
2013-03-04T17:40:48
|
|
clear REUC on checkout
|
|
cb53669e
|
2013-03-01T16:38:13
|
|
Rename function to __ prefix
|
|
3f0d0c85
|
2013-03-01T15:44:18
|
|
Disable ignore_case when writing the index to a tree
|
|
eb5ffd19
|
2013-02-21T11:00:29
|
|
add a sorter to the reuc on index creation
|
|
390a3c81
|
2013-02-11T11:44:00
|
|
Merge pull request #1190 from nulltoken/topic/reset-paths
reset: Allow the selective reset of pathspecs
|
|
943700ec
|
2013-01-18T16:37:13
|
|
Return the matched pathspec pattern in `git_pathspec_match_path`
Instead of returning directly the pattern as the return value, I used an
out parameter, because the function also tests if the passed pathspecs
vector is empty. If yes, it considers that the path "matches", but in
that case there is no matched pattern per se.
|
|
3cf58e66
|
2013-01-15T16:12:12
|
|
index: Fix indentations
|
|
11d9f6b3
|
2013-01-27T14:17:07
|
|
Vector improvements and their fallout
|
|
5425097f
|
2013-01-24T18:53:08
|
|
index: Speed up loading a tree into the index
The index is empty; repeated tree entries cannot collide.
cc github/gitrpc#83
|
|
25743bd7
|
2013-01-12T13:47:56
|
|
add an index_remove_bypath that removes conflicts, renamed add_from_workdir to match
|
|
eb3c247a
|
2013-01-10T11:56:02
|
|
REUC needs to handle empty sides
|
|
359fc2d2
|
2013-01-08T17:07:25
|
|
update copyrights
|
|
7fc00435
|
2013-01-03T15:48:52
|
|
Add index API to remove all files in a directory
This adds the git_index_remove_directory API plus tests.
|
|
6fee906c
|
2012-12-18T15:13:11
|
|
missing error message is confusing
|
|
27fe6efe
|
2013-01-04T13:48:08
|
|
Fix git_index sorting with core.ignorecase in git_index_read
|
|
e759b072
|
2012-12-12T17:54:12
|
|
don't walk off the end of the index
|
|
9950d27a
|
2012-12-06T13:26:58
|
|
Clean up iterator APIs
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.
|
|
a8122b5d
|
2012-11-21T15:39:03
|
|
Fix warnings on Win64 build
|
|
4604a654
|
2012-11-21T11:57:06
|
|
update internal index API to avoid cast
|
|
16248ee2
|
2012-11-21T11:03:07
|
|
Fix up some missing consts in tree & index
This fixes some missed places where we can apply const-ness to
various public APIs.
There are still some index and tree APIs that cannot take const
pointers because we sort our `git_vectors` lazily and so we can't
reliably bsearch the index and tree content without applying a
`git_vector_sort()` first.
This also fixes some missed places where size_t can be used and
where const can be applied to a couple internal functions.
|
|
f45d51ff
|
2012-11-20T19:57:46
|
|
API updates for index.h
|
|
e120123e
|
2012-11-20T14:01:46
|
|
API review / update for tree.h
|
|
cfbe4be3
|
2012-11-17T19:54:47
|
|
More external API cleanup
Conflicts:
src/branch.c
tests-clar/refs/branches/create.c
|
|
bad68c0a
|
2012-11-13T14:02:59
|
|
Add iterator for git_index object
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).
|
|
6132a54e
|
2012-11-13T16:13:10
|
|
Fix a few valgrind errors
|
|
aa1c3b58
|
2012-11-13T14:13:47
|
|
Merge pull request #1016 from arrbee/fix-checkout-dir-removal
Update checkout with new strategies & behavior
|
|
d18713fb
|
2012-11-10T20:24:53
|
|
Merge pull request #1056 from nulltoken/duplicate-tree-entries
Duplicate tree entries
|
|
95d73de1
|
2012-11-10T21:10:49
|
|
index: prefer INDEX_OWNER usage
|
|
33f95a9b
|
2012-11-10T21:01:05
|
|
index: refine add_from_workdir() error report
|
|
69c068c7
|
2012-11-10T20:42:45
|
|
index: make git_index_new() work with a NULL path
|
|
757b4065
|
2012-11-09T14:01:44
|
|
Fix warnings and valgrind issues
This fixes some various warnings that showed up in Travis and
a couple uses of uninitialized memory and one memory leak.
|
|
ad9a921b
|
2012-11-08T17:05:07
|
|
Rework checkout with new strategy options
This is a major reworking of checkout strategy options. The
checkout code is now sensitive to the contents of the HEAD tree
and the new options allow you to update the working tree so that
it will match the index content only when it previously matched
the contents of the HEAD. This allows you to, for example, to
distinguish between removing files that are in the HEAD but not
in the index, vs just removing all untracked files.
Because of various corner cases that arise, etc., this required
some additional capabilities in rmdir and other utility functions.
This includes the beginnings of an implementation of code to read
a partial tree into the index based on a pathspec, but that is
not enabled because of the possibility of creating conflicting
index entries.
|
|
55cbd05b
|
2012-11-08T16:56:34
|
|
Some diff refactorings to help code reuse
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.
|
|
7cc1bf0f
|
2012-11-08T21:08:59
|
|
index: Introduce git_index_has_conflicts()
|
|
050cf8b8
|
2012-11-02T01:01:21
|
|
freeing index entries would be helpful
|
|
1e808f9c
|
2012-11-01T20:28:28
|
|
index: Add `git_index_new`
|
|
43eeca04
|
2012-11-01T20:24:43
|
|
index: Fix tests
|
|
276ea401
|
2012-11-01T20:15:53
|
|
index: Add git_index_write_tree
|
|
8ff0f325
|
2012-10-31T22:26:57
|
|
index: Switch to git_futils_filestamp
|
|
744cc03e
|
2012-10-30T12:10:36
|
|
Add git_config_refresh() API to reload config
This adds a new API that allows users to reload the config if the
file has changed on disk. A new config callback function to
refresh the config was added.
The modified time and file size are used to test if the file needs
to be reloaded (and are now stored in the disk backend object).
In writing tests, just using mtime was a problem / race, so I
wanted to check file size as well. To support that, I extended
`git_futils_readbuffer_updated` to optionally check file size in
addition to mtime, and I added a new function `git_filebuf_stats`
to fetch the mtime and size for an open filebuf (so that the
config could be easily refreshed after a write).
Lastly, I moved some similar file checking code for attributes
into filebuf. It is still only being used for attrs, but it
seems potentially reusable, so I thought I'd move it over.
|
|
f45ec1a0
|
2012-10-29T20:04:21
|
|
index refactoring
|
|
b1be9dd0
|
2012-10-03T12:09:17
|
|
index: introduce git_index_owner()
|