summaryrefslogtreecommitdiff
path: root/src/refs.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve docs, examples, warningsRussell Belfer2012-11-011-2/+2
| | | | | | This improves docs in some of the public header files, cleans up and improves some of the example code, and fixes a couple of pedantic warnings in places.
* Add git_config_refresh() API to reload configRussell Belfer2012-10-301-1/+2
| | | | | | | | | | | | | | | | | | | | 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.
* Merge pull request #968 from arrbee/diff-support-typechangeRussell Belfer2012-10-171-6/+7
|\ | | | | Support TYPECHANGE records in status and adjust checkout accordingly
| * Add complex checkout test and then fix checkoutRussell Belfer2012-10-091-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix leak in the testsCarlos Martín Nieto2012-10-151-2/+1
| | | | | | | | | | Also introduce the slective ref trimming promised but also missed in the previous commit.
* | refs: loosen the OID parsingCarlos Martín Nieto2012-10-151-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | We used to require loose references to contain only an OID (possibly after trimming the string). This is however not enough for letting us lookup FETCH_HEAD, which can have a lot of content after the initial OID. Change the parsing rules so that a loose refernce must e at least 40 bytes long and the 41st (if it's there) must be accepted by isspace(3). This makes the trim unnecessary, so only do it for symrefs. This fixes #977.
* | refs: propagate EEXISTS upon renamingnulltoken2012-10-111-2/+2
|/
* branch: deploy git_branch_is_head()nulltoken2012-10-081-7/+2
|
* refs: deploy git_repository_set_head() usagenulltoken2012-10-071-17/+13
|
* refs: use constants for well-known namesnulltoken2012-10-071-1/+1
|
* Merge pull request #961 from arrbee/win64-cleanupsVicent Martí2012-10-011-6/+6
|\ | | | | Win64 cleanups
| * Fix up more Win64 compile warningsRussell Belfer2012-10-011-6/+6
| |
* | refs: propagate EEXISTSCarlos Martín Nieto2012-09-301-4/+6
|/ | | | | | Indicate whether the error comes from the ref already existing or elsewhere. We always perform the check and this lets the user write more concise code.
* refspec: introduce git_refspec__parse()nulltoken2012-09-251-3/+10
|
* refs: introduce git_reference_is_valid_name()nulltoken2012-09-251-36/+59
|
* refs: make git_reference_normalize_name() accept refspec patternnulltoken2012-09-251-72/+114
|
* refs: prevent locked refs from being enumeratednulltoken2012-09-141-0/+4
| | | | Fix #936
* refs: introduce git_reference_peel()nulltoken2012-09-061-0/+47
| | | | Fix #530
* Diff iteratorsRussell Belfer2012-09-051-1/+0
| | | | | | | | | | | This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
* Fix parentheses warningMichael Schubert2012-08-281-1/+2
|
* Merge branch 'branch-delete-ref' into developmentVicent Marti2012-08-271-1/+6
|\ | | | | | | | | Conflicts: include/git2/refs.h
| * branch: Change `git_branch_delete` to take a refbranch-delete-refVicent Marti2012-08-261-1/+6
| |
* | refs: expose git_reference_normalize_name()nulltoken2012-08-271-38/+70
|/
* oid: Explicitly include `oid.h` for the inlined CMPVicent Marti2012-08-091-0/+1
|
* trim whitespace when parsing loose refsRussell Belfer2012-08-091-36/+13
|
* Merge remote-tracking branch 'arrbee/tree-walk-fixes' into developmentVicent Marti2012-08-061-7/+15
|\ | | | | | | | | | | | | | | | | Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
| * Update iterators for consistency across libraryRussell Belfer2012-08-031-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
* | refs: drop git_reference_remote_tracking_from_branch()nulltoken2012-07-241-74/+0
| |
* | branch: introduce git_reference_is_branch()nulltoken2012-07-241-0/+7
|/
* refs: fix a memory leaknulltoken2012-07-121-0/+3
|
* refs: introduce git_reference_remote_tracking_from_branch()nulltoken2012-07-121-0/+74
|
* refs: remove seemingly useless giterr_clear() callnulltoken2012-07-071-2/+0
|
* refs: deploy git_reference_has_log()nulltoken2012-07-071-9/+3
|
* refs: add git_reference_has_log()nulltoken2012-07-071-0/+17
|
* refs: fix moving of the reflog when renaming a refnulltoken2012-07-071-0/+1
|
* references: introduce git_reference_foreach_glob()nulltoken2012-06-221-0/+37
|
* Add git_reset()nulltoken2012-06-071-0/+59
| | | | Currently supports Soft and Mixed modes.
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-4/+4
|
* errors: Rename the generic return codesVicent Martí2012-05-181-4/+4
|
* Properly tag all `enums` with a `_t`Vicent Martí2012-05-181-3/+3
|
* refs: git_reference_listall -> git_reference_listVicent Martí2012-05-181-1/+1
|
* buf: deploy git_buf_len()nulltoken2012-04-301-2/+2
|
* refs: fix unused-but-set warningMichael Schubert2012-04-271-0/+1
|
* Rename git_khash_str to git_strmap, etc.Russell Belfer2012-04-251-23/+23
| | | | | | This renamed `git_khash_str` to `git_strmap`, `git_hash_oid` to `git_oidmap`, and deletes `git_hashtable` from the tree, plus adds unit tests for `git_strmap`.
* Convert hashtable usage over to khashRussell Belfer2012-04-251-27/+45
| | | | | | | | | | | | | | | This updates khash.h with some extra features (like error checking on allocations, ability to use wrapped malloc, foreach calls, etc), creates two high-level wrappers around khash: `git_khash_str` and `git_khash_oid` for string-to-void-ptr and oid-to-void-ptr tables, then converts all of the old usage of `git_hashtable` over to use these new hashtables. For `git_khash_str`, I've tried to create a set of macros that yield an API not too unlike the old `git_hashtable` API. Since the oid hashtable is only used in one file, I haven't bother to set up all those macros and just use the khash APIs directly for now.
* Implement git_pool paged memory allocatorRussell Belfer2012-04-251-1/+1
| | | | | | | | | | | | | | | | | | This adds a `git_pool` object that can do simple paged memory allocation with free for the entire pool at once. Using this, you can replace many small allocations with large blocks that can then cheaply be doled out in small pieces. This is best used when you plan to free the small blocks all at once - for example, if they represent the parsed state from a file or data stream that are either all kept or all discarded. There are two real patterns of usage for `git_pools`: either for "string" allocation, where the item size is a single byte and you end up just packing the allocations in together, or for "fixed size" allocation where you are allocating a large object (e.g. a `git_oid`) and you generally just allocation single objects that can be tightly packed. Of course, you can use it for other things, but those two cases are the easiest.
* Rename to git_reference_name_to_oidRussell Belfer2012-04-231-1/+1
|
* Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-7/+7
| | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* Add git_reference_lookup_oid and lookup_resolvedRussell Belfer2012-04-171-51/+88
| | | | | | | | | | | | | | Adds a new public reference function `git_reference_lookup_oid` that directly resolved a reference name to an OID without returning the intermediate `git_reference` object (hence, no free needed). Internally, this adds a `git_reference_lookup_resolved` function that combines looking up and resolving a reference. This allows us to be more efficient with memory reallocation. The existing `git_reference_lookup` and `git_reference_resolve` are reimplmented on top of the new utility and a few places in the code are changed to use one of the two new functions.
* branch: add git_branch_move()nulltoken2012-04-101-0/+9
|