]> git.proxmox.com Git - libgit2.git/log
libgit2.git
10 years agosmart: send a flush when we disconnect
Carlos Martín Nieto [Mon, 19 May 2014 14:54:19 +0000 (16:54 +0200)]
smart: send a flush when we disconnect

The git server wants to hear a flush from us when we disconnect,
particularly when we want to perform a fetch but are up to date.

10 years agoMerge pull request #2371 from martinwoodward/attrib_fnmatch
Vicent Marti [Mon, 19 May 2014 13:43:13 +0000 (15:43 +0200)]
Merge pull request #2371 from martinwoodward/attrib_fnmatch

Restore attributions for fnmatch

10 years agoRestore attributions for fnmatch
Martin Woodward [Mon, 19 May 2014 13:39:45 +0000 (14:39 +0100)]
Restore attributions for fnmatch

10 years agoMerge pull request #2354 from libgit2/cmn/clone-into-mirror
Vicent Marti [Mon, 19 May 2014 13:00:50 +0000 (15:00 +0200)]
Merge pull request #2354 from libgit2/cmn/clone-into-mirror

Allow mirror-clone via `git_clone_into()`

10 years agoclone: don't error out if the branch already exists
Carlos Martín Nieto [Mon, 19 May 2014 12:15:40 +0000 (14:15 +0200)]
clone: don't error out if the branch already exists

We set up the current branch after we fetch from the remote. This means
that the user's refspec may have already created this reference. It is
therefore not an error if we cannot create the branch because it already
exists.

This allows for the user to replicate git-clone's --mirror option.

10 years agoclone: duplicate the remote
Carlos Martín Nieto [Mon, 19 May 2014 11:36:00 +0000 (13:36 +0200)]
clone: duplicate the remote

Instead of changing the user-provided remote, duplicate it so we can add
the extra refspec without having to worry about unsetting it before
returning.

10 years agoclone: add failing test for a mirror-clone with clone_into
Carlos Martín Nieto [Thu, 15 May 2014 07:03:30 +0000 (09:03 +0200)]
clone: add failing test for a mirror-clone with clone_into

Show a failure to perform a mirror-clone from a repository, both local
and remote.

10 years agoMerge pull request #2364 from libgit2/cmn/comment-char
Vicent Marti [Mon, 19 May 2014 10:21:37 +0000 (12:21 +0200)]
Merge pull request #2364 from libgit2/cmn/comment-char

message: don't assume the comment char

10 years agoMerge pull request #2303 from jacquesg/mingw-lseek
Vicent Marti [Mon, 19 May 2014 10:20:31 +0000 (12:20 +0200)]
Merge pull request #2303 from jacquesg/mingw-lseek

WIP: Windows fixes

10 years agoMerge pull request #2365 from kitbellew/fix-indexer-mmap
Philip Kelley [Sun, 18 May 2014 16:22:21 +0000 (12:22 -0400)]
Merge pull request #2365 from kitbellew/fix-indexer-mmap

Fix warning on uninitialized variable.

10 years agoFix warning on uninitialized variable.
Albert Meltzer [Sat, 17 May 2014 19:44:21 +0000 (12:44 -0700)]
Fix warning on uninitialized variable.

10 years agomessage: don't assume the comment char
Carlos Martín Nieto [Sun, 18 May 2014 08:06:49 +0000 (10:06 +0200)]
message: don't assume the comment char

The comment char is configurable and we need to provide a way for the
user to specify which comment char they chose for their message.

10 years agoFix a bug in the pack::packbuilder suite
Philip Kelley [Sat, 17 May 2014 20:58:09 +0000 (16:58 -0400)]
Fix a bug in the pack::packbuilder suite

10 years agoFix printf format string from previous commit
Philip Kelley [Sat, 17 May 2014 16:45:34 +0000 (12:45 -0400)]
Fix printf format string from previous commit

10 years agoprint_binary_hunk: Treat types with respect
Philip Kelley [Sat, 17 May 2014 16:19:32 +0000 (12:19 -0400)]
print_binary_hunk: Treat types with respect

10 years agoMerge remote-tracking branch 'upstream/cmn/indexer-mmap' into development
Philip Kelley [Sat, 17 May 2014 15:38:03 +0000 (11:38 -0400)]
Merge remote-tracking branch 'upstream/cmn/indexer-mmap' into development

10 years agoMerge pull request #2362 from libgit2/rb/update-4k-to-8k
Vicent Marti [Sat, 17 May 2014 00:37:13 +0000 (02:37 +0200)]
Merge pull request #2362 from libgit2/rb/update-4k-to-8k

Test and fix Git diff binary detection compatibility

10 years agoindexer: mmap fixes for Windows
Carlos Martín Nieto [Wed, 14 May 2014 17:12:48 +0000 (19:12 +0200)]
indexer: mmap fixes for Windows

Windows has its own ftruncate() called _chsize_s().

p_mkstemp() is changed to use p_open() so we can make sure we open for
writing; the addition of exclusive create is a good thing to do
regardless, as we want a temporary path for ourselves.

Lastly, MSVC doesn't quite know how to add two numbers if one of them is a
void pointer, so let's alias it to unsigned char.C

10 years agoindexer: use mmap for writing
Carlos Martín Nieto [Tue, 13 May 2014 00:41:48 +0000 (02:41 +0200)]
indexer: use mmap for writing

Some OSs cannot keep their ideas about file content straight when mixing
standard IO with file mapping. As we use mmap for reading from the
packfile, let's make writing to the pack file use mmap.

10 years agoGit binary check compat tests
Russell Belfer [Fri, 16 May 2014 23:30:58 +0000 (16:30 -0700)]
Git binary check compat tests

A variety of data patterns for diffs verified to match the
behavior of binary detection with Git on the command line.

10 years agoIncrease binary detection len to 8k
Russell Belfer [Fri, 16 May 2014 18:08:19 +0000 (11:08 -0700)]
Increase binary detection len to 8k

10 years agoMerge pull request #2360 from phkelley/noinherit
Russell Belfer [Fri, 16 May 2014 17:42:17 +0000 (10:42 -0700)]
Merge pull request #2360 from phkelley/noinherit

Win32: Supply _O_NOINHERIT when calling _wopen

10 years agoWin32: Supply _O_NOINHERIT when calling _wopen
Philip Kelley [Fri, 16 May 2014 16:38:56 +0000 (12:38 -0400)]
Win32: Supply _O_NOINHERIT when calling _wopen

10 years agoMerge pull request #2313 from libgit2/cmn/remote-delete
Vicent Marti [Fri, 16 May 2014 09:56:37 +0000 (11:56 +0200)]
Merge pull request #2313 from libgit2/cmn/remote-delete

Remote deletion

10 years agoremote: remove remote-tracking branches on delete
Carlos Martín Nieto [Wed, 30 Apr 2014 07:20:03 +0000 (09:20 +0200)]
remote: remove remote-tracking branches on delete

When we delete a remote, we also need to go through its fetch refspecs
and remove the references they create locally.

10 years agoMerge pull request #2357 from libgit2/cmn/pack-cache-init
Russell Belfer [Thu, 15 May 2014 22:31:13 +0000 (15:31 -0700)]
Merge pull request #2357 from libgit2/cmn/pack-cache-init

pack: init the cache on packfile alloc

10 years agoMerge pull request #2356 from libgit2/rb/restore-search-paths
Vicent Marti [Thu, 15 May 2014 18:25:54 +0000 (20:25 +0200)]
Merge pull request #2356 from libgit2/rb/restore-search-paths

Better global search path sandboxing in tests

10 years agopack: init the cache on packfile alloc
Carlos Martín Nieto [Thu, 15 May 2014 17:59:05 +0000 (19:59 +0200)]
pack: init the cache on packfile alloc

When running multithreaded, it is not enough to check for the offmap
allocation. Move the call to cache_init() to packfile allocation so we
can be sure it is always allocated free of races.

This fixes #2355.

10 years agoBetter search path sandboxing
Russell Belfer [Thu, 15 May 2014 17:56:28 +0000 (10:56 -0700)]
Better search path sandboxing

There are a number of tests that modify the global or system
search paths during the tests.  This adds a helper function to
make it easier to restore those paths and makes sure that they
are getting restored in a manner that preserves test isolation.

10 years agoFix mutex init/free in config_file.c
Philip Kelley [Thu, 15 May 2014 15:09:49 +0000 (11:09 -0400)]
Fix mutex init/free in config_file.c

10 years agoMerge pull request #2351 from linquize/init-var
Vicent Marti [Wed, 14 May 2014 14:05:23 +0000 (16:05 +0200)]
Merge pull request #2351 from linquize/init-var

Initialize local variable

10 years agoMerge pull request #2349 from libgit2/rb/coverity-fixes
Vicent Marti [Wed, 14 May 2014 10:20:24 +0000 (12:20 +0200)]
Merge pull request #2349 from libgit2/rb/coverity-fixes

Increase config snapshot usage

10 years agoMerge pull request #2348 from stewid/add-link-R-bindings
Vicent Marti [Wed, 14 May 2014 10:18:57 +0000 (12:18 +0200)]
Merge pull request #2348 from stewid/add-link-R-bindings

Add R bindings to the README

10 years agoIncrease use of config snapshots
Russell Belfer [Tue, 13 May 2014 23:32:27 +0000 (16:32 -0700)]
Increase use of config snapshots

And decrease extra reload checks of config data.

10 years agoSome coverity inspired cleanups
Russell Belfer [Tue, 13 May 2014 22:54:23 +0000 (15:54 -0700)]
Some coverity inspired cleanups

10 years agoAdd R bindings to the README
Stefan Widgren [Tue, 13 May 2014 20:43:59 +0000 (22:43 +0200)]
Add R bindings to the README

10 years agoInitialize local variable
Linquize [Tue, 13 May 2014 13:08:50 +0000 (21:08 +0800)]
Initialize local variable

10 years agoMerge pull request #2328 from libgit2/rb/how-broken-can-ignores-be
Vicent Marti [Tue, 13 May 2014 10:40:13 +0000 (12:40 +0200)]
Merge pull request #2328 from libgit2/rb/how-broken-can-ignores-be

Improve checks for ignore containment

10 years agoMerge pull request #2330 from libgit2/cmn/pack-unpack-loop
Vicent Marti [Tue, 13 May 2014 10:36:51 +0000 (12:36 +0200)]
Merge pull request #2330 from libgit2/cmn/pack-unpack-loop

Make pack object lookup use loops

10 years agoMerge pull request #2346 from kitbellew/fix2300
Vicent Marti [Tue, 13 May 2014 10:35:56 +0000 (12:35 +0200)]
Merge pull request #2346 from kitbellew/fix2300

Minor fix for previously merged netops code.

10 years agoWin32 fix for #2300.
Albert Meltzer [Tue, 13 May 2014 03:25:44 +0000 (20:25 -0700)]
Win32 fix for #2300.

The code doesn't use SSL and a test requires it.

10 years agopack: don't forget to cache the base object
Carlos Martín Nieto [Mon, 12 May 2014 00:01:05 +0000 (02:01 +0200)]
pack: don't forget to cache the base object

The base object is a good cache candidate, so we shouldn't forget to add
it to the cache.

10 years agopack: use stack allocation for smaller delta chains
Carlos Martín Nieto [Sun, 11 May 2014 03:31:22 +0000 (05:31 +0200)]
pack: use stack allocation for smaller delta chains

This avoid allocating the array on the heap for relatively small
chains. The expected performance increase is sadly not really
noticeable.

10 years agopack: expose a cached delta base directly
Carlos Martín Nieto [Sun, 11 May 2014 01:50:34 +0000 (03:50 +0200)]
pack: expose a cached delta base directly

Instead of going through a special entry in the chain, let's pass it as
an output parameter.

10 years agoMerge pull request #2336 from libgit2/rb/unicode-branch-names
Russell Belfer [Mon, 12 May 2014 17:51:56 +0000 (10:51 -0700)]
Merge pull request #2336 from libgit2/rb/unicode-branch-names

Pass unconverted Unicode path data when iconv doesn't like it

10 years agoMerge pull request #2334 from libgit2/rb/fix-2333
Russell Belfer [Mon, 12 May 2014 17:44:13 +0000 (10:44 -0700)]
Merge pull request #2334 from libgit2/rb/fix-2333

Be more careful with user-supplied buffers

10 years agoDon't scale diff stat when not needed
Russell Belfer [Mon, 12 May 2014 17:28:45 +0000 (10:28 -0700)]
Don't scale diff stat when not needed

10 years agoMinor fixes for warnings and error propagation
Russell Belfer [Mon, 12 May 2014 17:24:46 +0000 (10:24 -0700)]
Minor fixes for warnings and error propagation

10 years agoMerge pull request #2300 from libgit2/cmn/match-host-tests
Russell Belfer [Mon, 12 May 2014 17:15:30 +0000 (10:15 -0700)]
Merge pull request #2300 from libgit2/cmn/match-host-tests

Some improvements to the cert checking

10 years agoMerge pull request #2188 from libgit2/cmn/config-snapshot
Russell Belfer [Mon, 12 May 2014 17:04:52 +0000 (10:04 -0700)]
Merge pull request #2188 from libgit2/cmn/config-snapshot

Configuration snapshotting

10 years agopack: simplify delta chain code
Carlos Martín Nieto [Fri, 9 May 2014 07:36:09 +0000 (09:36 +0200)]
pack: simplify delta chain code

The switch makes the loop somewhat unwieldy. Let's assume it's fine and
perform the check when we're accessing the data.

This makes our code look a lot more like git's.

10 years agopack: preallocate a 64-element chain
Carlos Martín Nieto [Thu, 8 May 2014 15:14:59 +0000 (17:14 +0200)]
pack: preallocate a 64-element chain

Dependency chains are often large and require a few
reallocations. Allocate a 64-element chain before doing anything else to
avoid allocations during the loop.

This value comes from the stack-allocated one git uses. We still
allocate this on the heap, but it does help performance a little bit.

10 years agopack: make sure not to leak the dep chain
Carlos Martín Nieto [Thu, 8 May 2014 14:24:54 +0000 (16:24 +0200)]
pack: make sure not to leak the dep chain

10 years agopack: use a cache for delta bases when unpacking
Carlos Martín Nieto [Tue, 6 May 2014 21:37:28 +0000 (23:37 +0200)]
pack: use a cache for delta bases when unpacking

Bring back the use of the delta base cache for unpacking objects. When
generating the delta chain, we stop when we find a delta base in the
pack's cache and use that as the starting point.

10 years agopack: unpack using a loop
Carlos Martín Nieto [Tue, 6 May 2014 17:20:33 +0000 (19:20 +0200)]
pack: unpack using a loop

We currently make use of recursive function calls to unpack an object,
resolving the deltas as we come back down the chain. This means that we
have unbounded stack growth as we look up objects in a pack.

This is now done in two steps: first we figure out what the dependency
chain is by looking up the delta bases until we reach a non-delta
object, pushing the information we need onto a stack and then we pop
from that stack and apply the deltas until there are no more left.

This version of the code does not make use of the delta base cache so it
is slower than what's in the mainline. A later commit will reintroduce
it.

10 years agopack: do not repeat the same error message four times
Carlos Martín Nieto [Tue, 6 May 2014 19:21:04 +0000 (21:21 +0200)]
pack: do not repeat the same error message four times

Repeating this error message makes it harder to find out where we
actually are finding the error, and they don't really describe what
we're trying to do.

10 years agopack: remove misleading comment
Carlos Martín Nieto [Tue, 6 May 2014 14:20:14 +0000 (16:20 +0200)]
pack: remove misleading comment

10 years agoMerge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlf
Vicent Marti [Fri, 9 May 2014 06:59:59 +0000 (08:59 +0200)]
Merge pull request #2331 from libgit2/rb/dont-stop-diff-on-safecrlf

Add filter options and ALLOW_UNSAFE

10 years agoDisable threads::refdb::edit_while_iterate test
Russell Belfer [Thu, 8 May 2014 22:01:07 +0000 (15:01 -0700)]
Disable threads::refdb::edit_while_iterate test

It seems that with the various recent changes to reference updating
and reflog writing, that the thread safety of refdb updates has
been reduced (either that or it was never thread safe and the
window for error has increased).  Either way, this test is now
sometimes segfaulting which is no good, so let's disable the test
for now.  We don't really make any public promises about thread
safety for this type of operation, so I think this is acceptable,
at least in the short term.

10 years agoDon't always test composed-insensitive lookups
Russell Belfer [Thu, 8 May 2014 21:48:27 +0000 (14:48 -0700)]
Don't always test composed-insensitive lookups

Only on a filesystem that is composed/decomposed insensitive,
should be testing that a branch can be looked up by the opposite
form and still work correctly.

10 years agoAllow cl_repo_get_bool to work with missing key
Russell Belfer [Thu, 8 May 2014 21:33:37 +0000 (14:33 -0700)]
Allow cl_repo_get_bool to work with missing key

One of the test helpers provides a quick way for looking up a
boolean key.  But if the key way missing completely, the check
would actually raise an error.  Given the way we use this helper,
if the key is missing, this should just return false, I think.

10 years agoMerge pull request #2335 from libgit2/cmn/indexer-vector-handling
Vicent Marti [Thu, 8 May 2014 21:16:21 +0000 (23:16 +0200)]
Merge pull request #2335 from libgit2/cmn/indexer-vector-handling

indexer: avoid memory moves

10 years agoPass unconverted data when iconv doesn't like it
Russell Belfer [Thu, 8 May 2014 20:52:46 +0000 (13:52 -0700)]
Pass unconverted data when iconv doesn't like it

When using Iconv to convert unicode data and iconv doesn't like
the source data (because it thinks that it's not actual UTF-8),
instead of stopping the operation, just use the unconverted data.
This will generally do the right thing on the filesystem, since
that is the source of the non-UTF-8 path data anyhow.

This adds some tests for creating and looking up branches with
messy Unicode names.  Also, this takes the helper function that
was previously internal to `git_repository_init` and makes it
into `git_path_does_fs_decompose_unicode` which is a useful in
tests to understand what the expected results should be.

10 years agoindexer: avoid memory moves
Carlos Martín Nieto [Thu, 8 May 2014 20:31:59 +0000 (22:31 +0200)]
indexer: avoid memory moves

Our vector does a move of the rest of the array when we remove an
item. Doing this repeatedly can be expensive, and we do this a lot in
the indexer. Instead, set the value to NULL and skip those entries.

perf reported around 30% of `index-pack` time was going into
memmove. With this change, that goes away and we spent most of the time
hashing and inflating data.

10 years agoMerge pull request #2332 from libgit2/peff/iconv
Russell Belfer [Thu, 8 May 2014 20:29:09 +0000 (13:29 -0700)]
Merge pull request #2332 from libgit2/peff/iconv

iconv debugging aids

10 years agoexamples: add a basic for-each-ref example
Jeff King [Thu, 8 May 2014 05:06:38 +0000 (01:06 -0400)]
examples: add a basic for-each-ref example

This is quite close to running "git for-each-ref" except:

  1. It does not take any formatting or selection options at
     all.

  2. The output is not sorted.

I wrote it to look at debugging some issues with ref
iteration, but there's no reason it can't live on as an
example command.

10 years agocmake: s/ICONV/Iconv/ in FIND_PACKAGE
Jeff King [Thu, 8 May 2014 04:35:56 +0000 (00:35 -0400)]
cmake: s/ICONV/Iconv/ in FIND_PACKAGE

The cmake module we provide is in the file FindIconv.cmake,
so we must match the case correctly. It happens to work in
practice because we only turn on ICONV on Darwin, and people
generally have case-insensitive filesystems there.

Note that we only need to update the package name here. The
package itself still sets the all-uppercase ICONV_FOUND
flag, so we continue to use uppercase in the rest of cmake.

10 years agoUse unsigned type for APIs with opt flag mask
Russell Belfer [Thu, 8 May 2014 17:46:04 +0000 (10:46 -0700)]
Use unsigned type for APIs with opt flag mask

10 years agoBe more careful with user-supplied buffers
Russell Belfer [Thu, 8 May 2014 17:17:14 +0000 (10:17 -0700)]
Be more careful with user-supplied buffers

This adds in missing calls to `git_buf_sanitize` and fixes a
number of places where `git_buf` APIs could inadvertently write
NUL terminator bytes into invalid buffers.  This also changes the
behavior of `git_buf_sanitize` to NUL terminate a buffer if it can
and of `git_buf_shorten` to do nothing if it can.

Adds tests of filtering code with zeroed (i.e. unsanitized) buffer
which was previously triggering a segfault.

10 years agorepository: introduce a convenience config snapshot method
Carlos Martín Nieto [Wed, 7 May 2014 09:34:32 +0000 (11:34 +0200)]
repository: introduce a convenience config snapshot method

Accessing the repository's config and immediately taking a snapshot of
it is a common operation, so let's provide a convenience function for
it.

10 years agoMerge pull request #2329 from anuraggup/fix_git_shutdown
Russell Belfer [Tue, 6 May 2014 23:11:03 +0000 (16:11 -0700)]
Merge pull request #2329 from anuraggup/fix_git_shutdown

Fix the issues in git_shutdown

10 years agoAdd filter options and ALLOW_UNSAFE
Russell Belfer [Tue, 6 May 2014 23:01:49 +0000 (16:01 -0700)]
Add filter options and ALLOW_UNSAFE

Diff and status do not want core.safecrlf to actually raise an
error regardless of the setting, so this extends the filter API
with an additional options flags parameter and adds a flag so that
filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating
that unsafe filter application should be downgraded from a failure
to a warning.

10 years agoMerge pull request #2324 from libgit2/cmn/file-in-objects-dir
Russell Belfer [Tue, 6 May 2014 21:03:58 +0000 (14:03 -0700)]
Merge pull request #2324 from libgit2/cmn/file-in-objects-dir

odb: ignore files in the objects dir

10 years agoFix the issues in git_shutdown
Anurag Gupta [Tue, 6 May 2014 20:33:47 +0000 (13:33 -0700)]
Fix the issues in git_shutdown

1) Call to git_shutdown results in setting git__n_shutdown_callbacks
to -1. Next call to git__on_shutdown results in ABW (Array Bound Write)
for array git__shutdown_callbacks. In the current Implementation,
git_atomic_dec is called git__n_shutdown_callbacks + 1 times. I have
modified it to a for loop so that it is more readable. It would not
set git__n_shutdown_callbacks to a negative number and reset the
elements of git__shutdown_callbacks to NULL.

2) In function git_sysdir_get, shutdown function is registered only if
git_sysdir__dirs_shutdown_set is set to 0. However, after this variable
is set to 1, it is never reset to 0. If git_sysdir_global_init is
called again from synchronized_threads_init it does not register
shutdown function for this subsystem.

10 years agoImprove checks for ignore containment
Russell Belfer [Tue, 6 May 2014 19:41:26 +0000 (12:41 -0700)]
Improve checks for ignore containment

The diff code was using an "ignored_prefix" directory to track if
a parent directory was ignored that contained untracked files
alongside tracked files. Unfortunately, when negative ignore rules
were used for directories inside ignored parents, the wrong rules
were applied to untracked files inside the negatively ignored
child directories.

This commit moves the logic for ignore containment into the workdir
iterator (which is a better place for it), so the ignored-ness of
a directory is contained in the frame stack during traversal.  This
allows a child directory to override with a negative ignore and yet
still restore the ignored state of the parent when we traverse out
of the child.

Along with this, there are some problems with "directory only"
ignore rules on container directories.  Given "a/*" and "!a/b/c/"
(where the second rule is a directory rule but the first rule is
just a generic prefix rule), then the directory only constraint
was having "a/b/c/d/file" match the first rule and not the second.
This was fixed by having ignore directory-only rules test a rule
against the prefix of a file with LEADINGDIR enabled.

Lastly, spot checks for ignores using `git_ignore_path_is_ignored`
were tested from the top directory down to the bottom to deal with
the containment problem, but this is wrong. We have to test bottom
to top so that negative subdirectory rules will be checked before
parent ignore rules.

This does change the behavior of some existing tests, but it seems
only to bring us more in line with core Git, so I think those
changes are acceptable.

10 years agoobject: fix a brace
Carlos Martín Nieto [Tue, 6 May 2014 19:14:58 +0000 (21:14 +0200)]
object: fix a brace

The brace in the check for peel's return was surrounding the wrong
thing, which made 'error' be set to 1 when there was an error instead of
the error code.

10 years agoFix the issues in git__on_shutdown
Anurag Gupta [Tue, 6 May 2014 19:16:24 +0000 (12:16 -0700)]
Fix the issues in git__on_shutdown

10 years agoodb: ignore files in the objects dir
Carlos Martín Nieto [Mon, 5 May 2014 14:04:14 +0000 (16:04 +0200)]
odb: ignore files in the objects dir

We assume that everything under GIT_DIR/objects/ is a directory. This is
not necessarily the case if some process left a stray file in there.

Check beforehand if we do have a directory and ignore the entry
otherwise.

10 years agoDoc fixes
Russell Belfer [Fri, 2 May 2014 22:15:43 +0000 (15:15 -0700)]
Doc fixes

10 years agoMerge pull request #2308 from libgit2/rb/diff-update-index-stat-cache
Vicent Marti [Fri, 2 May 2014 16:50:15 +0000 (09:50 -0700)]
Merge pull request #2308 from libgit2/rb/diff-update-index-stat-cache

Reduce excessive OID calculation for diff and stat

10 years agoMerge pull request #2310 from libgit2/cmn/commit-create-safe
Russell Belfer [Fri, 2 May 2014 16:42:07 +0000 (09:42 -0700)]
Merge pull request #2310 from libgit2/cmn/commit-create-safe

commit: safer commit creation with reference update

10 years agoSome further sandboxing cleanups to tests
Russell Belfer [Thu, 1 May 2014 22:12:12 +0000 (15:12 -0700)]
Some further sandboxing cleanups to tests

Trying to find other issues where tests may not clean up quite
properly when they are through...

10 years agoImprove handling of fake home directory
Russell Belfer [Thu, 1 May 2014 21:47:33 +0000 (14:47 -0700)]
Improve handling of fake home directory

There are a few tests that set up a fake home directory and a
fake GLOBAL search path so that we can test things in global
ignore or attribute or config files.  This cleans up that code to
work more robustly even if there is a test failure.  This also
fixes some valgrind warnings where scanning search paths for
separators could end up doing a little bit of sketchy data access
when coming to the end of search list.

10 years agoFix remaining init_options inconsistencies
Russell Belfer [Wed, 30 Apr 2014 18:16:31 +0000 (11:16 -0700)]
Fix remaining init_options inconsistencies

There were a couple of "init_opts()" functions a few more cases
of structure initialization that I somehow missed.

10 years agoMake init_options fns use unsigned ints and macro
Russell Belfer [Wed, 30 Apr 2014 17:57:42 +0000 (10:57 -0700)]
Make init_options fns use unsigned ints and macro

Use an unsigned int for the version and add a helper macro so the
code is simplified (and so the error message is a common string).

10 years agoRemove trace / add git_diff_perfdata struct + api
Russell Belfer [Tue, 29 Apr 2014 22:05:58 +0000 (15:05 -0700)]
Remove trace / add git_diff_perfdata struct + api

10 years agoGet rid of redundant git_diff_options_init fn
Russell Belfer [Tue, 29 Apr 2014 21:30:15 +0000 (14:30 -0700)]
Get rid of redundant git_diff_options_init fn

Since git_diff_init_options was introduced, remove this old fn.

10 years agoAdd payloads, bitmaps to trace API
Russell Belfer [Tue, 29 Apr 2014 18:29:49 +0000 (11:29 -0700)]
Add payloads, bitmaps to trace API

This is a proposed adjustment to the trace APIs.  This makes the
trace levels into a bitmask so that they can be selectively enabled
and adds a callback-level payload, plus a message-level payload.

This makes it easier for me to a GIT_TRACE_PERF callbacks that
are simply bypassed if the PERF level is not set.

10 years agoDon't use trace if GIT_TRACE not defined
Russell Belfer [Mon, 28 Apr 2014 23:47:39 +0000 (16:47 -0700)]
Don't use trace if GIT_TRACE not defined

10 years agoAdd GIT_STATUS_OPT_UPDATE_INDEX and use trace API
Russell Belfer [Mon, 28 Apr 2014 23:39:53 +0000 (16:39 -0700)]
Add GIT_STATUS_OPT_UPDATE_INDEX and use trace API

This adds an option to refresh the stat cache while generating
status.  It also rips out the GIT_PERF stuff I had an makes use
of the trace API to keep statistics about what happens during diff.

10 years agoAdd diff option to update index stat cache
Russell Belfer [Mon, 28 Apr 2014 21:48:41 +0000 (14:48 -0700)]
Add diff option to update index stat cache

When diff is scanning the working directory, if it finds a file
where it is not sure if the index entry matches the working dir,
it will recalculate the OID (which is pretty expensive).  This
adds a new flag to diff so that if the OID calculation finds that
the file actually has not changed (i.e. just the modified time was
altered or such), then it will refresh the stat cache in the index
so that future calls to diff will not have to check the oid again.

10 years agoLay groundwork for updating stat cache in diff
Russell Belfer [Mon, 28 Apr 2014 21:34:55 +0000 (14:34 -0700)]
Lay groundwork for updating stat cache in diff

This reorganized the diff OID calculation to make it easier to
correctly update the stat cache during a diff once the flags to
do so are enabled.

This includes marking the path of a git_index_entry as const so
we can make a "fake" git_index_entry with a "const char *" path
and not get warnings.  I was a little surprised at how unobtrusive
this change was, but I think it's probably a good thing.

10 years agoSkip diff oid calc when size definitely changed
Russell Belfer [Mon, 28 Apr 2014 21:16:26 +0000 (14:16 -0700)]
Skip diff oid calc when size definitely changed

When we think the stat cache in the index seems valid and the size
or mode of a file has definitely changed, then don't bother trying
to recalculate the OID of the workdir bits to confirm that it is
modified - just accept that it is modified.

This can result in files that show as modified with no actual diff,
but the behavior actually appears to match Git on the command line.

This also includes a minor optimization to not perform a submodule
lookup on the ".git" directory itself.

10 years agoAdd build option for diff internal statistics
Russell Belfer [Mon, 28 Apr 2014 21:04:29 +0000 (14:04 -0700)]
Add build option for diff internal statistics

10 years agoTemporary fix for Travis CI builds
Vicent Marti [Fri, 2 May 2014 15:14:04 +0000 (17:14 +0200)]
Temporary fix for Travis CI builds

See https://github.com/libgit2/libgit2/pull/2321#issuecomment-42039673
We may rollback once we found something more reliable

10 years agoMerge pull request #2318 from linquize/sleep
Vicent Marti [Fri, 2 May 2014 10:37:40 +0000 (03:37 -0700)]
Merge pull request #2318 from linquize/sleep

Make examples/status.c compile on Windows

10 years agoMerge pull request #2320 from libgit2/rb/fix-starstar-again
Vicent Marti [Fri, 2 May 2014 10:36:22 +0000 (03:36 -0700)]
Merge pull request #2320 from libgit2/rb/fix-starstar-again

Make ** pattern eat trailing slash

10 years agoMake ** pattern eat trailing slash
Russell Belfer [Thu, 1 May 2014 19:46:46 +0000 (12:46 -0700)]
Make ** pattern eat trailing slash

This allows "foo/**/*.html" to match "foo/file.html"

10 years agoMake examples/status.c compile on Windows
Linquize [Thu, 1 May 2014 14:39:35 +0000 (22:39 +0800)]
Make examples/status.c compile on Windows

10 years agogit_pool_mallocsz takes an unsigned long
Jacques Germishuys [Sun, 27 Apr 2014 13:00:00 +0000 (15:00 +0200)]
git_pool_mallocsz takes an unsigned long