summaryrefslogtreecommitdiff
path: root/src/refspec.c
Commit message (Collapse)AuthorAgeFilesLines
* refspec: make sure matching refspecs have src, dst and input stringsCarlos Martín Nieto2015-05-221-0/+6
| | | | | | | | When we find out that we're dealing with a matching refspec, we set the flag and return immediately. This leaves the strings as NULL, which breaks the contract. Assign these pointers to a string with the correct values.
* refspec: set err message on invalid refspecAdrien Thebo2015-03-101-0/+3
| | | | | | | If a refspec could not be parsed, the git_refspec__parse function would return an error value but would not provide additional error information for the callers. This commit amends that function to set a more useful error message.
* push: use the common refspec parsercmn/push-refspec-refactorCarlos Martín Nieto2014-11-091-0/+6
| | | | | | | | | | | There is one well-known and well-tested parser which we should use, instead of implementing parsing a second time. The common parser is also augmented to copy the LHS into the RHS if the latter is empty. The expressions test had to change a bit, as we now catch a bad RHS of a refspec locally.
* Check that the refspec matches before modifying the out bufferJacques Germishuys2014-08-211-6/+6
|
* Check if the refspec matches before transformingJacques Germishuys2014-08-171-2/+14
|
* refspec: support asterisks in the middle of a patternCarlos Martín Nieto2014-07-041-18/+32
| | | | | | | | | | We used to assume a refspec would only have an asterisk in the middle of their respective pattern. This has not been a valid assumption for some time now with git. Instead of assuming where the asterisk is going to be, change the logic to treat each pattern as having two halves with a replacement bit in the middle, where the asterisk is.
* refspec: short-circuit non-pattern refspecs on transformCarlos Martín Nieto2014-07-041-0/+10
| | | | | | When transforming a non-pattern refspec, we simply need to copy over the opposite string. Move that logic up to the wrapper so we can assume a pattern refspec in the transformation function.
* refspec: move to git_buf for outputting stringsCarlos Martín Nieto2014-01-271-50/+4
|
* remote: store dwimed refspecs separatelyCarlos Martín Nieto2013-11-011-0/+68
| | | | | This allows us to add e.g. "HEAD" as a refspec when none are given without overwriting the user's data.
* Make refspec_transform paranoid about argumentsRussell Belfer2013-07-011-14/+20
|
* refspec: add direction accessorCarlos Martín Nieto2013-04-301-0/+7
|
* Parse shorthand refspecs as validCarlos Martín Nieto2013-04-281-1/+1
| | | | | Relax the ONELEVEL ref naming rules so the refspec parsing code can ask for 'master' to be considered valid.
* refspec: unify the string and parsed dataCarlos Martín Nieto2013-04-201-0/+9
| | | | | | | | It used to be separate as an attempt to make the querying easier, but it didn't work out that way, so put all the data together. Add git_refspec_string() as well to get the original string, which is now stored alongside the independent parts.
* remote: handle multiple refspecsCarlos Martín Nieto2013-04-201-0/+1
| | | | | | | | | | | | | A remote can have a multitude of refspecs. Up to now our git_remote's have supported a single one for each fetch and push out of simplicity to get something working. Let the remotes and internal code know about multiple remotes and get the tests passing with them. Instead of setting a refspec, the external users can clear all and add refspecs. This should be enough for most uses, though we're still missing a querying function.
* Teach refspec to transform destination reference to source referenceJameson Miller2013-02-111-7/+17
|
* Teach remote branch to return its remoteJameson Miller2013-02-111-0/+8
|
* refspec: prevent git_refspec__free() from segfaultingnulltoken2013-01-111-0/+3
| | | | Fix libgit2/libgit2sharp#247
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* create FETCH_HEAD specially instead of as a ref fileEdward Thomson2012-11-111-0/+7
|
* refspec: introduce git_refspec__serialize()nulltoken2012-10-251-0/+11
|
* refspec: introduce git_refspec_transform_l()nulltoken2012-10-081-4/+14
|
* refspec: add git_refspec__free, remove git_refspec_parseCarlos Martín Nieto2012-09-301-28/+3
| | | | | | | The latter shouldn't be exposed and isn't used, git_refspec__parse supersedes it. Fix a leak in the refspec tests while we're at it.
* refspec: introduce git_refspec__parse()nulltoken2012-09-251-0/+113
|
* refspec: expose the force update specifier through git_refspec_force() accessornulltoken2012-05-301-0/+7
|
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-2/+2
|
* errors: Rename the generic return codesVicent Martí2012-05-181-2/+2
|
* Remove old and unused error codesVicent Martí2012-05-021-2/+6
|
* Merge remote-tracking branch 'carlosmn/remaining-errors' into new-error-handlingVicent Martí2012-05-011-18/+19
|\ | | | | | | | | Conflicts: src/refspec.c
| * error handling: move the missing parts over to the new error handlingCarlos Martín Nieto2012-04-261-18/+19
| |
* | buf: deploy git_buf_len()nulltoken2012-04-301-2/+2
|/
* error-handling: RepositoryVicent Martí2012-03-071-2/+6
| | | | | | | | This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* refspec: a ref name includes the refs/ prefixCarlos Martín Nieto2012-01-311-1/+1
| | | | | | | git_refspec_transform_r assumed that the reference name passed would be only a branch or tag name. This is not the case, and we need to take into consideration what's in the refspec's source to know how much of the prefix to ignore.
* transport: prevent git_remote_download() from segfaulting when being passed ↵nulltoken2012-01-191-1/+1
| | | | a lightweight remote built with git_remote_new()
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-0/+18
| | | | | | | | | | | | | | | | | | | | 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.
* refspec: allow a simple branchnameCarlos Martín Nieto2011-11-181-2/+7
| | | | | | | A simple branchname as refspec is valid and we shouldn't throw an error when encountering one. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-1/+1
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* A missing refspec is not an errorCarlos Martín Nieto2011-10-081-3/+3
| | | | | | | It's rare for a configured remote, but for one given as an URL on the command line, it's more often than not the case. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Tabify everythingVicent Marti2011-09-191-1/+1
| | | | | | 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.
* Add git_refspec_transformCarlos Martín Nieto2011-06-261-0/+36
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Add git.git's fnmatch, which is really GNU's and the git__fnmatch wrapperCarlos Martín Nieto2011-06-261-0/+6
| | | | | | | | | | | | | If the strings match, git__fnmatch returns GIT_SUCCESS and GIT_ENOMATCH on failure to match. MSVC fixes: Added a test for _MSC_VER and (in that case) defined HAVE_STRING_H to 1 so it doesn't try to include <strings.h> which doesn't exist in the MSVC world. Moved the function declarations to use the modern inline ones so MSVC doesn't have a fit. Added casts everywhere so MSVC doesn't crap its pants. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Add a remotes APICarlos Martín Nieto2011-06-261-0/+66
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>