Commit Graph

6448 Commits

Author SHA1 Message Date
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
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
Edward Thomson
e0d61c7b1c Sandbox configuration during test runs 2014-03-28 10:39:15 -07:00
Edward Thomson
10be94e9dc Update clar to 587f88a 2014-03-28 10:39:07 -07:00
Vicent Marti
04d4d674fe Merge pull request #2212 from libgit2/rb/submodule-use-after-free
Fix use-after-free in submodule reload code and other memory leaks
2014-03-27 23:40:28 +01:00
Russell Belfer
dae8ba6e09 Fix memory leak of test repository object 2014-03-27 15:29:32 -07:00
Russell Belfer
acdc7cff2e Fix memory leak of submodule branch name 2014-03-27 15:29:17 -07:00
Russell Belfer
add8db06f9 Fix use-after-free in submodule reload
If the first call to release a no-longer-existent submodule freed
the object, the check if a second is needed would dereference the
data that was just freed.
2014-03-27 15:28:29 -07:00
Vicent Marti
041fad4aac Merge pull request #2210 from libgit2/rb/submodule-api-with-no-submodules
Fix segfault if gitmodules is invalid
2014-03-27 08:32:46 +01:00
Russell Belfer
380f864a10 Fix error when submodule path and name differ
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.
2014-03-26 16:06:21 -07:00
Russell Belfer
22df47cbc5 Fix segfault if gitmodules is invalid
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.
2014-03-26 14:38:26 -07:00
Vicent Marti
f4afcaa0d5 Merge pull request #2209 from ethomson/cleanup
Cleanup some warnings and mem leaks
2014-03-26 19:37:01 +01:00
Edward Thomson
9cb99e8b85 Free temporary merge index 2014-03-26 12:43:41 -05:00
Edward Thomson
2b848e47c1 Decorate unused params as unused in revwalk::hidecb tests 2014-03-26 12:33:37 -05:00
Vicent Marti
dc7efa1aef Merge pull request #2204 from libgit2/rb/submodule-reference-counting
Make submodules externally refcounted
2014-03-26 18:29:34 +01:00
Vicent Marti
6105d59707 In-memory packing backend 2014-03-26 18:17:08 +01:00
Vicent Marti
77b699e0da Merge pull request #2205 from libgit2/rb/submodule-untracked-vs-ignored
Update behavior for untracked contained repositories
2014-03-26 10:29:11 +01:00
Vicent Marti
fcbbe1bd82 Merge pull request #2166 from ethomson/giterr_restore
clone: don't overwrite original error message
2014-03-26 10:27:42 +01:00
Edward Thomson
1df8ad01d7 clone: don't overwrite original error message 2014-03-25 21:54:42 -07:00
Edward Thomson
f2f2d97f1e Test for giterr_capture 2014-03-25 21:54:41 -07:00
Russell Belfer
591e82952a Fix submodule leaks and invalid references
This cleans up some places I missed that could hold onto submodule
references and cleans up the way in which the repository cache is
both reloaded and released so that existing submodule references
aren't destroyed inappropriately.
2014-03-25 16:52:01 -07:00
Russell Belfer
d3bc95fd66 Update behavior for untracked sub-repos
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.
2014-03-25 12:37:05 -07:00
Edward Thomson
451aaf866a Merge pull request #2181 from anuraggup/hide_cb
Callback function to hide commit and its parents in revision walker
2014-03-25 10:33:18 -07:00
Russell Belfer
a15c7802c8 Make submodules externally refcounted
`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.
2014-03-25 09:14:48 -07:00
Anurag Gupta
34ffe22344 Modified test for revwalk_hidecb 2014-03-24 11:21:01 -07:00
Anurag Gupta
892b7c9fef Correcting format of comments in header file 2014-03-24 11:20:51 -07:00
Anurag Gupta
169fb81d87 Undoing local change done for building on x64 2014-03-24 11:20:41 -07:00