include/git2/index.h


Log

Author Commit Date CI Message
Leo Yang c097f717 2015-08-17T15:02:02 New API: git_index_find_prefix Find the first index entry matching a prefix.
Carlos Martín Nieto 5e947c91 2015-06-19T22:05:08 index: use the checksum to check whether it's been modified We currently use a timetamp to check whether an index file has been modified since we last read it, but this is racy. If two updates happen in the same second and we read after the first one, we won't detect the second one. Instead read the SHA-1 checksum of the file, which are its last 20 bytes which gives us a sure-fire way to detect whether the file has changed since we last read it. As we're now keeping track of it, expose an accessor to this data.
Edward Thomson 9f545b9d 2015-05-19T11:23:59 introduce `git_index_entry_is_conflict` It's not always obvious the mapping between stage level and conflict-ness. More importantly, this can lead otherwise sane people to write constructs like `if (!git_index_entry_stage(entry))`, which (while technically correct) is unreadable. Provide a nice method to help avoid such messy thinking.
Edward Thomson ecd60a56 2015-05-14T11:52:48 conflicts: when adding conflicts, remove staged When adding a conflict for some path, remove the staged entry. Otherwise, an illegal index (with both stage 0 and high-stage entries) would result.
Carlos Martín Nieto ca294279 2015-05-12T11:43:27 index: make the entries have more accurate sizes While we are confident about the size of an int in architectures we're likely to care about, the index format is defined by the exact size of the fields. Use the definitions which show the exact width of the entry fields. As part of that, bring back 32-bit time and size fields, which currently are 64 bits wide and can bring a false sense of security in how much data they really store. Document that these fields are not to be taken as authoritative.
Pierre-Olivier Latour 807566d5 2015-04-03T18:59:11 Entry argument passed to git_index_add_frombuffer() should be const
Damien PROFETA a275fbc0 2015-02-05T11:40:16 Add API to add a memory buffer to an index git_index_add_frombuffer enables now to store a memory buffer in the odb and to store an entry in the index directly if the index is attached to a repository.
Carlos Martín Nieto a295bd2d 2014-12-06T03:36:18 doc: add documentation to all the public structs and enums This makes them show up in the reference, even if the text itself isn't the most descriptive. These have been found with grep -Przon '\n\ntypedef struct.*?\{' -- include grep -Przon '\n\ntypedef enum.*?\{' -- include
Carlos Martín Nieto dedfc734 2014-06-02T19:21:24 index: split GIT_IDXENTRY into two flag enums The documentation has shown this as a single enum for a long time. These should in fact be two enums. One with the bits for the flags and another with the bits for the extended flags.
Carlos Martín Nieto 11e2665e 2014-06-02T18:53:32 Formatting fixes for the docs These are some issues I found while playing around with the new parser for docurium.
Russell Belfer 0fc8e1f6 2014-04-28T14:34:55 Lay groundwork for updating stat cache in diff This reorganized the diff OID calculation to make it easier to correctly update the stat cache during a diff once the flags to do so are enabled. This includes marking the path of a git_index_entry as const so we can make a "fake" git_index_entry with a "const char *" path and not get warnings. I was a little surprised at how unobtrusive this change was, but I think it's probably a good thing.
Russell Belfer aba6b5ed 2014-03-14T21:59:26 Fix leak in git_index_conflict_cleanup I introduced a leak into conflict cleanup by removing items from inside the git_vector_remove_matching call. This simplifies the code to just use one common way for the two conflict cleanup APIs. When an index has an active snapshot, removing an item can cause an error (inserting into the deferred deletion vector), so I made the git_index_conflict_cleanup API return an error code. I felt like this wasn't so bad since it is just like the other APIs. I fixed up a couple of comments while I was changing the header.
Russell Belfer 3dbee456 2014-02-07T14:10:35 Some index internals refactoring Again, laying groundwork for some index iterator changes, this contains a bunch of code refactorings for index internals that should make it easier down the line to add locking around index modifications. Also this removes the redundant prefix_position function and fixes some potential memory leaks.
Jacques Germishuys 3b4ba278 2014-04-03T15:50:21 Const correctness!
Rob Rix ddc66e27 2014-04-02T08:02:43 Give the correct name for the function in the doc. Per @carlosmn, git_index_add is now named git_index_add_bypath.
Rob Rix bb439de0 2014-04-01T16:37:19 Correct a stale reference to GIT_EBAREINDEX
Russell Belfer 72556cc6 2014-02-20T14:27:10 Address PR comments * Make GIT_INLINE an internal definition so it cannot be used in public headers * Fix language in CONTRIBUTING * Make index caps API use signed instead of unsigned values
Carlos Martín Nieto 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.
Russell Belfer 373cf6a9 2013-12-09T10:17:47 Update docs for new callback return value behavior
Russell Belfer 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.
Russell Belfer 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.
nulltoken 6445ae99 2013-10-04T13:49:26 index: Enhance documentation
Russell Belfer 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).
Linquize 66566516 2013-09-08T17:15:42 Fix warning
Russell Belfer 41f1f9d7 2013-06-27T16:52:00 Add API to get path to index file
Russell Belfer 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.
Andreas Linde e1967164 2013-06-24T15:33:41 Fixed most documentation header bugs Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode. The following warnings have not been fixed: common.h:213 - Not sure how the documentation format is for '...' notes.h:102 - Correct @param name but empty text notes.h:111 - Correct @param name but empty text pack.h:140 - @return missing text pack.h:148 - @return missing text
Russell Belfer 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.
Edward Thomson 0e0108f7 2013-05-17T15:59:57 introduce git_conflict_iterator
Russell Belfer 89251b28 2013-05-15T16:25:11 Update index.h docs Move the git_index_entry to the very top, since it provides the main structure that needs to be understood by the reader, then move the bitmasks for the flags and the flags_extended under that since they are details for looking at particular fields of the structure.
Russell Belfer 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.
Russell Belfer 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.
Russell Belfer 487884a9 2013-05-13T16:07:29 Improve docs for git_index_entry flag masks The constants for extracting data from git_index_entry flags and flags_extended are not named in a way that makes it easy to know where to use each one. This improves the docs for the flags (and slightly reorganizes them), so it should be more obvious.
Russell Belfer 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.
Edward Thomson 75d1c8c6 2013-04-30T17:33:11 move NAME and REUC extensions to sys/
Edward Thomson 0462fba5 2013-04-30T14:56:41 renames!
Edward Thomson bec65a5e 2013-04-01T22:16:21 merge!
Edward Thomson 5bddabcc 2013-03-04T17:40:48 clear REUC on checkout
nulltoken 3f0ed118 2013-01-15T11:03:05 index: Enhance documentation
Philip Kelley 11d9f6b3 2013-01-27T14:17:07 Vector improvements and their fallout
Edward Thomson 25743bd7 2013-01-12T13:47:56 add an index_remove_bypath that removes conflicts, renamed add_from_workdir to match
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Russell Belfer 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.
Russell Belfer a8122b5d 2012-11-21T15:39:03 Fix warnings on Win64 build
Russell Belfer 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.
Ben Straub f45d51ff 2012-11-20T19:57:46 API updates for index.h
nulltoken f92bcaea 2012-11-08T17:39:23 index: prevent tree creation from a non merged state Fix libgit2/libgit2sharp#243
nulltoken 7cc1bf0f 2012-11-08T21:08:59 index: Introduce git_index_has_conflicts()
Vicent Marti 1e808f9c 2012-11-01T20:28:28 index: Add `git_index_new`
Vicent Marti 276ea401 2012-11-01T20:15:53 index: Add git_index_write_tree
Edward Thomson f45ec1a0 2012-10-29T20:04:21 index refactoring
nulltoken b1be9dd0 2012-10-03T12:09:17 index: introduce git_index_owner()
nulltoken 0ae81fc4 2012-10-17T15:30:22 index: remove read_tree() progress indicator git_index_read_tree() was exposing a parameter to provide the user with a progress indicator. Unfortunately, due to the recursive nature of the tree walk, the maximum number of items to process was unknown. Thus, the indicator was only counting processed entries, without providing any information how the number of remaining items.
Vicent Martí f98c32f3 2012-08-19T01:26:06 Merge pull request #778 from ben/clone Clone
Ben Straub 4bf51156 2012-07-30T14:52:46 Enable stats on git_index_read_tree. Replace with the contents of git_index_read_tree_with_stats() and improve documentation comments.
Ben Straub f1587b97 2012-07-30T14:37:40 Checkout: use git_index_read_tree_with_stats. New variant of git_index_read_tree that fills in the 'total' field of a git_indexer_stats struct as it's walking the tree.
nulltoken b8457baa 2012-07-24T07:57:58 portability: Improve x86/amd64 compatibility
Russell Belfer 77d65af4 2012-06-19T15:16:38 Nicer constant
Russell Belfer da825c92 2012-06-19T14:27:02 Make index add/append support core.filemode flag This fixes git_index_add and git_index_append to behave more like core git, preserving old filemode data in the index when adding and/or appending with core.filemode = false. This also has placeholder support for core.symlinks and core.ignorecase, but those flags are not implemented (well, symlinks has partial support for preserving mode information in the same way that git does, but it isn't tested).
Bruce Mitchener d73c94b2 2012-05-19T20:24:55 Fix spelling errors.
Vicent Martí e172cf08 2012-05-18T01:21:06 errors: Rename the generic return codes
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
Russell Belfer cfbc880d 2012-01-16T15:16:44 Patch cleanup for merge After reviewing the gitignore support with Vicent, we came up with a list of minor cleanups to prepare for merge, including: * checking git_repository_config error returns * renaming git_ignore_is_ignored and moving to status.h * fixing next_line skipping to include \r skips * commenting on where ignores are and are not included
Clemens Buchacher 599f2849 2011-12-26T18:37:31 add git_index_read_tree
Vicent Marti 87d9869f 2011-09-19T03:34:49 Tabify everything There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
Vicent Marti bb742ede 2011-09-19T01:54:32 Cleanup legal data 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
David Boyce d9111722 2011-09-13T12:30:25 Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or an error code".
Kirill A. Shutemov 7d9cc9f8 2011-07-15T17:46:55 index: fix cast warnings /home/kas/git/public/libgit2/src/index.c: In function ‘git_index_clear’: /home/kas/git/public/libgit2/src/index.c:228:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c:235:8: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c: In function ‘index_insert’: /home/kas/git/public/libgit2/src/index.c:392:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c:399:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c: In function ‘read_unmerged’: /home/kas/git/public/libgit2/src/index.c:681:35: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/index.c: In function ‘read_entry’: /home/kas/git/public/libgit2/src/index.c:716:33: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Kirill A. Shutemov 245adf4f 2011-07-02T01:08:42 index: introduce git_index_uniq() function It removes all entries with equal path except last added. On large indexes git_index_append() + git_index_uniq() before writing is *much* faster, than git_index_add(). Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Romain Geissler f11e0797 2011-06-05T21:19:03 Index: API uniformisation: Use unsigned int for all index number. Feature Added: Search an unmerged entry by path (git_index_get_unmerged renamed to git_index_get_unmerged_bypath) or by index (git_index_get_unmerged_byindex).
Vicent Marti 3a42e0a3 2011-06-03T21:38:55 index: Add `git_index_entry_stage` method As suggested by Romain-Geissler
Vicent Marti f7e59c4d 2011-06-01T18:34:21 index: Change the memory management for repo indexes The `git_repository_index` call now returns a brand new index that must be manually free'd.
Vicent Marti f4e2aca2 2011-05-19T20:38:17 index: Fix issues in the unmerged entries API
Jakob Pfender 050e8877 2011-05-17T15:31:05 Merge branch 'development' into unmerged
Jason R. McNeil 773bc20d 2011-05-03T22:22:42 Fix misspelling of git_index_append2 (was git_index_apppend2).
Vicent Marti 1648fbd3 2011-05-02T01:12:53 Re-apply missing patches
Vicent Marti f7a5058a 2011-04-24T00:31:43 index: Refactor add/replace methods Removed the optional `replace` argument, we now have 4 add methods: `git_index_add`: add or update from path `git_index_add2`: add or update from struct `git_index_append`: add without replacing from path `git_index_append2`: add without replacing from struct Yes, this breaks the bindings.
Jakob Pfender 4c0b6a6d 2011-04-21T10:54:54 index: Add API for unmerged entries New external functions: - git_index_unmerged_entrycount: Counts the unmerged entries in the index - git_index_get_unmerged: Gets an unmerged entry from the index by name New internal functions: - read_unmerged: Wrapper for read_unmerged_internal - read_unmerged_internal: Reads unmerged entries from the index if the index has the INDEX_EXT_UNMERGED_SIG set - unmerged_srch: Search function for unmerged vector - unmerged_cmp: Compare function for unmerged vector New data structures: - git_index now contains a git_vector unmerged that stores unmerged entries - git_index_entry_unmerged: Representation of an unmerged file entry. It represents all three versions of the file at the same time, with one name, three modes and three OIDs
Jakob Pfender 729b6f49 2011-04-21T10:40:54 index: Allow user to toggle whether to replace an index entry When in the middle of a merge, the index needs to contain several files with the same name. git_index_insert() used to prevent this by not adding a new entry if an entry with the same name already existed.
Jakob Pfender 26f2c897 2011-04-04T16:20:09 index.h: Add IDXENTRY flags needed for index operations Add several IDXENTRY flags that need to be checked in order to properly implement update-index --refresh.
Jakob Pfender a5a546b3 2011-04-07T16:53:50 index.h: Correct values for extended flags As libgit2 separates an index entry's 32-bit flag into two 16-bit values flags and flags_extended, the values of flags_extended need to be adjusted.
Jakob Pfender 7c7fcdae 2011-04-04T16:20:09 index.h: Add IDXENTRY flags needed for index operations Add several IDXENTRY flags that need to be checked in order to properly implement update-index --refresh.
Jakob Pfender 051d6915 2011-03-24T18:28:04 index.h: Fix minor typo
Jakob Pfender 12f6d8e1 2011-03-24T13:48:22 index.h: Correct documentation for git_index_open_inrepo() Fix the doxygen comments for git_index_open_inrepo(). Previously they referred to a param index_path and omitted index (probably a c&p error).
Vicent Marti 71d33382 2011-03-03T20:20:45 Move the external includes folder from `src` to `include` Signed-off-by: Vicent Marti <tanoku@gmail.com>