summaryrefslogtreecommitdiff
path: root/src/submodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3613 from ethomson/fixupsCarlos Martín Nieto2016-02-181-2/+2
|\ | | | | Remove most of the silly warnings
| * submodule: explicitly cast to the teensy time valueEdward Thomson2016-02-161-2/+2
| |
* | Horrible fix for #3173.Arthur Schreiber2016-02-111-3/+3
|/
* Use a typedef for the submodule_foreach callback.joshaber2015-12-081-1/+1
| | | | | | This fits with the style for the rest of the project, but more importantly, makes life easier for bindings authors who auto-generate code.
* submodule: reload HEAD/index after reading configEdward Thomson2015-11-041-24/+18
| | | | | | Reload the HEAD and index data for a submodule after reading the configuration. The configuration may specify a `path`, so we must update HEAD and index data with that path in mind.
* Plug some leaksCarlos Martín Nieto2015-09-271-0/+3
|
* submodule: plug a few leakscmn/plug-smCarlos Martín Nieto2015-09-241-13/+21
|
* submodule: refactor to be more explicit in the searchCarlos Martín Nieto2015-09-101-144/+219
| | | | | | | | | When searching for information about a submdoule, let's be more explicit in what we expect to find. We currently insert a submodule into the map and change certain parameters when the config callback gets called. Switch to asking for the configuration we're interested in, rather than taking it in an arbitrary order.
* iterator: use an options struct instead of argsEdward Thomson2015-08-281-2/+2
|
* Merge pull request #3307 from libgit2/cmn/submodule-backslashEdward Thomson2015-07-241-0/+11
|\ | | | | Normalize submodule urls before looking at them
| * submodule, path: extract slash conversioncmn/submodule-backslashCarlos Martín Nieto2015-07-131-7/+3
| | | | | | | | Extract the backslash-to-slash conversion into a helper function.
| * submodule: normalize slashes in resolve_urlCarlos Martín Nieto2015-07-131-0/+15
| | | | | | | | | | | | Our path functions expect to work with slashes, so convert a path with backslashes into one with slashes at the top of the function.
* | submodule: lookup the submodule by path if availablecmn/submodule-foreach-diff-pathCarlos Martín Nieto2015-07-111-1/+1
|/ | | | | | If we get the path from the gitmodules file, look up the submodule we're interested in by path, rather then by name. Otherwise we might get duplicate results.
* submodule: correctly delimit the keys to use for lookupcmn/submodule-duplicateCarlos Martín Nieto2015-07-011-1/+1
| | | | | | | | | | The regex we use to look at the gitmodules file does not correctly delimit the name of submodule which we want to look up and puts '.*' straight after the name, maching on any submodule which has the seeked submodule as a prefix of its name. Add the missing '\.' in the regex so we want a full stop to exist both before and after the submodule name.
* Merge pull request #3270 from ethomson/warnings2Carlos Martín Nieto2015-06-301-1/+1
|\ | | | | Remove some warnings
| * submodule: cast enum to int for compareEdward Thomson2015-06-291-1/+1
| |
* | submodule: remove trailing slashes from submodule pathsCarlos Martín Nieto2015-06-291-4/+12
| | | | | | | | | | We allow looking up a submodule by path, but we lost the path normalisation during the recent changes. Bring it back.
* | submodule: remove some obsolete logicCarlos Martín Nieto2015-06-291-19/+0
|/ | | | | Remove some of the logic that was left-over from the time we had a cache of submodules, plugging a leak of the submodule object in certain cases.
* Rename FALLBACK to UNSPECIFIEDcmn/rename-unspecifiedCarlos Martín Nieto2015-06-251-2/+2
| | | | | Fallback describes the mechanism, while unspecified explains what the user is thinking.
* submodule: handle writing out all enum values for settingsCarlos Martín Nieto2015-06-221-61/+21
| | | | | | We currently do not handle those enum values which require us to set "true" or unset variables in all cases. Use a common function which does understand this by looking at our mapping directly.
* submodule: get rid of `_save()`Carlos Martín Nieto2015-06-221-38/+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-221-12/+3
| | | | 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-48/+28
|
* submodule: make `_set_update_fetch_recurse_submodules()` affect the configCarlos Martín Nieto2015-06-221-18/+26
| | | | | | 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-24/+28
| | | | | 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: correct detection of existing submodulesCarlos Martín Nieto2015-06-221-10/+26
| | | | | | | | | During the cache deletion, the check for whether we consider a submodule to exist got changed regarding submodules which are in the worktree but not configured. Instead of checking for the url field to be populated, check the location where we've found it.
* submodule: bring back finding by pathCarlos Martín Nieto2015-06-221-0/+42
| | | | | During the removal of the cache, we also removed the ability to use `_lookup()` to search by path rather than name. Bring this logic back.
* submodule: add an ignore option to statusCarlos Martín Nieto2015-06-221-4/+4
| | | | | | | | | | | | | 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-221-4/+13
| | | | | | 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-221-15/+22
| | | | | Instead of affecting a particular instance, make it change the configuration.
* submodule: remove the per-repo cacheCarlos Martín Nieto2015-06-221-501/+269
| | | | | | | | | | | | | 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.
* index: make relative comparison use the checksum as wellcmn/index-checksumCarlos Martín Nieto2015-06-201-3/+2
| | | | | | This is used by the submodule in order to figure out if the index has changed since it last read it. Using a timestamp is racy, so let's make it use the checksum, just like we now do for reloading the index itself.
* Remove the callbacks struct from the remoteCarlos Martín Nieto2015-05-131-1/+1
| | | | | | | | | | | | | | 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-2/+26
|
* Fix git_submodule_sync writing URL to wrong key.Patrick Steinhardt2015-03-121-2/+2
| | | | | | | | 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).
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-2/+2
| | | | | | 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-031-3/+2
| | | | | | | | | | 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.
* Remove extra semicolon outside of a functionStefan Widgren2015-02-151-1/+1
| | | | | Without this change, compiling with gcc and pedantic generates warning: ISO C does not allow extra ‘;’ outside of a function.
* Add extern function to initialize submodule update options.David Calavera2015-01-071-0/+7
|
* submodule: declare vars at top of func blockEdward Thomson2015-01-061-1/+4
|
* Introduce a convenience function for submodule updatejamill/submodule_updateJameson Miller2014-12-221-10/+197
| | | | | | | | | 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-221-10/+24
| | | | | 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-2/+2
| | | | This brings it in line with the rest of the lookup functions.
* Introduce option to use relative paths for repository work directoryjamill/relative_gitlinkJameson Miller2014-09-021-33/+73
| | | | | | | 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.
* Be more careful with user-supplied buffersrb/fix-2333Russell Belfer2014-05-081-1/+3
| | | | | | | | | | | This adds in missing calls to `git_buf_sanitize` and fixes a number of places where `git_buf` APIs could inadvertently write NUL terminator bytes into invalid buffers. This also changes the behavior of `git_buf_sanitize` to NUL terminate a buffer if it can and of `git_buf_shorten` to do nothing if it can. Adds tests of filtering code with zeroed (i.e. unsanitized) buffer which was previously triggering a segfault.
* Attribute file cache refactorRussell Belfer2014-04-171-2/+0
| | | | | | | This is a big refactoring of the attribute file cache to be a bit simpler which in turn makes it easier to enforce a lock around any updates to the cache so that it can be used in a threaded env. Tons of changes to the attributes and ignores code.
* Add diff threading tests and attr file cache locksRussell Belfer2014-04-171-2/+1
| | | | | | This adds a basic test of doing simultaneous diffs on multiple threads and adds basic locking for the attr file cache because that was the immediate problem that arose from these tests.
* Test (and fix) the git_submodule_sync changesRussell Belfer2014-04-031-3/+12
| | | | | 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-78/+47
|
* git_submodule_resolve_url supports relative urlsJan Melcher2014-04-031-53/+83
| | | | | | | | | | | 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