Commit Graph

5146 Commits

Author SHA1 Message Date
nulltoken
c1cf1af46a cmake: Add option to specify the name of the binary 2013-06-13 10:12:44 +02:00
Vicent Marti
5a6e45cc84 Revert "cmake: Update Windows resources to reflect the optional vendor string"
This reverts commit 095bfd7487.
2013-06-12 21:14:04 +02:00
Vicent Marti
6de9b2ee14 util: It's called memzero 2013-06-12 21:10:33 +02:00
Vicent Marti
eb58e2d0be Merge remote-tracking branch 'arrbee/minor-paranoia' into development 2013-06-12 21:05:48 +02:00
Russell Belfer
3b5001b4c9 Merge pull request #1647 from arrbee/fix-win32-warnings-part-112
Fix Windows warnings and missing prototypes
2013-06-12 15:39:22 -07:00
Russell Belfer
37f66e8263 Fix Windows warnings
This fixes problems with missing function prototypes and 64-bit
data issues on Windows.
2013-06-12 15:21:21 -07:00
Vicent Martí
88c401bec8 Merge pull request #1643 from ethomson/rename_source
Keep data about source of similarity
2013-06-12 14:54:32 -07:00
Vicent Martí
93da7af707 Merge pull request #1642 from arrbee/diff-function-context
Diff code reorg plus function context in diff headers
2013-06-12 14:52:47 -07:00
Russell Belfer
360f42f4b3 Fix diff header naming issues
This makes the git_diff_patch definition private to diff_patch.c
and fixes a number of other header file naming inconsistencies to
use `git_` prefixes on functions and structures that are shared
between files.
2013-06-12 14:18:09 -07:00
Russell Belfer
ef3374a8a8 Improvements to git_array
This changes the size data to uint32_t, fixes the array growth
logic to use a simple 1.5x multiplier, and uses a generic inline
function for growing the array to make the git_array_alloc API
feel more natural (i.e. it returns a pointer to the new item).
2013-06-12 13:46:44 -07:00
Russell Belfer
f9c824c592 Add patch from blobs API
This adds two new public APIs: git_diff_patch_from_blobs and
git_diff_patch_from_blob_and_buffer, plus it refactors the code
for git_diff_blobs and git_diff_blob_to_buffer so that they code
is almost entirely shared between these APIs, and adds tests for
the new APIs.
2013-06-12 11:55:27 -07:00
Russell Belfer
54faddd299 Fix some diff driver memory leaks 2013-06-12 11:54:11 -07:00
Russell Belfer
42e6cf7860 Add diff drivers tests (and fix bugs)
This adds real tests for user-configured diff drivers and in the
process found a bunch of bugs.
2013-06-11 17:45:14 -07:00
Vicent Martí
5438e9c2b8 Merge pull request #1645 from csware/config_level_app
Add high(est) config level for application specific config files
2013-06-11 15:34:53 -07:00
Sven Strickroth
76b893b653 Add high(est) config level for application specific config files
Some tools use an extra level to maintain an application specific config files on top of the normal ones. Revision 16adc9fade broke this.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2013-06-11 23:37:02 +02:00
Russell Belfer
5dc98298a1 Implement regex pattern diff driver
This implements the loading of regular expression pattern lists
for diff drivers that search for function context in that way.
This also changes the way that diff drivers update options and
interface with xdiff APIs to make them a little more flexible.
2013-06-11 11:22:22 -07:00
Vicent Martí
9d4db41a8f Merge pull request #1644 from carlosmn/sig-isspace
signature: extend trimming to more whitespace
2013-06-11 06:30:18 -07:00
Carlos Martín Nieto
24ec69998d signature: extend trimming to more whitespace
There are all sorts of misconfiguration in the wild. We already rely
on the signature constructor to trim SP. Extend the logic to use
`isspace` to decide whether a character should be trimmed.
2013-06-11 11:01:45 +02:00
Russell Belfer
3eadfecd32 start implementing diff driver registry 2013-06-10 15:24:20 -07:00
Russell Belfer
2f77d8f15d Fix some memory leaks 2013-06-10 14:16:56 -07:00
Russell Belfer
596b121ae4 fix missing file and bad prototype 2013-06-10 14:16:49 -07:00
Edward Thomson
690bf41ce5 keep source similarity in rename detection 2013-06-10 15:18:38 -05:00
Edward Thomson
bda3fbb1ac failing unit test for similar renames 2013-06-10 15:16:58 -05:00
Russell Belfer
114f5a6c41 Reorganize diff and add basic diff driver
This is a significant reorganization of the diff code to break it
into a set of more clearly distinct files and to document the new
organization.  Hopefully this will make the diff code easier to
understand and to extend.

This adds a new `git_diff_driver` object that looks of diff driver
information from the attributes and the config so that things like
function content in diff headers can be provided.  The full driver
spec is not implemented in the commit - this is focused on the
reorganization of the code and putting the driver hooks in place.

This also removes a few #includes from src/repository.h that were
overbroad, but as a result required extra #includes in a variety
of places since including src/repository.h no longer results in
pulling in the whole world.
2013-06-10 10:10:39 -07:00
Russell Belfer
3e9e6cdaff Add safe memset and use it
This adds a `git__memset` routine that will not be optimized away
and updates the places where I memset() right before a free() call
to use it.
2013-06-07 09:54:33 -07:00
Vicent Martí
3de768ca2f Merge pull request #1635 from arrbee/simplify-mkdir
Simplify git_futils_mkdir
2013-06-06 17:07:29 -07:00
Russell Belfer
f7e5615086 Make mkdir early exit cases clearer
There are two places where git_futils_mkdir should exit early or
at least do less.  The first is when using GIT_MKDIR_SKIP_LAST
and having that flag leave no directory left to create; it was
being handled previously, but the behavior was subtle.  Now I put
in a clear explicit check that exits early in that case.

The second is when there is no directory to create, but there is
a valid path that should be verified.  I shifted the logic a bit
so we'll be better about not entering the loop than that happens.
2013-06-05 15:41:42 -07:00
Russell Belfer
7000f3fa7b Move some diff helpers into separate file 2013-06-05 12:13:54 -07:00
Russell Belfer
aad6967be1 Basic function context header
This implements a basic callback to extract function context for
a diff.  It always uses the same search heuristic right now with
no regular expressions or language-specific variants.  Those will
come next, I think.
2013-06-05 12:13:54 -07:00
Russell Belfer
999d4405a6 Simplify git_futils_mkdir
This routine was (is) pretty complicated, but given the recent
changes, it seemed like it could be simplified a bit.
2013-06-05 12:02:28 -07:00
Vicent Marti
2e1fa15fcd I'm a dick 2013-06-05 19:00:16 +02:00
Vicent Martí
987ab76580 Merge pull request #1634 from arrbee/alternative-mkdir-fix
Ensure git_futils_mkdir won't mkdir root
2013-06-05 09:57:59 -07:00
Russell Belfer
b832ecf71c Ensure git_futils_mkdir won't mkdir root
This makes sure that git_futils_mkdir always skips over the root
directory at a minimum, even on platforms where the root is not
simply '/'.  Also, this removes the GIT_WIN32 ifdef in favor of
making EACCES as a potentially recoverable error on all platforms.
2013-06-05 09:46:51 -07:00
Vicent Martí
e236b37ff7 Merge pull request #1633 from jamill/directory_create_fix
Allow creation of directories under the volume root in Win32
2013-06-05 09:16:19 -07:00
Jameson Miller
daf98cb2ed Allow creation of directories under the volume root in Win32
We ran into an issue where cloning a repository to a folder
directly underneath the root of a volume (e.g. 'd:\libgit2')
would fail with an access denied error. This was traced down
to a call to make a directory that is the root (e.g. 'd:') could
return an error indicated access denied instead of an error
indicating the path already exists. This change now handles
the access denied error on Win32 and checks for the existence
of the folder.
2013-06-05 12:05:29 -04:00
Vicent Martí
947fad4f7f Merge pull request #1624 from libgit2/vmg/full-ref-iterator
Breaking RefDB changes
2013-06-03 09:28:58 -07:00
Scott J. Goldman
9d9fff3c3d Merge pull request #1631 from scottjg/fix-timezone-parsing
Don't bail on parsing commits with an invalid timezone
2013-06-02 02:16:05 -07:00
Scott J. Goldman
dc33b3d7b2 Don't bail on parsing commits with an invalid timezone
git doesn't do that, and it's not something that's usually
actionable to fix. if you have a git repository with one bad
timezone in the history, it's too late to change it most likely.
2013-06-02 02:13:45 -07:00
Vicent Martí
cfbd08a59c Merge pull request #1630 from arrbee/index-read-tree-preserve-stat-cache
Make git_index_read_tree preserve stat cache where possible
2013-06-01 04:28:24 -07:00
Russell Belfer
03a8907078 Make git_index_read_tree preserve stat cache
Instead of just blowing away the stat cache data when loading a
new tree into the index, this checks if each loaded item has a
corresponding existing item with the same OID and if so, copies
the stat data from the old item to the new one so it will not be
blown away.
2013-05-31 21:49:40 -07:00
Vicent Martí
efd5a4e16a Merge pull request #1627 from arrbee/iterator-api-improvements
Make iterators use GIT_ITEROVER & smart advance
2013-05-31 14:36:08 -07:00
Russell Belfer
1a42dd17eb Mutex init can fail
It is obviously quite a serious problem if this happens, but mutex
initialization can fail and we should detect it.  It's a bit like
a memory allocation failure, in that you're probably pretty screwed
if this occurs, but at least we'll catch it.
2013-05-31 14:13:11 -07:00
Russell Belfer
f658dc433c Zero memory for major objects before freeing
By zeroing out the memory when we free larger objects (i.e. those
that serve as collections of other data, such as repos, odb, refdb),
I'm hoping that it will be easier for libgit2 bindings to find
errors in their object management code.
2013-05-31 14:09:58 -07:00
Russell Belfer
cee695ae6b Make iterators use GIT_ITEROVER & smart advance
1. internal iterators now return GIT_ITEROVER when you go past the
   last item in the iteration.
2. git_iterator_advance will "advance" to the first item in the
   iteration if it is called immediately after creating the
   iterator, which allows a simpler idiom for basic iteration.
3. if git_iterator_advance encounters an error reading data (e.g.
   a missing tree or an unreadable file), it returns the error
   but also attempts to advance past the invalid data to prevent
   an infinite loop.

Updated all tests and internal usage of iterators to account for
these new behaviors.
2013-05-31 12:18:43 -07:00
Vicent Martí
17ef7dbce4 Merge pull request #1626 from ethomson/index_ext_truncation
improve test for index extension truncation
2013-05-31 09:51:53 -07:00
Edward Thomson
8c2458bea6 improve test for index extension truncation 2013-05-31 11:41:33 -05:00
Vicent Martí
8d863aa205 Merge pull request #1621 from NHDaly/clone_transport_flags
Added support for setting transport flags (No check SSL cert) to git_clo...
2013-05-31 06:01:59 -07:00
Nathan Daly
883929144d Added support for setting transport flags (No check SSL cert) to git_clone call. 2013-05-31 08:53:22 -04:00
Vicent Martí
9afc59710e Merge pull request #1559 from carlosmn/ref-shorthand
Introduce git_reference_shorthand
2013-05-31 03:09:38 -07:00
Vicent Martí
af2c72d228 Merge pull request #1623 from yorah/fix/tag_auto
remote: make default tag retrieving behaviour consistent
2013-05-31 03:08:48 -07:00