summaryrefslogtreecommitdiff
path: root/src/index.c
Commit message (Collapse)AuthorAgeFilesLines
* index: Add `git_index_new`index-open-cleanupVicent Marti2012-11-011-0/+5
|
* index: Fix testsVicent Marti2012-11-011-2/+1
|
* index: Add git_index_write_treeVicent Marti2012-11-011-8/+44
|
* index: Switch to git_futils_filestampVicent Marti2012-11-011-19/+17
|
* Add git_config_refresh() API to reload configRussell Belfer2012-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* index refactoringEdward Thomson2012-10-291-78/+532
|
* index: introduce git_index_owner()nulltoken2012-10-261-0/+5
|
* Network progress: rename thingsBen Straub2012-10-241-1/+1
| | | | | | | git_indexer_stats and friends -> git_transfer_progress* Also made git_transfer_progress members more sanely named.
* index: remove read_tree() progress indicatornulltoken2012-10-191-13/+4
| | | | | | | | 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.
* Support for core.ignorecasePhilip Kelley2012-09-171-9/+55
|
* Fix logical error in git_index_set_capsauthmillenon2012-09-041-1/+1
|
* Merge pull request #778 from ben/cloneVicent Martí2012-08-191-4/+18
|\ | | | | Clone
| * Enable stats on git_index_read_tree.Ben Straub2012-07-301-6/+1
| | | | | | | | | | Replace with the contents of git_index_read_tree_with_stats() and improve documentation comments.
| * Checkout: use git_index_read_tree_with_stats.Ben Straub2012-07-301-4/+23
| | | | | | | | | | 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.
* | oid: Explicitly include `oid.h` for the inlined CMPVicent Marti2012-08-091-0/+1
| |
* | portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-5/+5
|/
* tree: Bring back `entry_bypath`Vicent Marti2012-06-291-1/+1
| | | | Smaller, simpler, faster.
* Make index add/append support core.filemode flagRussell Belfer2012-06-191-18/+70
| | | | | | | | | | | 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).
* tree: Naming conventionsVicent Martí2012-05-161-1/+1
|
* Ranged iterators and rewritten git_status_fileRussell Belfer2012-05-151-0/+9
| | | | | | | | | | | | | | | | | | | | | The goal of this work is to rewrite git_status_file to use the same underlying code as git_status_foreach. This is done in 3 phases: 1. Extend iterators to allow ranged iteration with start and end prefixes for the range of file names to be covered. 2. Improve diff so that when there is a pathspec and there is a common non-wildcard prefix of the pathspec, it will use ranged iterators to minimize excess iteration. 3. Rewrite git_status_file to call git_status_foreach_ext with a pathspec that covers just the one file being checked. Since ranged iterators underlie the status & diff implementation, this is actually fairly efficient. The workdir iterator does end up loading the contents of all the directories down to the single file, which should ideally be avoided, but it is pretty good.
* Migrate index, oid, and utils to new errorsRussell Belfer2012-03-191-171/+146
| | | | | | | | | | | | This includes a few cleanups that came up while converting these files. This commit introduces a could new git error classes, including the catchall class: GITERR_INVALID which I'm using as the class for invalid and out of range values which are detected at too low a level of library to use a higher level classification. For example, an overflow error in parsing an integer or a bad letter in parsing an OID string would generate an error in this class.
* Continue error conversionRussell Belfer2012-03-141-2/+1
| | | | | | | This converts blob.c, fileops.c, and all of the win32 files. Also, various minor cleanups throughout the code. Plus, in testing the win32 build, I cleaned up a bunch (although not all) of the warnings with the 64-bit build.
* Migrating diff to new error handlingRussell Belfer2012-03-061-1/+1
| | | | | | Ended up migrating a bunch of upstream functions as well including vector, attr_file, and odb in order to get this to work right.
* error-handling: ReferencesVicent Martí2012-03-061-2/+2
| | | | | Yes, this is error handling solely for `refs.c`, but some of the abstractions leak all ofer the code base.
* buffer: Unify `git_fbuffer` and `git_buf`Vicent Martí2012-02-271-3/+3
| | | | | | | | | | | | | | This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Move path related functions from fileops to pathRussell Belfer2012-01-171-2/+2
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* Fix memory leak in git_index_remove.Russell Belfer2012-01-051-1/+7
| | | | Missed freeing the entry.
* add git_index_read_treeClemens Buchacher2011-12-301-0/+42
|
* Restore missing lstat in index_entry_initRussell Belfer2011-12-181-0/+19
| | | | | | In an effort to remove duplicate code, I accidentally left the stat structure uninitialized in this function. This patch restores that data gathering.
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-16/+6
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* Plug a bunch of leaksCarlos Martín Nieto2011-11-281-0/+11
|
* repository: Change ownership semanticsVicent Marti2011-11-261-27/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
* filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanupsRussell Belfer2011-11-221-1/+1
| | | | | | | | Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT and make git_filebuf_open and git_filebuf_cleanup safe to be called multiple times on the same buffer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Merge pull request #456 from brodie/perm-fixesVicent Martí2011-10-281-1/+1
|\ | | | | Create objects, indexes, and directories with the right file permissions
| * *: correct and codify various file permissionsBrodie Rao2011-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following files now have 0444 permissions: - loose objects - pack indexes - pack files - packs downloaded by fetch - packs downloaded by the HTTP transport And the following files now have 0666 permissions: - config files - repository indexes - reflogs - refs This brings libgit2 more in line with Git. Note that git_filebuf_commit() and git_filebuf_commit_at() have both gained a new mode parameter. The latter change fixes an important issue where filebufs created with GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3) usage). Now we chmod() the file before renaming it into place. Tests have been added to confirm that new commit, tag, and tree objects are created with the right permissions. I don't have access to Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
* | global: Properly use `git__` memory wrappersVicent Marti2011-10-281-12/+12
|/ | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* index: Silence type-punned warningVicent Marti2011-09-291-1/+4
|
* Invalidate the path when removing from the indexCarlos Martín Nieto2011-09-271-0/+6
| | | | Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* index: invalidate added pathsCarlos Martín Nieto2011-09-271-0/+4
| | | | | | | When a file is updated in the index, it's path needs to be invalidated in the tree cache as the hash is no longer correct. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Move the tree cache functions to their own fileCarlos Martín Nieto2011-09-271-139/+3
| | | | | | Rename git_index_tree to git_tree_cache. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* config: make git_config_[get|set]_long() able to properly deal with 8 bytes ↵nulltoken2011-09-221-2/+2
| | | | | | | | wide values Should fix issue #419. Signed-off-by: nulltoken <emeric.fermas@gmail.com>
* Tabify everythingVicent Marti2011-09-191-4/+4
| | | | | | 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.
* Cleanup legal dataVicent Marti2011-09-191-21/+3
| | | | | | | | | | 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.
* Fix compilation in MinGWVicent Marti2011-08-311-1/+1
|
* Merge pull request #335 from carlosmn/read-updatedVicent Martí2011-07-281-16/+11
|\ | | | | Don't stat so much when reading references
| * index: use git_futils_readbuffer_updatedCarlos Martín Nieto2011-07-231-16/+11
| | | | | | | | | | | | This helps readability a bit as well. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* | index: rework index entry initialization routineKirill A. Shutemov2011-07-251-56/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | index_init_entry() renamed to index_entry_init(). Now it allocates entry on its own. git_index_add() and git_index_append() reworked accordingly. This commit fixes warning: /home/kas/git/public/libgit2/src/index.c: In function ‘index_init_entry’: /home/kas/git/public/libgit2/src/index.c:452:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | index: rework index_insert()Kirill A. Shutemov2011-07-251-22/+42
| | | | | | | | | | | | Now index_insert() takes copy of index entry, not coping it by itself. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | index: introduce index_entry_free()Kirill A. Shutemov2011-07-251-4/+10
| | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>