summaryrefslogtreecommitdiff
path: root/src/refs.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Improve comment textRick Bradley2012-12-181-1/+1
| | | | | This looked wrong to me. I *think* this is more appropriate commentary.
* refs: Deploy EINVALIDSPEC usagenulltoken2012-12-011-15/+18
|
* refs: Fix error clearingnulltoken2012-12-011-1/+5
|
* API updates for tag.hRussell Belfer2012-11-271-1/+1
|
* Update callback fn ptr for git_reference_foreachRussell Belfer2012-11-271-1/+1
| | | | As part of API review, use a typedef for the callback fn ptr.
* Rename ref and reflog apis for consistencyBen Straub2012-11-271-23/+23
|
* Extensions to rmdir and mkdir utilitiesRussell Belfer2012-11-091-8/+5
| | | | | | | | | | | * Rework GIT_DIRREMOVAL values to GIT_RMDIR flags, allowing combinations of flags * Add GIT_RMDIR_EMPTY_PARENTS flag to remove parent dirs that are left empty after removal * Add GIT_MKDIR_VERIFY_DIR to give an error if item is a file, not a dir (previously an EEXISTS error was ignored, even for files) and enable this flag for git_futils_mkpath2file call * Improve accuracy of error messages from git_futils_mkdir
* 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