summaryrefslogtreecommitdiff
path: root/src/refs.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #1802 from libgit2/cmn/reflog-backendBen Straub2013-10-281-1/+1
|\ | | | | Make reflog part of refdb
| * reflog: move the reflog implementation into refdb_fsCarlos Martín Nieto2013-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | References and their logs are logically coupled, let's make it so in the code by moving the fs-based reflog implementation to live next to the fs-based refs one. As part of the change, make the function take names rather than references, as only the names are relevant when looking up and handling reflogs.
* | After iconv init reset ref normalize errorRussell Belfer2013-10-091-0/+1
| | | | | | | | | | | | The iconv init was accidentally clearing the default error state during reference normalization. This resets so that normalization errors will be detected correctly.
* | Make reference lookups apply precomposeunicodeRussell Belfer2013-10-081-23/+44
|/ | | | | | | | | | | | | | | | | | | | | Before these changes, looking up a reference would return the same precomposed or decomposed form of the reference name that was used to look it up, so on MacOS which ignores the difference between the two, a single reference could be looked up either way and git_reference_name would return the form of the name that was used to look it up! This change makes lookup always return the precomposed name if core.precomposeunicode is set regardless of which version was used to look it up. The reference iterator was already returning the precomposed form from earlier work. This also updates the CMakeLists.txt rules for enabling iconv usage because the clar tests for this code were actually not being activated properly with the old version. Finally, this moves git_repository_reset_filesystem from include/ git2/repository.h to include/git2/sys/repository.h since it is not really a function that normal library users should have to think about very often.
* Merge pull request #1805 from libgit2/threading-packed-loadVicent Martí2013-08-281-0/+11
|\ | | | | Thread safety for the refdb_fs
| * Add internal ref set_name fn instead of reallocRussell Belfer2013-08-211-0/+11
| | | | | | | | | | | | | | | | The refdb_fs implementation calls realloc directly on a reference object when it wants to rename it. It is not a public object, so this doesn't mess with the immutability of references, but it does assume certain constraints on the reference representation. This commit wraps that assumption in an isolated API to isolate it.
* | refs: add git_reference_is_tagNikolai Vladimirov2013-08-261-0/+11
|/
* Reorganize diff and add basic diff driverRussell Belfer2013-06-101-0/+1
| | | | | | | | | | | | | | | | | | This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
* Merge pull request #1624 from libgit2/vmg/full-ref-iteratorVicent Martí2013-06-031-203/+95
|\ | | | | Breaking RefDB changes
| * RefcountingVicent Marti2013-05-301-0/+3
| |
| * ...Aaaand this worksVicent Marti2013-05-301-170/+22
| |
| * What are the chances, reallyVicent Marti2013-05-291-44/+81
| |
| * Liike thisVicent Marti2013-05-281-1/+1
| |
* | Merge pull request #1559 from carlosmn/ref-shorthandVicent Martí2013-05-311-0/+17
|\ \ | |/ |/| Introduce git_reference_shorthand
| * Introduce git_reference_shorthandCarlos Martín Nieto2013-05-081-0/+17
| | | | | | | | Generate a shorthand name out of the full refname.
* | Merge pull request #1385 from carlosmn/refs-iterEdward Thomson2013-05-111-15/+69
|\ \ | | | | | | Introduce a refs iterator
| * | Introduce a glob-filtering iteratorCarlos Martín Nieto2013-05-111-4/+11
| | | | | | | | | | | | | | | If the backend doesn't provide support for it, the matching is done in refdb on top of a normal iterator.
| * | refs: remove the OID/SYMBOLIC filteringCarlos Martín Nieto2013-05-111-15/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | Nobody should ever be using anything other than ALL at this level, so remove the option altogether. As part of this, git_reference_foreach_glob is now implemented in the frontend using an iterator. Backends will later regain the ability of doing the glob filtering in the backend.
| * | refs: implement _foreach with the iteratorCarlos Martín Nieto2013-05-111-3/+21
| | |
| * | refs: introduce an iteratorCarlos Martín Nieto2013-05-111-0/+20
| | | | | | | | | | | | This allows us to get a list of reference names in a loop instead of callbacks.
* | | Expose git_reference_dwimCarlos Martín Nieto2013-05-071-0/+61
| |/ |/| | | | | | | Extract this function out of the rev-parse code to be able to DWIM a reference instead of its target.
* | Error messages for a couple other boundary conditionsRussell Belfer2013-05-011-1/+3
|/
* Merge pull request #1518 from arrbee/export-oid-comparisonVicent Martí2013-04-301-1/+1
|\ | | | | Remove most inlines from the public API
| * Make git_oid_cmp public and add git_oid__cmpRussell Belfer2013-04-291-1/+1
| |
* | Parse shorthand refspecs as validCarlos Martín Nieto2013-04-281-0/+1
|/ | | | | Relax the ONELEVEL ref naming rules so the refspec parsing code can ask for 'master' to be considered valid.
* Move git_reference__alloc to include/git2/sysRussell Belfer2013-04-211-2/+2
| | | | | | Create a new include/git2/sys/refs.h and move the reference alloc functions there. Also fix some documentation issues and some minor code cleanups.
* Move refdb_backend to include/git2/sysRussell Belfer2013-04-211-23/+22
| | | | | | | | | This moves most of the refdb stuff over to the include/git2/sys directory, with some minor shifts in function organization. While I was making the necessary updates, I also removed the trailing whitespace in a few files that I modified just because I was there and it was bugging me.
* alloc doesn't take a refdb; git_refdb_free nicely in the testsEdward Thomson2013-04-191-13/+12
|
* refs: Do not union the peelvmg/refs-peelVicent Marti2013-04-171-10/+10
|
* refs: Check alloc is cleanerVicent Marti2013-04-171-2/+1
|
* refs: Add `git_referene_target_peel`Vicent Marti2013-04-171-57/+110
|
* object: Export git_object_dupVicent Marti2013-04-101-1/+1
|
* Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-5/+12
| | | | | | | 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
* Fix various build warningsRussell Belfer2013-03-141-7/+12
| | | | This fixes various build warnings on Mac and Windows (64-bit).
* immutable references and a pluggable ref databaseEdward Thomson2013-03-071-1298/+240
|
* refs: explicitly catch leading slashesCarlos Martín Nieto2013-03-071-0/+3
| | | | | | | | | | It's somewhat common to try to write "/refs/tags/something". There is no easy way to catch it during the main body of the function, as there is no way to distinguish whether it's a leading slash or a double slash somewhere in the middle. Catch this at the beginning so we don't trigger the assert in is_all_caps_and_underscore().
* Fix portability issues on WindowsRussell Belfer2013-02-261-4/+7
| | | | | | The new tests were not taking core.filemode into account when testing file modes after repo initialization. Fixed that and some other Windows warnings that have crept in.
* branch: Make git_branch_remote_name() cope with orphaned headsnulltoken2013-02-221-1/+6
|
* Clear up warnings from cppcheckRussell Belfer2013-02-151-1/+1
| | | | | | | | | | | | The cppcheck static analyzer generates warnings for a bunch of places in the libgit2 code base. All the ones fixed in this commit are actually false positives, but I've reorganized the code to hopefully make it easier for static analysis tools to correctly understand the structure. I wouldn't do this if I felt like it was making the code harder to read or worse for humans, but in this case, these fixes don't seem too bad and will hopefully make it easier for better analysis tools to get at any real issues.
* remote: Introduce git_remote_is_valid_name()nulltoken2013-02-111-5/+4
| | | | Fix libgit2/libgit2sharp#318
* refs: No component of a refname can end with '.lock'nulltoken2013-02-111-4/+6
|
* refs: handle ALLOW_ONELEVEL normalization with leading slashCarlos Martín Nieto2013-01-311-0/+5
| | | | | | | | | | | | A leading slash confuses the name normalization code when the flags include ALLOW_ONELEVEL. Catch this case in particular to avoid triggering an assertion in the uppercase check which expects us not to pass it an empty string. The existing tests don't catch this as they simply use the NORMAL flag. This fixes #1300.
* Allow peeled references without trailing newline at end of fileScott J. Goldman2013-01-221-4/+8
| | | | Also ammends one of the tag tests to make sure it's working.
* Revert "Handle packed peeled objects without trailing newlines"Scott J. Goldman2013-01-221-6/+3
| | | | | | This reverts commit 28b1cdf3a1bdcd37cf9d550c92b8c19b1782ea6b. //cc #1262 #1267
* Handle packed peeled objects without trailing newlinesScott J. Goldman2013-01-211-3/+6
| | | | Fixes #1262
* branch: Introduce git_branch_tracking_name()nulltoken2013-01-161-1/+6
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Handle packed refs with no trailing newlineno-newline-packed-refsScott J. Goldman2013-01-051-1/+1
| | | I saw a repo in the wild today which had a master branch ref which was packed, but had no trailing newline. Git handled it fine, but libgit2 choked on it. Fix seems simple enough. If we don't see a newline, assume the end of the buffer is the end of the ref line.
* Invalid ref name normalization leaked memoryRussell Belfer2012-12-271-0/+3
| | | | | | | | | | When normalizing a reference name, if there is an error because the name is invalid, then the memory allocated for storing the name could be leaked if the caller was not careful and assumed that the error return code meant that no allocation had occurred. This fixes that by explicitly deallocating the reference name buffer if there is an error in normalizing the name.
* Also, whitespace.Rick Bradley2012-12-181-1/+1
| | | | I was totally flaunting @ben's 3-space tab advice.