Commit Graph

6779 Commits

Author SHA1 Message Date
Russell Belfer
9862ef8ef8 Merge pull request #2310 from libgit2/cmn/commit-create-safe
commit: safer commit creation with reference update
2014-05-02 09:42:07 -07:00
Russell Belfer
99dfa47039 Some further sandboxing cleanups to tests
Trying to find other issues where tests may not clean up quite
properly when they are through...
2014-05-02 09:21:33 -07:00
Russell Belfer
0f603132bc 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.
2014-05-02 09:21:33 -07:00
Russell Belfer
bc91347b58 Fix remaining init_options inconsistencies
There were a couple of "init_opts()" functions a few more cases
of structure initialization that I somehow missed.
2014-05-02 09:21:33 -07:00
Russell Belfer
702efc891f 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).
2014-05-02 09:21:33 -07:00
Russell Belfer
9c8ed49997 Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
Russell Belfer
7a2e56a3f6 Get rid of redundant git_diff_options_init fn
Since git_diff_init_options was introduced, remove this old fn.
2014-05-02 09:21:33 -07:00
Russell Belfer
b23b112dfe 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.
2014-05-02 09:21:33 -07:00
Russell Belfer
225aab5d6a Don't use trace if GIT_TRACE not defined 2014-05-02 09:21:33 -07:00
Russell Belfer
cd424ad551 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.
2014-05-02 09:21:33 -07:00
Russell Belfer
94fb4aadc8 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.
2014-05-02 09:21:33 -07:00
Russell Belfer
0fc8e1f6bd 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.
2014-05-02 09:21:33 -07:00
Russell Belfer
8ef4e11a76 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.
2014-05-02 09:21:32 -07:00
Russell Belfer
240f4af321 Add build option for diff internal statistics 2014-05-02 09:21:32 -07:00
Vicent Marti
6a1ca96e41 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
2014-05-02 17:14:33 +02:00
Vicent Marti
89e9c1674c Merge pull request #2318 from linquize/sleep
Make examples/status.c compile on Windows
2014-05-02 03:37:40 -07:00
Vicent Marti
644592bc73 Merge pull request #2320 from libgit2/rb/fix-starstar-again
Make ** pattern eat trailing slash
2014-05-02 03:36:22 -07:00
Russell Belfer
d19b2f9f9f Make ** pattern eat trailing slash
This allows "foo/**/*.html" to match "foo/file.html"
2014-05-01 12:46:46 -07:00
Linquize
d0420fc681 Make examples/status.c compile on Windows 2014-05-01 22:39:35 +08:00
Jacques Germishuys
f5dd2a2891 git_pool_mallocsz takes an unsigned long 2014-05-01 10:49:51 +02:00
Jacques Germishuys
6e94a1efbc _InterlockedExchange expects a volatile LONG 2014-05-01 10:49:51 +02:00
Jacques Germishuys
1017f81f00 Undef lseek first 2014-05-01 10:49:51 +02:00
Vicent Marti
9d878fc420 Merge pull request #2304 from jacquesg/solaris
Solaris!
2014-05-01 01:23:10 -07:00
Jacques Germishuys
183aa4f831 Check for NULL before passing it to vsnprintf 2014-04-30 22:58:40 +02:00
Jacques Germishuys
6b05240cea strcasecmp is in <strings.h> 2014-04-30 17:05:13 +02:00
Jacques Germishuys
98b8fcff4f Build regex.c for Solaris. Added required defines for Solaris 2014-04-30 17:05:13 +02:00
Carlos Martín Nieto
5cdac19caa remote: move branch upstream deletion to use an iterator
This should make it more readable and allocate a bunch fewer strings.
2014-04-30 14:47:32 +02:00
Vicent Marti
c522bed0af Merge pull request #2314 from libgit2/cmn/known-libs
Assorted CMake fixups
2014-04-30 05:45:31 -07:00
Vicent Marti
739040e667 Merge pull request #2315 from jacquesg/qsort-cygwin
cygwin also doesn't have qsort_r
2014-04-30 05:34:33 -07:00
Jacques Germishuys
90a4340aaa cygwin also doesn't have qsort_r 2014-04-30 13:17:15 +02:00
Carlos Martín Nieto
039e354b7d ciscript: don't use an empty string as a number
An empty string is not a valid number, and some shells complain.

Check instead if $COVERITY is non-empty, which is a common convention
and what we're doing anyway.
2014-04-30 12:02:10 +02:00
nulltoken
40e48ea40f remote: Introduce git_remote_delete() 2014-04-30 11:45:49 +02:00
Carlos Martín Nieto
891b0277af refs: document _next_name()
If it's not documented, it doesn't show up in the docs (and we really
should document, anyway).
2014-04-30 11:20:51 +02:00
Carlos Martín Nieto
f5fc63bc0c Don't exclude libssh2 from MinGW
It reportedly works. It does not however work when cross-compiling on
Travis, so let's disable it there.

This fixes #2311.
2014-04-30 11:15:41 +02:00
Ting-Wei Lan
096ac799a3 Workaround missing .pc files on FreeBSD
This fixes #2118
2014-04-30 10:51:44 +02:00
Carlos Martín Nieto
04739e9f4a Unquiet CMake output
The point of this phase is to know what we have and not. Show the user a
clear indication of what we have.
2014-04-30 10:15:44 +02:00
nulltoken
48ebea662a tests: Introduce count_config_entries_match() helper 2014-04-30 07:24:20 +02:00
Carlos Martín Nieto
217c029b54 commit: safer commit creation with reference update
The current version of the commit creation and amend function are unsafe
to use when passing the update_ref parameter, as they do not check that
the reference at the moment of update points to what the user expects.

Make sure that we're moving history forward when we ask the library to
update the reference for us by checking that the first parent of the new
commit is the current value of the reference. We also make sure that the
ref we're updating hasn't moved between the read and the write.

Similarly, when amending a commit, make sure that the current tip of the
branch is the commit we're amending.
2014-04-30 00:41:37 +02:00
Vicent Marti
892778ee84 Merge pull request #2309 from jacquesg/midnightbsd
MidnightBSD may also not have strnlen
2014-04-29 05:02:38 -07:00
Jacques Germishuys
36a6151833 MidnightBSD may also not have strnlen 2014-04-29 13:28:16 +02:00
Vicent Marti
041336e6bd Merge pull request #2306 from odcinek/development_cmake
Make the build CMake 2.6 compatible
2014-04-28 07:36:27 -07:00
Marcin Sawicki
7f0de93a0d Make the build CMake 2.6 compatible 2014-04-28 15:24:36 +01:00
Vicent Marti
ec77105889 Merge pull request #2301 from libgit2/cmn/pack-objects-memory
Keep the deflate buffer from ballooning up
2014-04-27 03:57:53 -07:00
Carlos Martín Nieto
38d338b2b8 pack-objects: always write out the status in write_one()
Make sure we set the output parameter to a value.
2014-04-26 18:15:39 +02:00
Carlos Martín Nieto
c7f86efb13 zstream: grow based on used memory rather than allocated
When deflating data, we might need to grow the buffer. Currently we
add a guess on top of the currently-allocated buffer size.

When we re-use the buffer, it already has some memory allocated; adding
to that means that we always grow the buffer regardless of how much we
need to use.

Instead, increase on top of the currently-used size. This still leaves
us with the allocated size of the largest object we compress, but it's a
minor pain compared to unbounded growth.

This fixes #2285.
2014-04-26 18:04:43 +02:00
Carlos Martín Nieto
783555d8e1 netops: catch the server not sending a certificate
It's possible for an encrypted connection not have a certificate. In
this case, SSL_get_verify_result() will return OK because no error
happened (as it never even tried to validate anything).

SSL_get_peer_certificate() will return NULL in this case so we need to
catch that. On the upside, the current code would segfault in this
situation instead of letting it through as a valid cert.
2014-04-26 17:27:43 +02:00
Carlos Martín Nieto
51d3f6f5f2 netops: provide more specific error for cert failure
Specify what we do not like about the certificate. In this case, we do
not like the name.
2014-04-26 17:27:43 +02:00
Carlos Martín Nieto
1f0d4f3d8d netops: unit-test the cert host-name pattern matching
This kind of stuff should have unit tests, even if it's just to show
what we expect to match successfully.
2014-04-26 17:27:42 +02:00
Carlos Martín Nieto
4f9d54146d refdb: fix typo and wording 2014-04-26 14:29:18 +02:00
Vicent Marti
e79a2998cb Merge pull request #2299 from mekishizufu/fix_leaks
Plug some leaks
2014-04-25 07:08:41 -07:00