Commit Graph

6624 Commits

Author SHA1 Message Date
Carlos Martín Nieto
67d4997a7e remote: mark branch for-merge even if we're unborn
When the current branch is unborn, git will still mark the current
branch's upstream for-merge if there is an upstream configuration. The
only non-constrived case is cloning from an empty repository which then
gains history. origin's master should be marked for-merge.

In order to do this, we cannot use the high-level wrappers that expect a
reference, as we may not have one. Move over to the internal ones that
expect a reference name, which we do have.
2014-04-02 20:22:22 +02:00
Carlos Martín Nieto
6f6be8fe41 remote: write tests for cloning from an empty repo
Cloning from an empty repo must set master's upstream to origin's
master, even if neither of them exist.

Fetching from a non-empty origin must then mark the master branch
for-merge. This currently fails.
2014-04-02 20:22:22 +02:00
Vicent Marti
0f65733b08 Clar: skip tests 2014-04-02 18:50:47 +02:00
Vicent Marti
64a862c2b8 Merge pull request #2237 from mekishizufu/fix_return_value
Fix submodule_is_config_only's return value
2014-04-02 18:48:38 +02:00
Jiri Pospisil
49653665d1 checkout: Fix submodule_is_config_only's return value 2014-04-02 18:21:41 +02:00
Vicent Marti
fe23860aac Merge pull request #2230 from anuraggup/revwalk-merge-base
No need to find merge base.
2014-04-02 17:45:25 +02:00
Russell Belfer
ada157b237 Add warning when skipping blame test 2014-04-02 07:45:16 -07:00
Vicent Marti
bb63baea5f Merge pull request #2231 from libgit2/fix-memory-index-doc-comment
Correct a stale reference to GIT_EBAREINDEX
2014-04-02 14:13:01 +02:00
Rob Rix
ddc66e27b6 Give the correct name for the function in the doc.
Per @carlosmn, git_index_add is now named git_index_add_bypath.
2014-04-02 08:02:43 -04:00
Vicent Marti
5b9eac32c3 Merge pull request #2233 from libgit2/rb/fix-untracked-repo-status
Skip untracked contained repo contents even with gitlink files
2014-04-02 13:42:14 +02:00
Russell Belfer
d1a0900442 Skip blame libgit2 test if not in libgit2 repo
One blame test replies on being run from within the libgit2
repository to leverage having a longer history to play with, but
some bundled versions of libgit2 don't have the whole libgit2
history.  This just skips that test if the repository can't be
opened.
2014-04-01 21:58:48 -07:00
Russell Belfer
a574d584df New tests of status for repo inside repo 2014-04-01 21:32:06 -07:00
Russell Belfer
ea1ca3c921 Fix skipping content of contained repos
When doing a diff for use in status, we should never show the
content of a git repository contained inside another one.  The
logic to do this was looking for a .git directory and so when a
gitlink plain .git file was used, it was failing to exclude the
directory content.
2014-04-01 21:30:52 -07:00
Russell Belfer
8f4e5275e4 More tests and fix submodule index refresh
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.
2014-04-01 16:46:25 -07:00
Rob Rix
bb439de039 Correct a stale reference to GIT_EBAREINDEX 2014-04-01 16:37:19 -04:00
Russell Belfer
8061d519b3 Remove most submodule reloads from tests
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.
2014-04-01 13:24:06 -07:00
Russell Belfer
4ece3e225b Fix submodule accounting for name and path changes
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.
2014-04-01 12:19:11 -07:00
Carlos Martín Nieto
f28e4c97b3 refspec: git_refspec_parse() does not exist 2014-04-01 20:18:36 +02:00
Russell Belfer
aa78c9ba77 Minor submodule cache locking improvements
This improvement the management of the lock around submodule cache
updates slightly, using the lock to make sure that foreach can
safely make a snapshot of all existing submodules and making sure
that git_submodule_add_setup also grabs a lock before inserting
the new submodule.  Cache initialization / refresh should already
have been holding the lock correctly as it adds submodules.
2014-04-01 10:22:51 -07:00
Russell Belfer
eeeb9654f0 Reinstate efficient submodule reloading
This makes it so that git_submodule_reload_all will actually only
reload changed items unless the `force` flag is used.
2014-04-01 09:49:58 -07:00
Russell Belfer
a4ccd2b001 Use enums instead of bools for submodule options
When forcing cache flushes or reload, etc., it is easier to keep
track of intent using enums instead of plain bools.  Also, this
fixes a bug where the cache was not being properly refreshes by
a git_submodule_reload_all.
2014-04-01 09:49:58 -07:00
Russell Belfer
db0e7878d3 Make submodule refresh a bit smarter
This makes submodule cache refresh actually look at the timestamps
from the data sources for submodules and reload as needed if they
have changed since the last refresh.
2014-04-01 09:48:37 -07:00
Russell Belfer
69b6ffc4c5 Make a real submodule cache object
This takes the old submodule cache which was just a git_strmap
and makes a real git_submodule_cache object that can contain other
things like a lock and timestamp-ish data to control refreshing of
submodule info.
2014-04-01 09:48:37 -07:00
Russell Belfer
d543d59cf0 Add some funny options for debugging status
This allows you to use a --repeat option to run status over and
over and see how the output changes as you make local directory
changes without reopening the git_repository object each time.

Also, adds a flag to explicitly list the submodules before status.
2014-04-01 09:45:20 -07:00
Russell Belfer
e402d2f134 Submodule sync refactoring
Turns out there was already a helper to do what I wanted to do,
so I just made it so that I could use it for sync and switched to
that instead.
2014-04-01 09:45:20 -07:00
Russell Belfer
8286300a1e Fix git_submodule_sync and add new config helper
This fixes `git_submodule_sync` to correctly update the remote URL
of the default branch of the submodule along with the URL in the
parent repository config (i.e. match core Git's behavior).

Also move some useful helper logic from the submodule code into
a shared config API `git_config__update_entry` that can either set
or delete an entry with constraints like not overwriting or not
creating a new entry.  I used that helper to update a couple other
places in the code.
2014-04-01 09:45:20 -07:00
Russell Belfer
18234b14ad Add efficient git_buf join3 API
There are a few places where we need to join three strings to
assemble a path.  This adds a simple join3 function to avoid the
comparatively expensive join_n (which calls strlen on each string
twice).
2014-04-01 09:45:20 -07:00
Russell Belfer
2450d4c63a Merge pull request #2208 from libgit2/vmg/mempack
In-memory packing backend
2014-04-01 09:33:18 -07:00
Edward Thomson
d67397dd0c Merge pull request #2226 from libgit2/rb/submodule-sorting-fix
Fix submodule sort order during iteration
2014-04-01 09:32:17 -07:00
Vicent Marti
82e1c1af85 Merge pull request #2229 from linquize/Wdeclaration-after-statement
Add CFLAGS -Wdeclaration-after-statement
2014-04-01 17:21:04 +02:00
Linquize
9e1ed9f2c0 Add CFLAGS -Wdeclaration-after-statement
This warns local variables declarations after statement, which helps not to break MSVC
2014-04-01 23:01:40 +08:00
Vicent Marti
a2d18a0219 Merge pull request #2228 from mekishizufu/example_short_id
Use git_object_short_id in examples
2014-04-01 13:47:52 +02:00
Vicent Marti
9325460a93 Merge pull request #2206 from libgit2/cmn/inmemory-swap-order
Rename in-memory remote to anonymous and swap url and fetch order
2014-04-01 13:47:44 +02:00
Carlos Martín Nieto
fd536d29c1 remote: rename inmemory to anonymous and swap url and fetch order
The order in this function is the opposite to what
create_with_fetchspec() has, so change this one, as url-then-refspec is
what git does.

As we need to break compilation and the swap doesn't do that, let's take
this opportunity to rename in-memory remotes to anonymous as that's
really what sets them apart.
2014-04-01 13:38:04 +02:00
Jiri Pospisil
6ad59ef1d4 examples: Use git_object_short_id 2014-04-01 12:16:40 +02:00
Edward Thomson
3ab5781601 Merge pull request #2178 from libgit2/rb/fix-short-id
Fix git_odb_short_id and git_odb_exists_prefix bugs
2014-03-31 23:23:32 -07:00
Anurag Gupta
3bc3d79761 No need to find merge base. 2014-03-31 15:15:32 -07:00
Russell Belfer
b76b5d3427 Improve test of submodule name sorting 2014-03-31 13:33:11 -07:00
Russell Belfer
7dcd42a55f Cleanups 2014-03-31 13:31:01 -07:00
Russell Belfer
c856f8c503 Fix submodule sorting in workdir iterator
With the changes to how git_path_dirload_with_stat handles things
that look like submodules, submodules could end up sorted in the
wrong order with the workdir iterator.  This moves the submodule
check earlier in the iterator processing of a new directory so
that the submodule name updates will happen immediately and the
sort order will be correct.
2014-03-31 12:41:29 -07:00
Russell Belfer
945c92a5cf Add faster git_submodule__is_submodule check 2014-03-31 12:40:58 -07:00
Vicent Marti
fad0412027 Merge pull request #2224 from ethomson/merge_file_const
Const up members of git_merge_file_result
2014-03-31 20:15:35 +02:00
Edward Thomson
7f930ded88 Const up members of git_merge_file_result 2014-03-31 11:08:31 -07:00
Vicent Marti
336e895721 Merge pull request #2222 from ethomson/merge_head_id
Introduce git_merge_head_id
2014-03-31 19:17:01 +02:00
Edward Thomson
976634c467 Introduce git_merge_head_id 2014-03-31 11:43:38 -05:00
Carlos Martín Nieto
088334278b Merge pull request #2219 from tiennou/reset-need-pack
Don't reset need_pack
2014-03-31 18:43:13 +02:00
Etienne Samson
31143b3655 Don't reset need_pack
While looping over multiple heads, an up-to-date head will clobber the `remote->need_pack` setting, preventing the rest of the machinery from building and downloading a pack-file, breaking fetches.
2014-03-30 19:08:56 +02:00
Edward Thomson
7b445c2195 Merge pull request #2216 from ethomson/clar
Update clar to 4b75388
2014-03-29 20:05:06 -07:00
Edward Thomson
ed38bff16c Update clar to 4b75388 2014-03-28 19:15:55 -07:00
Vicent Marti
71ba28e3a5 Merge pull request #2214 from ethomson/sandbox_config
RFC: Sandbox HOME during test execution
2014-03-28 19:03:37 +01:00