summaryrefslogtreecommitdiff
path: root/src/remote.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | remote: make _ls return the list directlyCarlos Martín Nieto2013-11-111-16/+5
| | | | | | | | | | | | | | | | | | | | | | The callback-based method of listing remote references dates back to the beginning of the network code's lifetime, when we didn't know any better. We need to keep the list around for update_tips() after disconnect() so let's make use of this to simply give the user a pointer to the array so they can write straightforward code instead of having to go through a callback.
* | remote: don't allow such direct access to the refspecsCarlos Martín Nieto2013-11-101-20/+56
| | | | | | | | | | | | Removing arbitrary refspecs makes things more complex to reason about. Instead, let the user set the fetch and push refspec list to whatever they want it to be.
* | remote: store dwimed refspecs separatelyCarlos Martín Nieto2013-11-011-76/+35
| | | | | | | | | | This allows us to add e.g. "HEAD" as a refspec when none are given without overwriting the user's data.
* | remote: create FETCH_HEAD with a refspecless remoteCarlos Martín Nieto2013-11-011-0/+21
|/ | | | | | When downloading the default branch due to lack of refspecs, we still need to write out FETCH_HEAD with the tip we downloaded, unfortunately with a format that doesn't match what we already have.
* Set new multivar values using unmatcheable regexp.Daniel Rodríguez Troitiño2013-11-011-1/+4
| | | | | | | | | | | Seems that regexp in Mac OS X and Linux were behaving differently: while in OS X the empty string didn't match any value, in Linux it was matching all of them, so the the second fetch refspec was overwritting the first one, instead of creating a new one. Using an unmatcheable regular expression solves the problem (and seems to be portable).
* Fix saving remotes with several fetch/push ref specs.Daniel Rodríguez Troitiño2013-11-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | At some moment git_config_delete_entry lost the ability to delete one entry of a multivar configuration. The moment you had more than one fetch or push ref spec for a remote you will not be able to save that remote anymore. The changes in network::remote::remotes::save show that problem. I needed to create a new git_config_delete_multivar because I was not able to remove one or several entries of a multivar config with the current API. Several tries modifying how git_config_set_multivar(..., NULL) behaved were not successful. git_config_delete_multivar is very similar to git_config_set_multivar, and delegates into config_delete_multivar of config_file. This function search for the cvar_t that will be deleted, storing them in a temporal array, and rebuilding the linked list. After calling config_write to delete the entries, the cvar_t stored in the temporal array are freed. There is a little fix in config_write, it avoids an infinite loop when using a regular expression (case for the multivars). This error was found by the test network::remote::remotes::tagopt.
* The "common.h" should be included before "config.h".Cheng Zhao2013-10-281-0/+1
| | | | | | | | | When building libgit2 for ia32 architecture on a x64 machine, including "config.h" without a "common.h" would result the following error: C:\Program Files\Microsoft SDKs\Windows\v7.1\include\winbase.h(2288): error C2373: 'InterlockedIncrement' : redefinition; different type modifiers [C:\cygwin\home\zcbenz\codes\git-utils\build\libgit2.vcxproj] C:\Program Files\Microsoft SDKs\Windows\v7.1\include\winbase.h(2295): error C2373: 'InterlockedDecrement' : redefinition; different type modifiers [C:\cygwin\home\zcbenz\codes\git-utils\build\libgit2.vcxproj] C:\Program Files\Microsoft SDKs\Windows\v7.1\include\winbase.h(2303): error C2373: 'InterlockedExchange' : redefinition; different type modifiers [C:\cygwin\home\zcbenz\codes\git-utils\build\libgit2.vcxproj] C:\Program Files\Microsoft SDKs\Windows\v7.1\include\winbase.h(2314): error C2373: 'InterlockedExchangeAdd' : redefinition; different type modifiers [C:\cygwin\home\zcbenz\codes\git-utils\build\libgit2.vcxproj]
* clone: put the callbacks struct directly in the clone optionsCarlos Martín Nieto2013-10-021-2/+2
| | | | There's no need for this to be a pointer to somewhere else.
* remote: add a convenience 'fetch' function.Carlos Martín Nieto2013-10-021-0/+18
|
* remote: move the credentials callback to the structCarlos Martín Nieto2013-10-021-12/+1
| | | | | Move this one as well, letting us have a single way of setting the callbacks for the remote, and removing fields from the clone options.
* remote: put the _download() callback with the othersCarlos Martín Nieto2013-10-021-5/+2
| | | | | | The text progress and update_tips callbacks are already part of the struct, which was meant to unify the callback setup, but the download one was left out.
* Remove regex usage from places that don't need itRussell Belfer2013-09-231-29/+15
| | | | | | | | | | | In revwalk, we are doing a very simple check to see if a string contains wildcard characters, so a full regular expression match is not needed. In remote listing, now that we have git_config_foreach_match with full regular expression matching, we can take advantage of that and eliminate the regex here, replacing it with much simpler string manipulation.
* Merge pull request #1840 from linquize/warningVicent Martí2013-09-211-2/+2
|\ | | | | Fix warning
| * Fix warningLinquize2013-09-191-2/+2
| |
* | No such thing as an orphan branchCarlos Martín Nieto2013-09-171-1/+1
|/ | | | | | | | | | | Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
* Merge pull request #1803 from libgit2/ntk/topic/even_more_lenient_remote_parsingVicent Martí2013-08-281-11/+35
|\ | | | | Even more lenient remote parsing
| * remote: Make git_remote_list() detect pushurlnulltoken2013-08-271-2/+4
| |
| * remote: Relax the parsing logic even morenulltoken2013-08-271-8/+25
| | | | | | | | | | | | In order to be loaded, a remote needs to be configured with at least a `url` or a `pushurl`. ENOTFOUND will be returned when trying to git_remote_load() a remote with neither of these entries defined.
| * remote: Don't parse missing urls as empty stringsnulltoken2013-08-271-1/+1
| |
| * remote: Warn the user when connecting with no urlnulltoken2013-08-271-1/+4
| |
| * remote: Assert proper GIT_DIRECTION_XXXX valuesnulltoken2013-08-271-0/+2
| |
* | Merge pull request #1772 from libgit2/config-iterVicent Martí2013-08-281-1/+1
|\ \ | |/ |/| Configuration iterators redux
| * config: get_multivar -> get_multivar_foreachCarlos Martín Nieto2013-08-081-1/+1
| | | | | | | | | | The plain function will return an iterator, so move this one out of the way.
* | Merge pull request #1780 from phkelley/developmentVicent Martí2013-08-141-2/+27
|\ \ | | | | | | Respect GIT_SSL_NO_VERIFY and http.sslVerify
| * | Respect GIT_SSL_NO_VERIFY and http.sslVerifyPhilip Kelley2013-08-131-2/+27
| |/
* | remote: relax the url rulesCarlos Martín Nieto2013-08-141-6/+0
|/ | | | | | | | | | | | | Accept any value for the remote's url, including an empty string which we used to reject as invalid configuration. This is not quite what git does (although it has its own problems with such configurations) and it makes it harder to fix the issue, by not letting the user modify it. As we already need to check for a valid URL when we try to connect to the network, let that perform the check, as we don't need to do it anywhere else.
* Add `git_remote_owner`Etienne Samson2013-07-151-0/+6
|
* Fix some memory leaksRussell Belfer2013-06-101-1/+3
|
* Merge pull request #1624 from libgit2/vmg/full-ref-iteratorVicent Martí2013-06-031-39/+13
|\ | | | | Breaking RefDB changes
| * ...Aaaand this worksVicent Marti2013-05-301-4/+1
| |
| * Liike thisVicent Marti2013-05-281-36/+13
| |
* | Proposal to handle default value (auto = 0)yorah2013-05-301-6/+1
| |
* | remote: make default tag retrieving behaviour consistentyorah2013-05-301-6/+5
|/ | | | | Default for newly created remotes will be auto. Default when loading existing remotes with no tag retrieving behaviour set, was already auto.
* Fetch should not fail when remote HEAD reference is not present locallyJameson Miller2013-05-151-13/+0
|
* Merge pull request #1385 from carlosmn/refs-iterEdward Thomson2013-05-111-14/+19
|\ | | | | Introduce a refs iterator
| * Move a couple more functions to use iteratorsCarlos Martín Nieto2013-05-111-13/+19
| |
| * refs: remove the OID/SYMBOLIC filteringCarlos Martín Nieto2013-05-111-1/+0
| | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #1561 from arrbee/fix-windows-diff-eofnlVicent Martí2013-05-091-1/+1
|\ \ | | | | | | Fix windows diff eofnl error
| * | Fix win32 type warningsRussell Belfer2013-05-071-1/+1
| | |
* | | remote: correctly interpret tagopt '--tags'Carlos Martín Nieto2013-05-071-10/+18
|/ / | | | | | | | | | | | | When tagopt is set to '--tags', we should only take the default tags refspec into account and ignore any configured ones. Bring the code into compliance.
* | Factor out some code that needed to clear errorsRussell Belfer2013-05-011-43/+42
|/ | | | | | | A number of places were looking up option config values and then not clearing the error codes if the values were not found. This moves the repeated pattern into a shared routine and adds the extra call to giterr_clear() when needed.
* 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
| |
* | remote: fix a leak when dwim'ing refspecsCarlos Martín Nieto2013-04-301-0/+1
| |
* | remote: add resfpec list accessorsCarlos Martín Nieto2013-04-301-0/+26
| | | | | | | | | | | | Bring back a way of acessing the git_refspec* from a remote. Closes #1514
* | remote: dwim the refspecs according to the remote's advertised refsCarlos Martín Nieto2013-04-281-9/+85
|/ | | | | As git allows you to store shorthand refspecs in the configuration, we need to do this ourselves.
* refspec: unify the string and parsed dataCarlos Martín Nieto2013-04-201-45/+19
| | | | | | | | 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: allow querying for refspecsCarlos Martín Nieto2013-04-201-2/+50
| | | | | | | | Introduce git_remote_{fetch,push}_refspecs() to get a list of refspecs from the remote and rename the refspec-adding functions to a less silly name. Use this instead of the vector index hacks in the tests.
* remote: handle multiple refspecsCarlos Martín Nieto2013-04-201-149/+236
| | | | | | | | | | | | | 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.
* remote: don't try to update FETCH_HEAD if no extra heads existCarlos Martín Nieto2013-04-161-0/+4
| | | | | | | | Don't try to update anything if there are no heads to update. This saves us from trying to look into a fetch refspec when there is none. A better fix for compatibility with git when using remotes without refspecs is still needed, but this stops us from segfaulting.