Commit Graph

4488 Commits

Author SHA1 Message Date
Philip Kelley
799f9a04e3 Reduce the number of unnecessary objects in pushed packs 2013-03-19 14:56:45 -04:00
Vicent Martí
7dbf4039ae Merge pull request #1423 from arrbee/submodule-status-errors
Three submodule status bug fixes
2013-03-19 11:47:23 -07:00
Carlos Martín Nieto
0b0ecbec2b clone: fix param comment 2013-03-19 17:42:10 +01:00
Russell Belfer
65025cb893 Three submodule status bug fixes
1. Fix sort order problem with submodules where "mod" was sorting
   after "mod-plus" because they were being sorted as "mod/" and
   "mod-plus/".  This involved pushing the "contains a .git entry"
   test significantly lower in the stack.
2. Reinstate behavior that a directory which contains a .git entry
   will be treated as a submodule during iteration even if it is
   not yet added to the .gitmodules.
3. Now that any directory containing .git is reported as submodule,
   we have to be more careful checking for GIT_EEXISTS when we
   do a submodule lookup, because that is the error code that is
   returned by git_submodule_lookup when you try to look up a
   directory containing .git that has no record in gitmodules or
   the index.
2013-03-18 17:24:13 -07:00
Vicent Martí
5b27bf7e5b Merge pull request #1417 from arrbee/opts-for-paths
Implement opts interface for global/system file search paths
2013-03-18 16:17:14 -07:00
Russell Belfer
324602514f Fixes and cleanups
Get rid of some dead code, tighten things up a bit, and fix a bug
with core::env test.
2013-03-18 15:54:35 -07:00
Russell Belfer
41954a49c1 Switch search paths to classic delimited strings
This switches the APIs for setting and getting the global/system
search paths from using git_strarray to using a simple string with
GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment
PATH variable would contain.  This makes it simpler to get and set
the value.

I also added code to expand "$PATH" when setting a new value to
embed the old value of the path.  This means that I no longer
require separate actions to PREPEND to the value.
2013-03-18 14:19:35 -07:00
Vicent Martí
50eb8520d0 Merge pull request #1420 from KindDragon/static-code-analyzer-warnings
Several warnings detected by static code analyzer fixed
2013-03-18 14:05:31 -07:00
Vicent Martí
677dce8a77 Merge pull request #1080 from carlosmn/config-set-null
Failing config related test
2013-03-18 14:00:09 -07:00
Vicent Martí
15a63e2158 Merge pull request #1418 from QbProg/qb/cmake-msvc
MSVC cmake improvements
2013-03-18 13:55:18 -07:00
Arkadiy Shapkin
10c06114cb Several warnings detected by static code analyzer fixed
Implicit type conversion argument of function to size_t type
Suspicious sequence of types castings: size_t -> int -> size_t
Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)'
Unsigned type is never < 0
2013-03-18 03:30:26 +04:00
QbProg
d66a7c061a Fix for a cmake bug when using MSVC + Win64 + static libraries
(see http://public.kitware.com/Bug/view.php?id=11240)
2013-03-17 10:48:41 +01:00
QbProg
08f32085ab Adds an option to select the CRT link mode ( static or dynamic ).
This is useful when linking libgit2 statically, as the setting must match the linking program's one.
2013-03-17 10:48:34 +01:00
Russell Belfer
5540d9477e Implement global/system file search paths
The goal of this work is to expose the search logic for "global",
"system", and "xdg" files through the git_libgit2_opts() interface.

Behind the scenes, I changed the logic for finding files to have a
notion of a git_strarray that represents a search path and to store
a separate search path for each of the three tiers of config file.
For each tier, I implemented a function to initialize it to default
values (generally based on environment variables), and then general
interfaces to get it, set it, reset it, and prepend new directories
to it.

Next, I exposed these interfaces through the git_libgit2_opts
interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants
for the user to control which search path they were modifying.
There are alternative designs for the opts interface / argument
ordering, so I'm putting this phase out for discussion.

Additionally, I ended up doing a little bit of clean up regarding
attr.h and attr_file.h, adding a new attrcache.h so the other two
files wouldn't have to be included in so many places.
2013-03-15 16:39:00 -07:00
Vicent Marti
a5f6138407 odb_pack: Unused functions 2013-03-15 12:24:20 +01:00
Vicent Marti
f16fb09951 pool: Internal struct name 2013-03-15 12:11:02 +01:00
Vicent Martí
5b229e2053 Merge pull request #1413 from arrbee/more-iterator-refactor
Further tree_iterator refactoring
2013-03-15 04:06:31 -07:00
Vicent Martí
e953c1606d Merge pull request #1414 from arrbee/more-build-warning-fixes
Fix various build warnings
2013-03-14 16:11:31 -07:00
Russell Belfer
55e0f53d86 Fix various build warnings
This fixes various build warnings on Mac and Windows (64-bit).
2013-03-14 15:09:29 -07:00
Russell Belfer
14bedad907 Added pool freelist struct for readability
This adds a git_pool_freelist_item struct that makes it a little
easier to follow what's going on with the pool free list block
management code.  It is functionally neutral.
2013-03-14 15:08:04 -07:00
Russell Belfer
d85296ab9b Fix valgrind issues (and mmap fallback for diff)
This fixes a number of issues identified by valgrind - mostly
missed free calls.  Inside valgrind, mmap() may fail which causes
some of the diff tests to fail.  This adds a fallback code path
to diff_output.c:get_workdir_content() where is the mmap() fails
the code will now try to read the file data directly into allocated
memory (which is what it would do if the data needed to be filtered
anyhow).
2013-03-14 13:50:54 -07:00
Russell Belfer
0c46863384 Improved tree iterator internals
This updates the tree iterator internals to be more efficient.

The tree_iterator_entry objects are now kept as pointers that are
allocated from a git_pool, so that we may use git__tsort_r for
sorting (which is better than qsort, given that the tree is
likely mostly ordered already).

Those tree_iterator_entry objects now keep direct pointers to the
data they refer to instead of keeping indirect index values.  This
simplifies a lot of the data structure traversal code.

This also adds bsearch to find the start item position for range-
limited tree iterators, and is more explicit about using
git_path_cmp instead of reimplementing it.  The git_path_cmp
changed a bit to make it easier for tree_iterators to use it (but
it was barely being used previously, so not a big deal).

This adds a git_pool_free_array function that efficiently frees a
list of pool allocated pointers (which the tree_iterator keeps).
Also, added new tests for the git_pool free list functionality
that was not previously being tested (or used).
2013-03-14 13:40:15 -07:00
Vicent Martí
6950dca42e Merge pull request #1411 from arrbee/workdir-iterator-depth-limit-bug
Fix workdir iterator bugs
2013-03-13 15:50:13 -07:00
Russell Belfer
bbb1364671 Fix workdir iterator bugs
This fixes two bugs with the workdir iterator depth check: first
that the depth was not being decremented and second that empty
directories were counting against the depth even though a frame
was not being created for them.

This also fixes a bug with the ENOTFOUND return code for workdir
iterators when you attempt to advance_into an empty directory.
Actually, that works correctly, but it was incorrectly being
propogated into regular advance() calls in some circumstances.

Added new tests for the above that create a huge hierarchy on
the fly and try using the workdir iterator to traverse it.
2013-03-13 14:59:51 -07:00
Vicent Marti
ad003763cc MSVC: What could possibly be the size of a void*? 2013-03-12 20:36:35 +01:00
Vicent Martí
c6d7d877fc Merge pull request #1410 from phkelley/push_sideband
Advertise and support side-band-64k when calling receive-pack
2013-03-12 12:32:12 -07:00
Philip Kelley
f58983246d Style: Reverse lhs and rhs of == comparisons 2013-03-12 15:31:14 -04:00
Philip Kelley
b8c325806f Advertise and support side-band-64k when calling receive-pack 2013-03-12 15:19:32 -04:00
Vicent Martí
1ac10aae1d Merge pull request #1408 from arrbee/refactor-iterators
Refactor iterators
2013-03-12 09:23:53 -07:00
Russell Belfer
62beacd300 Sorting function cleanup and MinGW fix
Clean up some sorting function stuff including fixing qsort_r
on MinGW, common function pointer type for comparison, and basic
insertion sort implementation (which we, regrettably, fall back
on for MinGW).
2013-03-11 16:43:58 -07:00
Vicent Martí
b70bf922a1 Merge pull request #1406 from cpthamilton/local_push
Implemented push on the local transport
2013-03-11 14:35:49 -07:00
abepern
20858f6ea6 Implemented push on the local transport 2013-03-11 17:32:33 -04:00
Russell Belfer
a5eea2d7b7 Stabilize order for equiv tree iterator entries
Given a group of case-insensitively equivalent tree iterator
entries, this ensures that the case-sensitively first trees will
be used as the representative items.  I.e. if you have conflicting
entries "A/B/x", "a/b/x", and "A/b/x", this change ensures that
the earliest entry "A/B/x" will be returned.  The actual choice
is not that important, but it is nice to have it stable and to
have it been either the first or last item, as opposed to a
random item from within the equivalent span.
2013-03-11 11:31:50 -07:00
Edward Thomson
eef7e80e68 Merge pull request #1407 from ethomson/tform_small_files
handle small files in similarity metrics
2013-03-11 10:57:19 -07:00
Edward Thomson
aa408cbfc4 handle small files in similarity metrics 2013-03-11 12:47:01 -05:00
Russell Belfer
aec4f6633c Fix tree iterator advance using wrong name compare
Tree iterator advance was moving forward without taking the
filemode of the entries into account, equating "a" and "a/".
This makes the tree entry comparison code more easily reusable
and fixes the problem.
2013-03-11 10:37:12 -07:00
Russell Belfer
92028ea585 Fix tree iterator path for tree issue + cleanups
This fixes an off by one error for generating full paths for
tree entries in tree iterators when INCLUDE_TREES is set.  Also,
contains a bunch of small code cleanups with a couple of small
utility functions and macro changes to eliminate redundant code.
2013-03-11 09:53:49 -07:00
Russell Belfer
61c7b61e6f Use correct case path in icase tree iterator
If there are case-ambiguities in the path of a case insensitive
tree iterator, it will now rewrite the entire path when it gives
the path name to an entry, so a tree with "A/b/C/d.txt" and
"a/B/c/E.txt" will give the true full paths (instead of case-
folding them both to "A/B/C/d.txt" or "a/b/c/E.txt" or something
like that.
2013-03-10 22:38:53 -07:00
Russell Belfer
a03beb7ba6 Add tests for case insensitive tree iterator
This adds a test case for ci tree iteration when there is a name
conflict.  This points out a behavior quirk in the current version
that I'd like to fix - namely, all tree entries get mapped to one
version of the case pattern in the ci code - i.e. even if you have
A/1.txt and a/2.txt, both will be reported as a/1.txt and a/2.txt
because we only copy the name of a file at a given frame once. It
would be nice to fix this, but I'm worried about how complex that
is if you get a/B/c/1.txt and A/b/C/2.txt.  It may require a walk
up the frames whenever you advance to the next item in a blended
equivalence class.
2013-03-10 21:04:35 -07:00
Carlos Martín Nieto
d768f9add9 travis: join-less notifications 2013-03-10 21:37:09 +01:00
Russell Belfer
57e765b2e8 Merge pull request #1175 from carlosmn/diff-0-ctx
Can't perform diff with no context lines
2013-03-09 08:09:17 -08:00
Carlos Martín Nieto
1aa5318a9e diff: allow asking for diffs with no context
Previously, 0 meant default. This is problematic, as asking for 0
context lines is a valid thing to do.

Change GIT_DIFF_OPTIONS_INIT to default to three and stop treating 0
as a magic value. In case no options are provided, make sure the
options in the diff object default to 3.
2013-03-09 16:04:34 +01:00
Carlos Martín Nieto
48bde2f1b6 config: don't allow passing NULL as a value to set
Passing NULL is non-sensical. The error message leaves to be desired,
though, as it leaks internal implementation details. Catch it at the
`git_config_set_string` level and set an appropriate error message.
2013-03-09 15:45:18 +01:00
Russell Belfer
e40f1c2d23 Make tree iterator handle icase equivalence
There is a serious bug in the previous tree iterator implementation.
If case insensitivity resulted in member elements being equivalent
to one another, and those member elements were trees, then the
children of the colliding elements would be processed in sequence
instead of in a single flattened list.  This meant that the tree
iterator was not truly acting like a case-insensitive list.

This completely reworks the tree iterator to manage lists with
case insensitive equivalence classes and advance through the items
in a unified manner in a single sorted frame.

It is possible that at a future date we might want to update this
to separate the case insensitive and case sensitive tree iterators
so that the case sensitive one could be a minimal amount of code
and the insensitive one would always know what it needed to do
without checking flags.

But there would be so much shared code between the two, that I'm
not sure it that's a win.  For now, this gets what we need.

More tests are needed, though.
2013-03-08 16:39:57 -08:00
Carlos Martín Nieto
0887b580bf Use C99 stdio in mingw-w64
MinGW >= 3.14 does this automatically, but mingw-64 wants us to define
it.
2013-03-08 15:30:18 +01:00
Vicent Martí
92ebbe99c9 Merge pull request #1399 from nathan-osman/development
Add SONAME build option to facilitate building for Android.
2013-03-07 12:06:18 -08:00
Vicent Martí
6f83a78133 Merge pull request #1403 from ethomson/tracing
Optional tracing back to consumers
2013-03-07 11:14:03 -08:00
Edward Thomson
b5ec5430a8 optional tracing 2013-03-07 12:42:33 -06:00
Vicent Marti
33abaad809 refs: Dude, you're OUT. 2013-03-07 18:58:34 +01:00
Vicent Marti
cdaef180ce Merge remote-tracking branch 'ethomson/immutable_refs' into development 2013-03-07 18:44:10 +01:00