Commit Graph

4366 Commits

Author SHA1 Message Date
Carlos Martín Nieto
323bb88514 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.
2013-03-04 00:21:56 +01:00
Vicent Martí
dce5f26f4d Merge pull request #1388 from carlosmn/hash-ref-delta
indexer: use a hashtable for keeping track of offsets
2013-03-03 14:46:01 -08:00
Carlos Martín Nieto
0e040c031e 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.
2013-03-03 23:18:29 +01:00
Vicent Martí
29ab8774e5 Merge pull request #1387 from carlosmn/kill-indexer
indexer: kill git_indexer
2013-03-03 06:38:33 -08:00
Carlos Martín Nieto
447ae791e5 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.
2013-03-03 15:19:21 +01:00
Vicent Martí
bb19532c5f Merge pull request #1386 from arrbee/update-docs
Update contributing and conventions
2013-03-02 14:29:39 -08:00
Russell Belfer
a313de0d9e Fixed a couple typos 2013-03-02 13:58:05 -08:00
Russell Belfer
7bd53bf385 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!
2013-03-02 13:52:38 -08:00
Russell Belfer
1631147c19 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.
2013-03-02 13:51:31 -08:00
Vicent Martí
01be786319 Merge pull request #1382 from arrbee/fix-diff-patch-a-different-way
Allow empty config object and use it for tests
2013-03-01 14:28:47 -08:00
Russell Belfer
487fc724ff 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.
2013-03-01 13:41:53 -08:00
Philip Kelley
cb53669e14 Rename function to __ prefix 2013-03-01 16:38:13 -05:00
Philip Kelley
47f70846aa Merge pull request #1379 from arrbee/fix-tests-with-autocrlf-input-on-windows
Control for core.autocrlf during testing
2013-03-01 13:27:46 -08:00
Philip Kelley
3f0d0c85d0 Disable ignore_case when writing the index to a tree 2013-03-01 15:46:21 -05:00
Russell Belfer
7d46b34baf Control for core.autocrlf during testing 2013-03-01 12:26:05 -08:00
Vicent Martí
426b2e2fce Merge pull request #1378 from jamill/clone_no_delete
Clone should not clean up directories it did not create
2013-03-01 12:10:06 -08:00
Jameson Miller
926acbcf8e Clone should not delete directories it did not create 2013-03-01 14:56:09 -05:00
Vicent Martí
cc427158d4 Merge pull request #1373 from arrbee/why-cdecl-why
Why cdecl why?
2013-02-28 15:09:32 -08:00
Russell Belfer
f443a72d33 Fix some deprecation warnings on Windows
This fixes some snprintf and vsnprintf related deprecation
warnings we've been having on Windows with recent compilers.
2013-02-28 14:41:26 -08:00
Russell Belfer
97b7137459 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.
2013-02-28 14:14:45 -08:00
Vicent Marti
5fa8abb868 w32-posix: Wrap the timezone declaration with a clause
Allows compilation in newer versions of MinGW that already defined it.
2013-02-28 17:36:20 +01:00
Russell Belfer
f708c89fa6 fixing some warnings on Windows 2013-02-27 15:15:39 -08:00
Russell Belfer
11b5beb7ba use cdecl for hashsig sorting functions on Windows 2013-02-27 15:07:28 -08:00
Vicent Martí
e68e33f33d Merge pull request #1233 from arrbee/file-similarity-metric
Add file similarity scoring to diff rename/copy detection
2013-02-27 14:50:32 -08:00
Russell Belfer
9f9477d650 Merge pull request #1372 from ethomson/checkout_workdir_end
don't dereference at the end of the workdir iterator
2013-02-27 14:21:41 -08:00
Russell Belfer
18f0826408 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.)
2013-02-27 13:44:15 -08:00
Edward Thomson
395509ffcd don't dereference at the end of the workdir iterator 2013-02-27 15:35:52 -06:00
Vicent Martí
c493f8211f Merge pull request #1371 from csware/version-constants
Win32: Use constants in version resource definitions where possible
2013-02-27 11:01:16 -08:00
Sven Strickroth
82ac1f7678 Win32: Use constants in version resource definitions where possible
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2013-02-27 19:48:02 +01:00
Russell Belfer
0d1b094b07 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.
2013-02-26 13:15:06 -08:00
Russell Belfer
3c42e4ef74 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.
2013-02-26 11:43:14 -08:00
Vicent Martí
6990377786 Merge pull request #1368 from scunz/inc_ref
Increment reference counter in git_repository_set_config
2013-02-26 09:29:27 -08:00
Sascha Cunz
25e7c9b7a6 Increment reference counter in git_repository_set_config
This fixes #1365
2013-02-26 18:21:03 +01:00
Edward Thomson
3e212548f8 Merge pull request #1364 from martinwoodward/thank-martin
Give props to Martin Pool
2013-02-26 07:06:42 -08:00
Martin Woodward
5c46937b3a 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.
2013-02-26 09:00:37 +00:00
Michael Schubert
8005c6d420 Revert "hash: remove git_hash_init from internal api"
This reverts commit efe7fad6c9, except for
the indentation fixes.
2013-02-26 01:08:34 +01:00
Vicent Martí
f657688bc7 Merge pull request #1363 from schu/hash-initialization
hash: remove git_hash_init from internal api
2013-02-25 15:41:56 -08:00
Michael Schubert
efe7fad6c9 hash: remove git_hash_init from internal api
Along with that, fix indentation in tests-clar/object/raw/hash.c
2013-02-26 00:23:00 +01:00
Michael Schubert
be225be785 tests/pack: fixup 6774b10
Initialize the hash ctx with git_hash_ctx_init, not git_hash_init.
2013-02-25 23:36:25 +01:00
Vicent Martí
989abe9be4 Merge pull request #1362 from schu/packbuilder-nits
packbuilder: minor improvements
2013-02-25 14:03:42 -08:00
Michael Schubert
6774b1071f tests/pack: do strict check of testpack's SHA1 hash 2013-02-25 22:22:15 +01:00
Michael Schubert
fcc265fef8 pack.h: improve docs on how to create a packfile 2013-02-25 22:22:15 +01:00
Vicent Martí
25a0831f2d Merge pull request #1359 from martinwoodward/remove-sample-hooks
Remove sample hook files
2013-02-25 09:07:45 -08:00
Martin Woodward
fc6c5b5001 Remove sample hook files
Getting rid of sample hook files from test repos as they just take up
space with no value.
2013-02-25 17:03:05 +00:00
Vicent Martí
5eeb357df8 Merge pull request #1355 from phkelley/development
Portability fixes for Solaris
2013-02-23 03:39:11 -08:00
Vicent Martí
68fec637a2 Merge pull request #1356 from arrbee/fix-directory-as-ignore-file
Do not fail if .gitignore is directory
2013-02-22 12:26:01 -08:00
Russell Belfer
37d9168608 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.
2013-02-22 12:21:54 -08:00
Russell Belfer
1be4ba9842 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.
2013-02-22 11:13:01 -08:00
Philip Kelley
7beeb3f420 Rename 'exp' so it doesn't conflict with exp() 2013-02-22 14:03:44 -05:00
Russell Belfer
0a0089131f 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.
2013-02-22 10:21:02 -08:00