]> git.proxmox.com Git - libgit2.git/log
libgit2.git
11 years agoAdd INCLUDE_TREES, DONT_AUTOEXPAND iterator flags
Russell Belfer [Wed, 6 Mar 2013 23:16:34 +0000 (15:16 -0800)]
Add INCLUDE_TREES, DONT_AUTOEXPAND iterator flags

This standardizes iterator behavior across all three iterators
(index, tree, and working directory).  Previously the working
directory iterator behaved differently from the other two.

Each iterator can now operate in one of three modes:

1. *No tree results, auto expand trees* means that only non-
   tree items will be returned and when a tree/directory is
   encountered, we will automatically descend into it.
2. *Tree results, auto expand trees* means that results will
   be given for every item found, including trees, but you
   only need to call normal git_iterator_advance to yield
   every item (i.e. trees returned with pre-order iteration).
3. *Tree results, no auto expand* means that calling the
   normal git_iterator_advance when looking at a tree will
   not descend into the tree, but will skip over it to the
   next entry in the parent.

Previously, behavior 1 was the only option for index and tree
iterators, and behavior 3 was the only option for workdir.

The main public API implications of this are that the
`git_iterator_advance_into()` call is now valid for all
iterators, not just working directory iterators, and all the
existing uses of working directory iterators explicitly use
the GIT_ITERATOR_DONT_AUTOEXPAND (for now).

Interestingly, the majority of the implementation was in the
index iterator, since there are no tree entries there and now
have to fake them.  The tree and working directory iterators
only required small modifications.

11 years agoRetire spoolandsort iterator
Russell Belfer [Wed, 6 Mar 2013 00:29:04 +0000 (16:29 -0800)]
Retire spoolandsort iterator

Since the case sensitivity is moved into the respective iterators,
this removes the spoolandsort iterator code.

11 years agoMake iterator APIs consistent with standards
Russell Belfer [Wed, 6 Mar 2013 00:10:05 +0000 (16:10 -0800)]
Make iterator APIs consistent with standards

The iterator APIs are not currently consistent with the parameter
ordering of the rest of the codebase.  This rearranges the order
of parameters, simplifies the naming of a number of functions, and
makes somewhat better use of macros internally to clean up the
iterator code.

This also expands the test coverage of iterator functionality,
making sure that case sensitive range-limited iteration works
correctly.

11 years agoAdd const to some buffer functions
Russell Belfer [Tue, 5 Mar 2013 19:47:07 +0000 (11:47 -0800)]
Add const to some buffer functions

11 years agoNo longer need clar_main.c
Russell Belfer [Thu, 7 Mar 2013 00:02:26 +0000 (16:02 -0800)]
No longer need clar_main.c

11 years agoMerge pull request #1396 from cholin/features/note-iterator
Russell Belfer [Wed, 6 Mar 2013 21:58:21 +0000 (13:58 -0800)]
Merge pull request #1396 from cholin/features/note-iterator

[RFC] basic note iterator implementation

11 years agoadded missing free for git_note in clar tests
Nico von Geyso [Wed, 6 Mar 2013 21:51:20 +0000 (22:51 +0100)]
added missing free for git_note in clar tests

11 years agofixed minor issues with new note iterator
Nico von Geyso [Wed, 6 Mar 2013 21:25:01 +0000 (22:25 +0100)]
fixed minor issues with new note iterator

* fixed style issues
* use new iterator functions for git_note_foreach()

11 years agoMSVC: Define NDEBUG to disable asserts in release builds
Philip Kelley [Wed, 6 Mar 2013 18:22:50 +0000 (13:22 -0500)]
MSVC: Define NDEBUG to disable asserts in release builds

11 years agouse git_note_iterator type instead of non-public git_iterator one
Nico von Geyso [Wed, 6 Mar 2013 18:07:56 +0000 (19:07 +0100)]
use git_note_iterator type instead of non-public git_iterator one

11 years agobasic note iterator implementation
Nico von Geyso [Wed, 6 Mar 2013 15:43:21 +0000 (16:43 +0100)]
basic note iterator implementation

* git_note_iterator_new() - create a new note iterator
* git_note_next() - retrieves the next item of the iterator

11 years agoMerge pull request #1392 from ethomson/push_test_fix
Vicent Martí [Wed, 6 Mar 2013 11:05:10 +0000 (03:05 -0800)]
Merge pull request #1392 from ethomson/push_test_fix

remote push test fix

11 years agoremote push test fix
Edward Thomson [Wed, 6 Mar 2013 04:45:26 +0000 (22:45 -0600)]
remote push test fix

11 years agoMerge pull request #1369 from arrbee/repo-init-template-hooks
Vicent Martí [Tue, 5 Mar 2013 23:35:28 +0000 (15:35 -0800)]
Merge pull request #1369 from arrbee/repo-init-template-hooks

More tests (and fixes) for initializing repo from template

11 years agoMake sure docurium can see git_packbuilder_foreach
Carlos Martín Nieto [Tue, 5 Mar 2013 22:50:43 +0000 (23:50 +0100)]
Make sure docurium can see git_packbuilder_foreach

11 years agoMerge pull request #1380 from phkelley/index_icase
Vicent Martí [Tue, 5 Mar 2013 00:19:38 +0000 (16:19 -0800)]
Merge pull request #1380 from phkelley/index_icase

Disable ignore_case when writing the index to a tree

11 years agoMerge pull request #1390 from ethomson/reuc_clear
Vicent Martí [Tue, 5 Mar 2013 00:13:31 +0000 (16:13 -0800)]
Merge pull request #1390 from ethomson/reuc_clear

clear REUC on checkout

11 years agoclear REUC on checkout
Edward Thomson [Mon, 4 Mar 2013 23:40:48 +0000 (17:40 -0600)]
clear REUC on checkout

11 years agoFix a few leaks
Carlos Martín Nieto [Sun, 3 Mar 2013 23:21:56 +0000 (00:21 +0100)]
Fix a few leaks

`git_diff_get_patch()` would unconditionally load the patch object and
then simply leak it if the user hadn't requested it. Short-circuit
loading the object if the user doesn't want it.

The rest of the plugs are simply calling the free functions of objects
allocated during the tests.

11 years agoMerge pull request #1388 from carlosmn/hash-ref-delta
Vicent Martí [Sun, 3 Mar 2013 22:46:01 +0000 (14:46 -0800)]
Merge pull request #1388 from carlosmn/hash-ref-delta

indexer: use a hashtable for keeping track of offsets

11 years agoindexer: use a hashtable for keeping track of offsets
Carlos Martín Nieto [Sun, 3 Mar 2013 13:50:47 +0000 (14:50 +0100)]
indexer: use a hashtable for keeping track of offsets

These offsets are needed for REF_DELTA objects, which encode which
object they use as a base, but not where it lies in the packfile, so
we need a list.

These objects are mostly from older packfiles, before OFS_DELTA was
widely spread. The time spent in indexing these packfiles is greatly
reduced, though remains above what git is able to do.

11 years agoMerge pull request #1387 from carlosmn/kill-indexer
Vicent Martí [Sun, 3 Mar 2013 14:38:33 +0000 (06:38 -0800)]
Merge pull request #1387 from carlosmn/kill-indexer

indexer: kill git_indexer

11 years agoindexer: kill git_indexer
Carlos Martín Nieto [Sun, 3 Mar 2013 14:19:21 +0000 (15:19 +0100)]
indexer: kill git_indexer

This was the first implementation and its goal was simply to have
something that worked. It is slow and now it's just taking up
space. Remove it and switch the one known usage to use the streaming
indexer.

11 years agoMerge pull request #1386 from arrbee/update-docs
Vicent Martí [Sat, 2 Mar 2013 22:29:39 +0000 (14:29 -0800)]
Merge pull request #1386 from arrbee/update-docs

Update contributing and conventions

11 years agoFixed a couple typos
Russell Belfer [Sat, 2 Mar 2013 21:58:05 +0000 (13:58 -0800)]
Fixed a couple typos

11 years agoSimplify diff example using revparse
Russell Belfer [Sat, 2 Mar 2013 21:52:38 +0000 (13:52 -0800)]
Simplify diff example using revparse

When the examples/diff.c was written, there was not yet a revparse
API.  Now we can use it to make command line parsing way better
with less code.  Yay!

11 years agoUpdates to CONTRIBUTING and CONVENTIONS
Russell Belfer [Sat, 2 Mar 2013 21:51:31 +0000 (13:51 -0800)]
Updates to CONTRIBUTING and CONVENTIONS

The discussion about converting some of our foreach-style APIs to
use iterator objects got me wanting to make a list of good starter
projects.  I put it in CONTRIBUTING.md and then went crazy with
updates to that file and to CONVENTIONS.md.

11 years agoMerge pull request #1382 from arrbee/fix-diff-patch-a-different-way
Vicent Martí [Fri, 1 Mar 2013 22:28:47 +0000 (14:28 -0800)]
Merge pull request #1382 from arrbee/fix-diff-patch-a-different-way

Allow empty config object and use it for tests

11 years agoAllow empty config object and use it
Russell Belfer [Fri, 1 Mar 2013 21:41:53 +0000 (13:41 -0800)]
Allow empty config object and use it

This removes assertions that prevent us from having an empty
git_config object and then updates some tests that were
dependent on global config state to use an empty config before
running anything.

11 years agoRename function to __ prefix
Philip Kelley [Fri, 1 Mar 2013 21:38:13 +0000 (16:38 -0500)]
Rename function to __ prefix

11 years agoMerge pull request #1379 from arrbee/fix-tests-with-autocrlf-input-on-windows
Philip Kelley [Fri, 1 Mar 2013 21:27:46 +0000 (13:27 -0800)]
Merge pull request #1379 from arrbee/fix-tests-with-autocrlf-input-on-windows

Control for core.autocrlf during testing

11 years agoDisable ignore_case when writing the index to a tree
Philip Kelley [Fri, 1 Mar 2013 20:44:18 +0000 (15:44 -0500)]
Disable ignore_case when writing the index to a tree

11 years agoControl for core.autocrlf during testing
Russell Belfer [Fri, 1 Mar 2013 20:26:05 +0000 (12:26 -0800)]
Control for core.autocrlf during testing

11 years agoMerge pull request #1378 from jamill/clone_no_delete
Vicent Martí [Fri, 1 Mar 2013 20:10:06 +0000 (12:10 -0800)]
Merge pull request #1378 from jamill/clone_no_delete

Clone should not clean up directories it did not create

11 years agoClone should not delete directories it did not create
Jameson Miller [Fri, 1 Mar 2013 16:07:53 +0000 (11:07 -0500)]
Clone should not delete directories it did not create

11 years agoMerge pull request #1373 from arrbee/why-cdecl-why
Vicent Martí [Thu, 28 Feb 2013 23:09:32 +0000 (15:09 -0800)]
Merge pull request #1373 from arrbee/why-cdecl-why

Why cdecl why?

11 years agoFix some deprecation warnings on Windows
Russell Belfer [Thu, 28 Feb 2013 22:41:26 +0000 (14:41 -0800)]
Fix some deprecation warnings on Windows

This fixes some snprintf and vsnprintf related deprecation
warnings we've been having on Windows with recent compilers.

11 years agoAdd GIT_STDLIB_CALL
Russell Belfer [Thu, 28 Feb 2013 22:14:45 +0000 (14:14 -0800)]
Add GIT_STDLIB_CALL

This removes the one-off GIT_CDECL and adds a new standard way of
doing this named GIT_STDLIB_CALL with a src/win32 specific def
when on the Windows platform.

11 years agow32-posix: Wrap the `timezone` declaration with a clause
Vicent Marti [Thu, 28 Feb 2013 16:36:20 +0000 (17:36 +0100)]
w32-posix: Wrap the `timezone` declaration with a clause

Allows compilation in newer versions of MinGW that already defined it.

11 years agofixing some warnings on Windows
Russell Belfer [Wed, 27 Feb 2013 23:15:39 +0000 (15:15 -0800)]
fixing some warnings on Windows

11 years agouse cdecl for hashsig sorting functions on Windows
Russell Belfer [Wed, 27 Feb 2013 23:07:28 +0000 (15:07 -0800)]
use cdecl for hashsig sorting functions on Windows

11 years agoMerge pull request #1233 from arrbee/file-similarity-metric
Vicent Martí [Wed, 27 Feb 2013 22:50:32 +0000 (14:50 -0800)]
Merge pull request #1233 from arrbee/file-similarity-metric

Add file similarity scoring to diff rename/copy detection

11 years agoMerge pull request #1372 from ethomson/checkout_workdir_end
Russell Belfer [Wed, 27 Feb 2013 22:21:41 +0000 (14:21 -0800)]
Merge pull request #1372 from ethomson/checkout_workdir_end

don't dereference at the end of the workdir iterator

11 years agoMake mode handling during init more like git
Russell Belfer [Wed, 27 Feb 2013 21:44:15 +0000 (13:44 -0800)]
Make mode handling during init more like git

When creating files, instead of actually using GIT_FILEMODE_BLOB
and the other various constants that happen to correspond to
mode values, apparently I should be just using 0666 and 0777, and
relying on the umask to clear bits and make the value sane.

This fixes the rules for copying a template directory and fixes
the checks to match that new behavior.  (Further changes to the
checkout logic to follow separately.)

11 years agodon't dereference at the end of the workdir iterator
Edward Thomson [Wed, 27 Feb 2013 20:47:39 +0000 (14:47 -0600)]
don't dereference at the end of the workdir iterator

11 years agoMerge pull request #1371 from csware/version-constants
Vicent Martí [Wed, 27 Feb 2013 19:01:16 +0000 (11:01 -0800)]
Merge pull request #1371 from csware/version-constants

Win32: Use constants in version resource definitions where possible

11 years agoWin32: Use constants in version resource definitions where possible
Sven Strickroth [Wed, 27 Feb 2013 18:48:02 +0000 (19:48 +0100)]
Win32: Use constants in version resource definitions where possible

Signed-off-by: Sven Strickroth <email@cs-ware.de>
11 years agoFix portability issues on Windows
Russell Belfer [Tue, 26 Feb 2013 21:15:06 +0000 (13:15 -0800)]
Fix portability issues on Windows

The new tests were not taking core.filemode into account when
testing file modes after repo initialization.  Fixed that and some
other Windows warnings that have crept in.

11 years agoFix initialization of repo directories
Russell Belfer [Tue, 26 Feb 2013 19:43:14 +0000 (11:43 -0800)]
Fix initialization of repo directories

When PR #1359 removed the hooks from the test resources/template
directory, it made me realize that the tests for
git_repository_init_ext using templates must be pretty shabby
because we could not have been testing if the hooks were getting
created correctly.

So, this started with me recreating a couple of hooks, including
a sample and symlink, and adding tests that they got created
correctly in the various circumstances, including with the SHARED
modes, etc.  Unfortunately this uncovered some issues with how
directories and symlinks were copied and chmod'ed.  Also, there
was a FIXME in the code related to the chmod behavior as well.

Going back over the directory creation logic for setting up a
repository, I found it was a little difficult to read and could
result in creating and/or chmod'ing directories that the user
almost certainly didn't intend.

So that let to this work which makes repo initialization much
more careful (and hopefully easier to follow).  It required a
couple of extensions / changes to core fileops utilities, but I
also think those are for the better, at least for git_futils_cp_r
in terms of being careful about what actions it takes.

11 years agoMerge pull request #1368 from scunz/inc_ref
Vicent Martí [Tue, 26 Feb 2013 17:29:27 +0000 (09:29 -0800)]
Merge pull request #1368 from scunz/inc_ref

Increment reference counter in git_repository_set_config

11 years agoIncrement reference counter in git_repository_set_config
Sascha Cunz [Tue, 26 Feb 2013 17:21:03 +0000 (18:21 +0100)]
Increment reference counter in git_repository_set_config

This fixes #1365

11 years agoMerge pull request #1364 from martinwoodward/thank-martin
Edward Thomson [Tue, 26 Feb 2013 15:06:42 +0000 (07:06 -0800)]
Merge pull request #1364 from martinwoodward/thank-martin

Give props to Martin Pool

11 years agoGive props to Martin Pool
Martin Woodward [Tue, 26 Feb 2013 09:00:37 +0000 (09:00 +0000)]
Give props to Martin Pool

Martin Pool was the original author of the code referenced in the clone
example. Make note that he's given his permission and also give him the
proper credit.

11 years agoRevert "hash: remove git_hash_init from internal api"
Michael Schubert [Tue, 26 Feb 2013 00:03:56 +0000 (01:03 +0100)]
Revert "hash: remove git_hash_init from internal api"

This reverts commit efe7fad6c96a3d6197a218aeaa561ec676794499, except for
the indentation fixes.

11 years agoMerge pull request #1363 from schu/hash-initialization
Vicent Martí [Mon, 25 Feb 2013 23:41:56 +0000 (15:41 -0800)]
Merge pull request #1363 from schu/hash-initialization

hash: remove git_hash_init from internal api

11 years agohash: remove git_hash_init from internal api
Michael Schubert [Mon, 25 Feb 2013 23:05:28 +0000 (00:05 +0100)]
hash: remove git_hash_init from internal api

Along with that, fix indentation in tests-clar/object/raw/hash.c

11 years agotests/pack: fixup 6774b10
Michael Schubert [Mon, 25 Feb 2013 22:36:25 +0000 (23:36 +0100)]
tests/pack: fixup 6774b10

Initialize the hash ctx with git_hash_ctx_init, not git_hash_init.

11 years agoMerge pull request #1362 from schu/packbuilder-nits
Vicent Martí [Mon, 25 Feb 2013 22:03:42 +0000 (14:03 -0800)]
Merge pull request #1362 from schu/packbuilder-nits

packbuilder: minor improvements

11 years agotests/pack: do strict check of testpack's SHA1 hash
Michael Schubert [Sun, 17 Feb 2013 16:52:16 +0000 (17:52 +0100)]
tests/pack: do strict check of testpack's SHA1 hash

11 years agopack.h: improve docs on how to create a packfile
Michael Schubert [Sun, 17 Feb 2013 15:52:26 +0000 (16:52 +0100)]
pack.h: improve docs on how to create a packfile

11 years agoMerge pull request #1359 from martinwoodward/remove-sample-hooks
Vicent Martí [Mon, 25 Feb 2013 17:07:45 +0000 (09:07 -0800)]
Merge pull request #1359 from martinwoodward/remove-sample-hooks

Remove sample hook files

11 years agoRemove sample hook files
Martin Woodward [Mon, 25 Feb 2013 17:03:05 +0000 (17:03 +0000)]
Remove sample hook files

Getting rid of sample hook files from test repos as they just take up
space with no value.

11 years agoMerge pull request #1355 from phkelley/development
Vicent Martí [Sat, 23 Feb 2013 11:39:11 +0000 (03:39 -0800)]
Merge pull request #1355 from phkelley/development

Portability fixes for Solaris

11 years agoMerge pull request #1356 from arrbee/fix-directory-as-ignore-file
Vicent Martí [Fri, 22 Feb 2013 20:26:01 +0000 (12:26 -0800)]
Merge pull request #1356 from arrbee/fix-directory-as-ignore-file

Do not fail if .gitignore is directory

11 years agoDo not fail if .gitignore is directory
Russell Belfer [Fri, 22 Feb 2013 20:21:54 +0000 (12:21 -0800)]
Do not fail if .gitignore is directory

This is designed to fix libgit2sharp #350 where if .gitignore is
a directory we abort all operations that process ignores instead
of just skipping it as core git does.

Also added test that fails without this change and passes with it.

11 years agoMore rename detection tests
Russell Belfer [Fri, 22 Feb 2013 19:13:01 +0000 (11:13 -0800)]
More rename detection tests

This includes tests for crlf changes, whitespace changes with the
default comparison and with the ignore whitespace comparison, and
more sensitivity checking for the comparison code.

11 years agoRename 'exp' so it doesn't conflict with exp()
Philip Kelley [Fri, 22 Feb 2013 19:03:44 +0000 (14:03 -0500)]
Rename 'exp' so it doesn't conflict with exp()

11 years agoMinor improvements to find_similar code
Russell Belfer [Fri, 22 Feb 2013 18:21:02 +0000 (10:21 -0800)]
Minor improvements to find_similar code

This moves a couple of checks outside of the inner loop of the
find_similar rename/copy detection phase that are only dependent
on the "from" side of a detection.

Also, this replaces the inefficient initialization of the
options structure when a value is not provided explicitly by the
user.

11 years agoReplace static data with configured metric
Russell Belfer [Fri, 22 Feb 2013 18:19:50 +0000 (10:19 -0800)]
Replace static data with configured metric

Instead of creating three git_diff_similarity_metric statically
for the various config options, just create the metric structure
on demand and populate it, using the payload to specific the
extra flags that should be passed to the hashsig.  This removes
a level of obfuscation from the code, I think.

11 years agoFix tests for find_similar and related
Russell Belfer [Fri, 22 Feb 2013 18:17:08 +0000 (10:17 -0800)]
Fix tests for find_similar and related

This fixes both a test that I broke in diff::patch where I was
relying on the current state of the working directory for the
renames test data and fixes an unstable test in diff::rename
where the environment setting for the "diff.renames" config was
being allowed to influence the test results.

11 years agoMerge pull request #1343 from nulltoken/topic/remote_orphaned_branch
Vicent Martí [Fri, 22 Feb 2013 17:48:47 +0000 (09:48 -0800)]
Merge pull request #1343 from nulltoken/topic/remote_orphaned_branch

Teach git_branch_remote_name() to work with orphaned heads

11 years agoMerge pull request #1354 from nulltoken/fix/stash-drop
Vicent Martí [Fri, 22 Feb 2013 17:48:34 +0000 (09:48 -0800)]
Merge pull request #1354 from nulltoken/fix/stash-drop

Fix git_stash_drop()

11 years agoPortability fixes for Solaris
Philip Kelley [Fri, 22 Feb 2013 17:23:14 +0000 (12:23 -0500)]
Portability fixes for Solaris

11 years agobranch: refactor git_branch_remote_name() tests
nulltoken [Fri, 15 Feb 2013 11:43:03 +0000 (12:43 +0100)]
branch: refactor git_branch_remote_name() tests

11 years agobranch: Make git_branch_remote_name() cope with orphaned heads
nulltoken [Fri, 15 Feb 2013 10:35:33 +0000 (11:35 +0100)]
branch: Make git_branch_remote_name() cope with orphaned heads

11 years agostash: Update the reference when dropping the topmost stash
nulltoken [Fri, 22 Feb 2013 14:25:06 +0000 (15:25 +0100)]
stash: Update the reference when dropping the topmost stash

11 years agostash: Refactor stash::drop tests
nulltoken [Fri, 22 Feb 2013 13:44:57 +0000 (14:44 +0100)]
stash: Refactor stash::drop tests

11 years agoignore: enhance git_ignore_path_is_ignored() test coverage
nulltoken [Fri, 22 Feb 2013 14:02:37 +0000 (15:02 +0100)]
ignore: enhance git_ignore_path_is_ignored() test coverage

11 years agoAdd diff rename tests with partial similarity
Russell Belfer [Fri, 22 Feb 2013 00:44:44 +0000 (16:44 -0800)]
Add diff rename tests with partial similarity

This adds some new tests that actually exercise the similarity
metric between files to detect renames, copies, and split modified
files that are too heavily modified.

There is still more testing to do - these tests are just partially
covering the cases.

There is also one bug fix in this where a change set with only
MODIFY being broken into ADD/DELETE (due to low self-similarity)
without any additional RENAMED entries would end up not processing
the split requests (because the num_rewrites counter got reset).

11 years agoInitial integration of similarity metric to diff
Russell Belfer [Thu, 21 Feb 2013 20:40:33 +0000 (12:40 -0800)]
Initial integration of similarity metric to diff

This is the initial integration of the similarity metric into
the `git_diff_find_similar()` code path.  The existing tests all
pass, but the new functionality isn't currently well tested.  The
integration does go through the pluggable metric interface, so it
should be possible to drop in an alternative to the internal
metric that libgit2 implements.

This comes along with a behavior change for an existing interface;
namely, passing two NULLs to git_diff_blobs (or passing NULLs to
git_diff_blob_to_buffer) will now call the file_cb parameter zero
times instead of one time.  I know it's strange that that change
is paired with this other change, but it emerged from some
initialization changes that I ended up making.

11 years agoMerge pull request #1352 from ethomson/reuc_sort
Vicent Martí [Thu, 21 Feb 2013 17:05:48 +0000 (09:05 -0800)]
Merge pull request #1352 from ethomson/reuc_sort

add a sorter to the reuc on index creation

11 years agoadd a sorter to the reuc on index creation
Edward Thomson [Thu, 21 Feb 2013 17:00:29 +0000 (11:00 -0600)]
add a sorter to the reuc on index creation

11 years agoReplace diff delta binary with flags
Russell Belfer [Fri, 8 Feb 2013 18:06:47 +0000 (10:06 -0800)]
Replace diff delta binary with flags

Previously the git_diff_delta recorded if the delta was binary.
This replaces that (with no net change in structure size) with
a full set of flags.  The flag values that were already in use
for individual git_diff_file objects are reused for the delta
flags, too (along with renaming those flags to make it clear that
they are used more generally).

This (a) makes things somewhat more consistent (because I was
using a -1 value in the "boolean" binary field to indicate unset,
whereas now I can just use the flags that are easier to understand),
and (b) will make it easier for me to add some additional flags to
the delta object in the future, such as marking the results of a
copy/rename detection or other deltas that might want a special
indicator.

While making this change, I officially moved some of the flags that
were internal only into the private diff header.

This also allowed me to remove a gross hack in rename/copy detect
code where I was overwriting the status field with an internal
value.

11 years agoRefine pluggable similarity API
Russell Belfer [Tue, 19 Feb 2013 18:25:41 +0000 (10:25 -0800)]
Refine pluggable similarity API

This plugs in the three basic similarity strategies for handling
whitespace via internal use of the pluggable API.  In so doing, I
realized that the use of git_buf in the hashsig API was not needed
and actually just made it harder to use, so I tweaked that API as
well.

Note that the similarity metric is still not hooked up in the
find_similarity code - this is just setting out the function that
will be used.

11 years agoPluggable similarity metric API
Russell Belfer [Fri, 15 Feb 2013 22:12:43 +0000 (14:12 -0800)]
Pluggable similarity metric API

11 years agoMore tests of file signatures with whitespace opts
Russell Belfer [Fri, 15 Feb 2013 19:08:02 +0000 (11:08 -0800)]
More tests of file signatures with whitespace opts

Seems to be working pretty well...

11 years agoChange similarity metric to sampled hashes
Russell Belfer [Fri, 15 Feb 2013 01:25:10 +0000 (17:25 -0800)]
Change similarity metric to sampled hashes

This moves the similarity metric code out of buf_text and into a
new file.  Also, this implements a different approach to similarity
measurement based on a Rabin-Karp rolling hash where we only keep
the top 100 and bottom 100 hashes.  In theory, that should be
sufficient samples to given a fairly accurate measurement while
limiting the amount of data we keep for file signatures no matter
how large the file is.

11 years agowip: adding metric to diff
Russell Belfer [Tue, 22 Jan 2013 23:27:08 +0000 (15:27 -0800)]
wip: adding metric to diff

11 years agoSome similarity metric adjustments
Russell Belfer [Sun, 13 Jan 2013 18:06:09 +0000 (10:06 -0800)]
Some similarity metric adjustments

This makes the text similarity metric treat \r as equivalent
to \n and makes it skip whitespace immediately following a line
terminator, so line indentation will have less effect on the
difference measurement (and so \r\n will be treated as just a
single line terminator).

This also separates the text and binary hash calculators into
two separate functions instead of have more if statements inside
the loop. This should make it easier to have more differentiated
heuristics in the future if we so wish.

11 years agoInitial implementation of similarity scoring algo
Russell Belfer [Sat, 12 Jan 2013 06:13:02 +0000 (22:13 -0800)]
Initial implementation of similarity scoring algo

This adds a new `git_buf_text_hashsig` type and functions to
generate these hash signatures and compare them to give a
similarity score.  This can be plugged into diff similarity
scoring.

11 years agoMerge pull request #1351 from arrbee/moar-treebuilder-tests
Vicent Martí [Wed, 20 Feb 2013 20:00:51 +0000 (12:00 -0800)]
Merge pull request #1351 from arrbee/moar-treebuilder-tests

Add more treebuilder tests

11 years agoAdd more treebuilder tests
Russell Belfer [Wed, 20 Feb 2013 19:58:21 +0000 (11:58 -0800)]
Add more treebuilder tests

The recent changes with git_treebuilder_entrycount point out that
the test coverage for git_treebuilder_remove and
git_treebuilder_entrycount is completely absent.  This adds tests.

11 years agoMerge pull request #1350 from arrbee/fix-1292
Vicent Martí [Wed, 20 Feb 2013 19:42:15 +0000 (11:42 -0800)]
Merge pull request #1350 from arrbee/fix-1292

Add explicit entrycount to tree builder

11 years agoSome code cleanups in tree.c
Russell Belfer [Wed, 20 Feb 2013 18:58:56 +0000 (10:58 -0800)]
Some code cleanups in tree.c

This replaces most of the explicit vector iteration with calls
to git_vector_foreach, adds in some git__free and giterr_clear
calls to clean up during some error paths, and a couple of
other code simplifications.

11 years agoStore treebuilder length separately from entries vec
Russell Belfer [Wed, 20 Feb 2013 18:50:01 +0000 (10:50 -0800)]
Store treebuilder length separately from entries vec

The treebuilder entries vector flags removed items which means
we can't rely on the entries vector length to accurately get the
number of entries.  This adds an entrycount value and maintains it
while updating the treebuilder entries.

11 years agoMerge pull request #1348 from libgit2/signatures-2
Russell Belfer [Wed, 20 Feb 2013 18:19:58 +0000 (10:19 -0800)]
Merge pull request #1348 from libgit2/signatures-2

Simplify signature parsing

11 years agoMerge pull request #1349 from libgit2/clar-no-cache
Vicent Martí [Wed, 20 Feb 2013 18:07:14 +0000 (10:07 -0800)]
Merge pull request #1349 from libgit2/clar-no-cache

Disable caching in Clar

11 years agoDisable caching in Clar
Vicent Marti [Wed, 20 Feb 2013 17:49:00 +0000 (18:49 +0100)]
Disable caching in Clar

11 years agosignature: Small cleanup
Vicent Marti [Wed, 20 Feb 2013 17:46:10 +0000 (18:46 +0100)]
signature: Small cleanup

11 years agosignature: Shut up MSVC, you silly goose
Vicent Marti [Wed, 20 Feb 2013 16:09:51 +0000 (17:09 +0100)]
signature: Shut up MSVC, you silly goose