summaryrefslogtreecommitdiff
path: root/tests/submodule
Commit message (Collapse)AuthorAgeFilesLines
* Rename FALLBACK to UNSPECIFIEDcmn/rename-unspecifiedCarlos Martín Nieto2015-06-252-10/+10
| | | | | Fallback describes the mechanism, while unspecified explains what the user is thinking.
* submodule: test unsetting config optionsCarlos Martín Nieto2015-06-221-13/+29
| | | | | | In addition to mapping enums to strings in the configuration, we need to know to delete the configuration option when given the "none" or "no" option.
* submodule: test more accurately for non-existenceCarlos Martín Nieto2015-06-221-4/+4
| | | | | | The current code will always fail, but only because it's asking for a string on a live config. Take a snapshot and make sure we fail with ENOTFOUND instead of any old error.
* submodule: fix potential leak in the testsCarlos Martín Nieto2015-06-221-2/+1
|
* submodule: get rid of `_save()`Carlos Martín Nieto2015-06-221-9/+0
| | | | | We no longer have any setters which affect an instance, so `git_submodule_save()` is no longer relevant.
* submodule: make `_set_url()` affect the configurationCarlos Martín Nieto2015-06-222-42/+9
| | | | With this one, we can get rid of the edit_and_save test.
* submodule: make `_set_branch()` affect the configurationCarlos Martín Nieto2015-06-221-14/+20
|
* submodule: make `_set_update_fetch_recurse_submodules()` affect the configCarlos Martín Nieto2015-06-221-28/+16
| | | | | | Similarly to the other ones. In this test we copy over testing `RECURSE_YES` which shows an error in our handling of the `YES` variant which we may have to port to the rest.
* submodule: make `_set_update()` affect the configurationCarlos Martín Nieto2015-06-221-21/+11
| | | | | Moving on with the removal of runtime-changing variables, the update setting for a remote is whatever it was when it was looked up.
* submodule: add an ignore option to statusCarlos Martín Nieto2015-06-223-48/+37
| | | | | | | | | | | | | This lets us specify in the status call which ignore rules we want to use (optionally falling back to whatever the submodule has in its configuration). This removes one of the reasons for having `_set_ignore()` set the value in-memory. We re-use the `IGNORE_RESET` value for this as it is no longer relevant but has a similar purpose to `IGNORE_FALLBACK`. Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of initializers and move that to fall back to the configuration as well.
* submodule: don't let status change an existing instanceCarlos Martín Nieto2015-06-222-14/+24
| | | | | | As submodules are becomes more like values, we should not let a status check to update its properties. Instead of taking a submodule, have status take a repo and submodule name.
* submodule: make set_ignore() affect the configurationCarlos Martín Nieto2015-06-222-17/+12
| | | | | Instead of affecting a particular instance, make it change the configuration.
* submodule: remove the per-repo cacheCarlos Martín Nieto2015-06-222-46/+0
| | | | | | | | | | | | | Having this cache and giving them out goes against our multithreading guarantees and it makes it impossible to use submodules in a multi-threaded environment, as any thread can ask for a refresh which may reallocate some string in the submodule struct which we've accessed in a different one via a getter. This makes the submodules behave more like remotes, where each object is created upon request and not shared except explicitly by the user. This means that some tests won't pass yet, as they assume they can affect the submodule objects in the cache and that will affect later operations.
* Fix a few leaksCarlos Martín Nieto2015-05-131-0/+1
| | | | | The interesting one is the notification macro, which was returning directly on a soft-abort instead of going through the cleanup.
* Remove the callbacks struct from the remoteCarlos Martín Nieto2015-05-131-2/+2
| | | | | | | | | | | | | | Having the setting be different from calling its actions was not a great idea and made for the sake of the wrong convenience. Instead of that, accept either fetch options, push options or the callbacks when dealing with the remote. The fetch options are currently only the callbacks, but more options will be moved from setters and getters on the remote to the options. This does mean passing the same struct along the different functions but the typical use-case will only call git_remote_fetch() or git_remote_push() and so won't notice much difference.
* Implement git_submodule_set_branch.Patrick Steinhardt2015-04-121-3/+25
|
* Fix git_submodule_sync writing URL to wrong key.Patrick Steinhardt2015-03-121-3/+3
| | | | | | | | Currently git_submodule_sync writes the submodule's URL to the key 'branch.<REMOTE_NAME>.remote' while the reference implementation of `git submodule sync` writes to 'remote.<REMOTE_NAME>.url', which is the intended behavior according to git-submodule(1).
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-034-36/+16
| | | | | | | | | | | | | | | This changes the get_entry() method to return a refcounted version of the config entry, which you have to free when you're done. This allows us to avoid freeing the memory in which the entry is stored on a refresh, which may happen at any time for a live config. For this reason, get_string() has been forbidden on live configs and a new function get_string_buf() has been added, which stores the string in a git_buf which the user then owns. The functions which parse the string value takea advantage of the borrowing to parse safely and then release the entry.
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-032-4/+4
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-033-9/+6
| | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* Fix warningCarlos Martín Nieto2015-01-091-1/+1
|
* submodule::init tests: free some leaksEdward Thomson2015-01-081-1/+5
|
* Introduce a convenience function for submodule updatejamill/submodule_updateJameson Miller2014-12-224-6/+424
| | | | | | | | | This introduces the functionality of submodule update in 'git_submodule_do_update'. The existing 'git_submodule_update' function is renamed to 'git_submodule_update_strategy'. The 'git_submodule_update' function now refers to functionality similar to `git submodule update`, while `git_submodule_update_strategy` is used to get the configured value of submodule.<name>.update.
* submodule init should resolve relative url pathsJameson Miller2014-12-224-0/+89
| | | | | Submodule init should handle relative paths in .gitmodules files and resolve these urls when updating the git config file.
* remote: rename _load() to _lookup()cmn/remote-lookupCarlos Martín Nieto2014-11-081-1/+1
| | | | This brings it in line with the rest of the lookup functions.
* iterator: submodules are determined by an index or treecmn/submodule-and-dirCarlos Martín Nieto2014-11-071-1/+4
| | | | | | | | | | | | We cannot know from looking at .gitmodules whether a directory is a submodule or not. We need the index or tree we are comparing against to tell us. Otherwise we have to assume the entry in .gitmodules is stale or otherwise invalid. Thus we pass the index of the repository into the workdir iterator, even if we do not want to compare against it. This follows what git does, which even for `git diff <tree>`, it will consider staged submodules as such.
* submodule test: free submoduleEdward Thomson2014-10-261-0/+1
|
* remote: accept a repo and name for renamingcmn/remote-renameCarlos Martín Nieto2014-10-241-3/+1
| | | | | | | | | | Remote objects are not meant to be changed from under the user. We did this in rename, but only the name and left the refspecs, such that a save would save the wrong refspecs (and a fetch and anything else would use the wrong refspecs). Instead, let's simply take a name and not change any loaded remote from under the user.
* Introduce option to use relative paths for repository work directoryjamill/relative_gitlinkJameson Miller2014-09-022-0/+60
| | | | | | | Teach git_repository_init_ext to use relative paths for the gitlink to the work directory. This is used when creating a sub repository where the sub repository resides in the parent repository's .git directory.
* Merge pull request #2407 from libgit2/cmn/remote-rename-morev0.21.0-rc1Vicent Marti2014-06-081-1/+4
|\ | | | | More remote rename fixes
| * remote: return problem refspecs instead of using a callbackCarlos Martín Nieto2014-06-061-1/+4
| | | | | | | | | | | | There is no reason why we need to use a callback here. A string array fits better with the usage, as this is not an event and we don't need anything from the user.
* | Win32: Fix diff::workdir::submodules test #2361Philip Kelley2014-06-071-2/+2
|/
* Test (and fix) the git_submodule_sync changesRussell Belfer2014-04-031-8/+26
| | | | | I wrote this stuff a while ago and forgot to write tests. Wanted to do so now to wrap up the PR and immediately found problems.
* Minor code cleanupRussell Belfer2014-04-031-30/+32
|
* git_submodule_resolve_url supports relative urlsJan Melcher2014-04-032-73/+115
| | | | | | | | | | | The base for the relative urls is determined as follows, with descending priority: - remote url of HEAD's remote tracking branch - remote "origin" - workdir This follows git.git behaviour
* Test git_submodule_add_setup with relative urlJan Melcher2014-04-031-0/+24
|
* More tests and fix submodule index refreshRussell Belfer2014-04-013-13/+129
| | | | | | | | | | There was a little bug where the submodule cache thought that the index date was out of date even when it wasn't that was resulting in some extra scans of index data even when not needed. Mostly this commit adds a bunch of new tests including adding and removing submodules in the index and in the HEAD and seeing if we can automatically pick them up when refreshing.
* Remove most submodule reloads from testsRussell Belfer2014-04-012-29/+55
| | | | | | | | | | | With the new submodule cache validity checks, we generally don't need to call git_submodule_reload_all to have up-to-date submodule data. Some tests are still calling it where I want to actually test that it can be called safely and doesn't break anything, but mostly it is not needed. This also expands some of the existing submodule tests to cover some variants on the behavior that was already being tested.
* Fix submodule accounting for name and path changesRussell Belfer2014-04-011-0/+67
| | | | | | | | Wrote tests that try adding, removing, and updating the name of submodules which showed a number of problems with how we account for changes when incrementally updating the submodule info. Most of these issues didn't exist before because reloading would always blow away the old submodule data.
* Fix error when submodule path and name differRussell Belfer2014-03-261-0/+33
| | | | | | | | When a submodule was inserted with a different path and name, the return value from khash greater than zero was allowed to propagate back out to the caller when it should really be zeroed. This led to a possible crash when reloading submodules if that was the first time that submodule data was loaded.
* Fix segfault if gitmodules is invalidRussell Belfer2014-03-261-0/+95
| | | | | | The reload_all call could end up dereferencing a NULL pointer if there was an error while attempting to load the submodules config data (i.e. invalid content in the gitmodules file). This fixes it.
* Merge pull request #2204 from libgit2/rb/submodule-reference-countingVicent Marti2014-03-265-241/+185
|\ | | | | Make submodules externally refcounted
| * Make submodules externally refcountedRussell Belfer2014-03-255-241/+185
| | | | | | | | | | | | | | | | `git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
* | Update behavior for untracked sub-reposRussell Belfer2014-03-251-6/+10
|/ | | | | | | | | | | When a directory containing a .git directory (or even just a plain gitlink) was found, libgit2 was going out of its way to treat it specially. This seemed like it was necessary because the diff code was not originally emulating Git's behavior for untracked directories correctly (i.e. scanning for ignored vs untracked items inside). Now that libgit2 diff mimics Git's untracked directory behavior, the special handling for contained Git repos is actually incorrect and this commit rips it out.
* Make submodule fetchRecurse match other optionsRussell Belfer2014-01-301-14/+20
| | | | | | This removes the fetchRecurse compiler warnings and makes the behavior match the other submodule options (i.e. the in-memory setting can be reset to the on-disk value).
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-1/+1
| | | | | | Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
* Update test related to fetchRecurseSubmodulesLinquize2013-12-311-8/+17
|
* Rename tests-clar to testsBen Straub2013-11-145-0/+982