Commit Graph

75 Commits

Author SHA1 Message Date
Pirate Praveen
c25aa7cd82 New upstream version 1.3.0+dfsg.1 2021-12-10 16:42:08 +05:30
Utkarsh Gupta
22a2d3d5ef New upstream version 1.1.0+dfsg.1 2020-12-07 04:06:37 +05:30
Jongmin Kim
ac3d33df5d New upstream version 0.28.1+dfsg.1 2019-05-12 00:29:21 +09:00
Raju Devidas
6c7cee4230 New upstream version 0.27.7+dfsg.1 2018-12-27 01:36:29 +05:30
Ximin Luo
4b3ec53c78 New upstream version 0.27.4+dfsg.1 2018-08-10 19:43:40 -07:00
Pirate Praveen
eae0bfdcd8 New upstream version 0.27.0+dfsg.1 2018-04-26 18:06:07 +05:30
Patrick Steinhardt
2696c5c3ec repository: make check if repo is a worktree more strict
To determine if a repository is a worktree or not, we currently check
for the existence of a "gitdir" file inside of the repository's gitdir.
While this is sufficient for non-broken repositories, we have at least
one case of a subtly broken repository where there exists a gitdir file
inside of a gitmodule. This will cause us to misidentify the submodule
as a worktree.

While this is not really a fault of ours, we can do better here by
observing that a repository can only ever be a worktree iff its common
directory and dotgit directory are different. This allows us to make our
check whether a repo is a worktree or not more strict by doing a simple
string comparison of these two directories. This will also allow us to
do the right thing in the above case of a broken repository, as for
submodules these directories will be the same. At the same time, this
allows us to skip the `stat` check for the "gitdir" file for most
repositories.
2017-05-19 09:44:44 +02:00
Patrick Steinhardt
e526fbc703 tests: add test suite for opening submodules 2017-05-17 09:41:48 +02:00
Edward Thomson
a1dcc83030 tests: provide better pass/failure error messages
Provide more detailed messages when conditions pass or fail
unexpectedly.  In particular, this provides the error messages when a
test fails with a different error code than was expected.
2017-02-17 12:58:57 +00:00
Brock Peabody
4d99c4cfc6 Allow for caching of submodules.
Added `git_repository_submodule_cache_all` to initialze a cache of
submodules on the repository so that operations looking up N
submodules are O(N) and not O(N^2).  Added a
`git_repository_submodule_cache_clear` function to remove the cache.

Also optimized the function that loads all submodules as it was itself
O(N^2) w.r.t the number of submodules, having to loop through the
`.gitmodules` file once per submodule.  I changed it to process the
`.gitmodules` file once, into a map.

Signed-off-by: David Turner <dturner@twosigma.com>
2017-01-20 17:33:56 -05:00
Edward Thomson
74ab5f2cd0 status: test submodules with mixed case 2016-03-31 17:58:43 -04:00
Dmitriy Olshevskiy
91f0d186b4 typos in comments 2015-12-21 22:18:07 +03:00
Edward Thomson
790012ce78 submodule: test updating a submodule w/ a path
Test that `git_submodule_update` can handle a submodule that is
freshly cloned and has a path differing from its name.
2015-11-04 16:53:41 -05:00
Carlos Martín Nieto
aebddbe736 Merge pull request #3434 from ethomson/reservednames
Win32 Reserved names: don't reserve names outside the working directory
2015-09-21 06:01:03 +02:00
Edward Thomson
e8ddd8d76c repo::reservedname: test a submodule update
Test an initial submodule update, where we are trying to checkout
the submodule for the first time, and placing a file within the
submodule working directory with the same name as the submodule
(and consequently, the same name as the repository itself).
2015-09-18 12:17:49 -04:00
Carlos Martín Nieto
dfe2856d0f Fix a couple of warnings 2015-09-18 12:06:55 +02:00
Edward Thomson
ac2fba0ecd git_futils_mkdir_*: make a relative-to-base mkdir
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
assumes that we own everything beneath the base, as if it were
being called with a base of the repository or working directory,
and is tailored towards checkout and ensuring that there is no
bogosity beneath the base that must be cleaned up.

This is (at best) slow and (at worst) unsafe in the larger context
of a filesystem where we do not own things and cannot do things like
unlink symlinks that are in our way.
2015-09-17 10:00:35 -04:00
Carlos Martín Nieto
a3b9731ff8 submodule: add a test for a renamed submdoule dir 2015-09-10 21:23:03 +02:00
Edward Thomson
ed1c64464a iterator: use an options struct instead of args 2015-08-28 18:39:47 -04:00
Edward Thomson
2dfd5eae33 Merge pull request #3307 from libgit2/cmn/submodule-backslash
Normalize submodule urls before looking at them
2015-07-24 15:05:16 -05:00
Edward Thomson
759b2230a5 Merge pull request #3303 from libgit2/cmn/index-add-submodule
Allow adding a submodule through git_index_add_bypath
2015-07-24 15:04:20 -05:00
Carlos Martín Nieto
aa51fa1e03 submodule: add failing test for backslash in url 2015-07-13 08:39:35 +02:00
Carlos Martín Nieto
0d98af0911 blob: fail to create a blob from a dir with EDIRECTORY
This also affects `git_index_add_bypath()` by providing a better error
message and a specific error code when a directory is passed.
2015-07-12 12:11:22 +02:00
Carlos Martín Nieto
a34c4f8dce submdule: reproduce double-reporting of a submodule in foreach
When we rename a submodule, we should be merging two sets of information
based on whether their path is the same. We currently only deduplicate
on equal name, which causes us to double-report.
2015-07-11 13:32:57 +02:00
Carlos Martín Nieto
e8e848a8da submodule: add failing test for loading the wrong submodule
When two submodules are fairly similar, we may end up loading the wrong
one.
2015-07-01 21:14:55 +02:00
Carlos Martín Nieto
34065968ed submodule: completely remove reload_all
The function was removed, but its declaration and changelog entry about
its removal were forgotten.

The comment in the test doesn't make any sense as the function doesn't
exist anymore, so get rid of it as well.
2015-07-01 17:49:07 +02:00
Carlos Martín Nieto
c28a5c972d submodule: remove trailing slashes from submodule paths
We allow looking up a submodule by path, but we lost the path
normalisation during the recent changes. Bring it back.
2015-06-29 21:10:47 +02:00
Carlos Martín Nieto
c2418f4613 Rename FALLBACK to UNSPECIFIED
Fallback describes the mechanism, while unspecified explains what the
user is thinking.
2015-06-25 12:48:44 +02:00
Carlos Martín Nieto
0496330004 submodule: test unsetting config options
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.
2015-06-22 17:02:56 +02:00
Carlos Martín Nieto
4536574acc submodule: test more accurately for non-existence
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.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
adb58f7d64 submodule: fix potential leak in the tests 2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
961861fafa submodule: get rid of _save()
We no longer have any setters which affect an instance, so
`git_submodule_save()` is no longer relevant.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
d6073b30f3 submodule: make _set_url() affect the configuration
With this one, we can get rid of the edit_and_save test.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
486ba4cdd3 submodule: make _set_branch() affect the configuration 2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
4e63642321 submodule: make _set_update_fetch_recurse_submodules() affect the config
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.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
e8a39f8ed1 submodule: make _set_update() affect the configuration
Moving on with the removal of runtime-changing variables, the update
setting for a remote is whatever it was when it was looked up.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
c6f489c964 submodule: add an ignore option to status
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.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
64bbd47a32 submodule: don't let status change an existing instance
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.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
5a9fc6c83c submodule: make set_ignore() affect the configuration
Instead of affecting a particular instance, make it change the
configuration.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
dfda2f68ea submodule: remove the per-repo cache
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.
2015-06-22 17:02:54 +02:00
Carlos Martín Nieto
3e529e9d2d Fix a few leaks
The interesting one is the notification macro, which was returning
directly on a soft-abort instead of going through the cleanup.
2015-05-13 16:40:18 +02:00
Carlos Martín Nieto
8f0104ecc5 Remove the callbacks struct from the remote
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.
2015-05-13 09:46:35 +02:00
Patrick Steinhardt
129788a623 Implement git_submodule_set_branch. 2015-04-12 10:51:08 +02:00
Patrick Steinhardt
e6903ea278 Fix git_submodule_sync writing URL to wrong key.
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).
2015-03-12 16:05:07 +01:00
Carlos Martín Nieto
9a97f49e3a config: borrow refcounted references
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.
2015-03-03 18:35:12 +01:00
Carlos Martín Nieto
4e498646b6 repository: remove log message override for switching the active branch
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.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
659cf2029f Remove the signature from ref-modifying functions
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.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
fe8399fe9b Fix warning 2015-01-09 16:29:08 +01:00
Edward Thomson
365d367238 submodule::init tests: free some leaks 2015-01-08 22:31:15 +00:00
Jameson Miller
9d1f97df10 Introduce a convenience function for submodule update
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.
2014-12-22 16:37:35 -05:00