Commit Graph

8635 Commits

Author SHA1 Message Date
Edward Thomson
121c3171e5 Introduce p_utimes and p_futimes
Provide functionality to set the time on a filesystem entry,
using utimes or futimes on POSIX type systems or SetFileTime
on Win32.
2015-06-16 15:32:02 -04:00
Edward Thomson
5f83758fa3 Merge pull request #3209 from libgit2/cmn/double-author
commit: ignore multiple author fields
2015-06-16 10:40:46 -04:00
Edward Thomson
86faea5fce Merge pull request #3225 from libgit2/cmn/url-empty
remote: return EINVALIDSPEC when given an empty URL
2015-06-16 08:45:55 -04:00
Carlos Martín Nieto
47a40d1d44 remote: return EINVALIDSPEC when given an empty URL
This is what we used to return in the settter and there's tests in
bindings which ask for this. There's no particular reason to stop doing
so.
2015-06-16 14:04:23 +02:00
Carlos Martín Nieto
aeb2b991b0 Merge pull request #3221 from git-up/build_warnings
Fixed Xcode 6.1 build warnings
2015-06-16 09:20:36 +02:00
Carlos Martín Nieto
e44abe16bd tests: tick the index when we count OID calculations
These tests want to test that we don't recalculate entries which match
the index already. This is however something we force when truncating
racily-clean entries.

Tick the index forward as we know that we don't perform the
modifications which the racily-clean code is trying to avoid.
2015-06-16 08:51:45 +02:00
Carlos Martín Nieto
c4e6ab5f23 crlf: tick the index forward to work around racy-git behaviour
In order to avoid racy-git, we zero out the file size for entries with
the same timestamp as the index (or during the initial checkout). This
is the case in a couple of crlf tests, as the code is fast enough to do
everything in the same second.

As we know that we do not perform the modification just after writing
out the index, which is what this is designed to work around, tick the
mtime of the index file such that it doesn't agree with the files
anymore, and we do not zero out these entries.
2015-06-16 08:40:45 +02:00
Carlos Martín Nieto
316b820b6f index: zero the size of racily-clean entries
If a file entry has the same timestamp as the index itself, it is
considered racily-clean, as it may have been modified after the index
was written, but during the same second. We take extra steps to check
the contents, but this is just one part of avoiding races.

For files which do have changes but have not been updated in the index,
updating the on-disk index means updating its timestamp, which means we
would no longer recognise these entries as racy and we would trust the
timestamp to tell us whether they have changed.

In order to work around this, git zeroes out the file-size field in
entries with the same timestamp as the index in order to force the next
diff to check the contents. Do so in libgit2 as well.
2015-06-16 08:40:45 +02:00
Carlos Martín Nieto
77596fcfd7 diff: add failing test for racy-git in the index
We update the index and then immediately change the contents of the
file. This makes the diff think there are no changes, as the timestamp
of the file agrees with the cached data. This is however a bug, as the
file has obviously changed contents.

The test is a bit fragile, as it assumes that the index writing and the
following modification of the file happen in the same second, but it's
enough to show the issue.
2015-06-16 08:40:45 +02:00
Edward Thomson
b93dcd4ca4 Merge pull request #3216 from dprofeta/fixTransactionVisibility
Fix visibility of transaction symbol
2015-06-15 17:10:35 -04:00
Pierre-Olivier Latour
0f4d9c0367 Fixed Xcode 6.1 build warnings 2015-06-15 09:55:12 -07:00
Edward Thomson
f621f087b2 Merge pull request #3220 from libgit2/cmn/readdir
path: remove unnecessary readdir_r usage
2015-06-15 09:11:32 -04:00
Carlos Martín Nieto
25bd0aaf20 path: remove unnecessary readdir_r usage
Arguably all uses of readdir_r are unnecessary, but in this case
especially so, as the directory handle only exists within this function,
so we don't race with anybody.
2015-06-15 13:43:48 +02:00
Carlos Martín Nieto
2665fefa0f Merge pull request #3171 from libgit2/cmn/link-fallback
clone: fall back to copying when linking does not work
2015-06-15 10:20:58 +02:00
Logan Collins
b224c38869 Fix in stransport_stream.c for usage of SecCopyErrorMessageString(), which is unavailable to iOS targets. 2015-06-15 10:15:57 +02:00
Carlos Martín Nieto
d4723c89d4 Merge pull request #3177 from ethomson/binary_diff
Binary diffs: store deltas in the diff structure, include binary data in diff callbacks
2015-06-15 08:17:45 +02:00
Carlos Martín Nieto
ae22ef0e5a Merge pull request #3217 from jeffhostetler/leak_checkout_icase
Fix leaks in tests/checkout/icase
2015-06-15 08:09:21 +02:00
Carlos Martín Nieto
f2dec48118 Merge pull request #3215 from jeffhostetler/windows_leak_diriter
Fix memory leak on windows in diriter.
2015-06-12 18:35:18 +02:00
Jeff Hostetler
26d5c0b823 Fix leaks in tests/checkout/icase 2015-06-12 09:28:47 -07:00
Damien PROFETA
5c757327fa Fix visibility of transaction symbol
Transaction.c did not include the visibility definition of its symbol
(that are in git2/transaction.h) and so was by default hidden.
2015-06-12 18:14:32 +02:00
Jeff Hostetler
95639dbb9b Fix memory leak on windows in diriter. 2015-06-12 08:50:48 -07:00
Edward Thomson
0e522f6e6a binary diff: document changes in CHANGELOG 2015-06-12 09:39:37 -04:00
Edward Thomson
3208df37fb patch: include diff options on blob->blob diffs 2015-06-12 09:39:33 -04:00
Edward Thomson
391281ae34 binary diff: test binary blob to blob tests 2015-06-12 09:39:29 -04:00
Edward Thomson
8147b1aff5 diff: introduce binary diff callbacks
Introduce a new binary diff callback to provide the actual binary
delta contents to callers.  Create this data from the diff contents
(instead of directly from the ODB) to support binary diffs including
the workdir, not just things coming out of the ODB.
2015-06-12 09:39:20 -04:00
Edward Thomson
ac7012a81f binary diff: test index->workdir binary diffs 2015-06-12 09:24:59 -04:00
Carlos Martín Nieto
6995b18ad2 Merge pull request #3208 from git-up/secure_transport
Fixed some Secure Transport issues on OS X
2015-06-12 14:52:48 +02:00
Carlos Martín Nieto
4ce58244a2 Merge pull request #3214 from libgit2/cmn/push-tests
travis: fail if we fail the push tests
2015-06-12 14:51:59 +02:00
Carlos Martín Nieto
352ee17152 clone: set the credentials callback during testing 2015-06-12 12:45:49 +02:00
Carlos Martín Nieto
0f69b41d2e push: pass the callbacks during setup as well
We need to pass these options in order to have the credentials callback
set.
2015-06-12 12:33:55 +02:00
Carlos Martín Nieto
6042a050f9 travis: fail if we fail the push tests
These tests were not being taken into consideration for the failure of
the test. They've been failing for a while now, but we hadn't noticed as
Travis was reporting the builds successful.
2015-06-12 12:17:03 +02:00
Pierre-Olivier Latour
6d0a0acafa Fixed some Secure Transport issues on OS X
The read and write callbacks passed to SSLSetIOFuncs() have been
rewritten to match the implementation used on opensource.apple.com and
other open source projects like VLC.

This change also fixes a bug where the read callback could get into
an infinite loop when 0 bytes were read.
2015-06-11 23:20:28 -07:00
Carlos Martín Nieto
2deb36081c Merge pull request #3155 from mgorny/userpass-const
cred_helpers: Add 'const' qualifiers to git_cred_userpass_payload
2015-06-11 08:54:48 +02:00
Carlos Martín Nieto
65d69fe854 commit: ignore multiple author fields
Some tools create multiple author fields. git is rather lax when parsing
them, although fsck does complain about them. This means that they exist
in the wild.

As it's not too taxing to check for them, and there shouldn't be a
noticeable slowdown when dealing with correct commits, add logic to skip
over these extra fields when parsing the commit.
2015-06-11 08:24:58 +02:00
Carlos Martín Nieto
fa934fabf7 Merge pull request #3205 from ethomson/crlf_query
Introduce `git_filter_list_contains`
2015-06-11 07:17:34 +02:00
Carlos Martín Nieto
3fcfede184 Merge pull request #3207 from ethomson/winhttp_eol
Correct line endings on winhttp.def
2015-06-11 07:13:07 +02:00
Edward Thomson
3e8c5e45cb Merge pull request #3174 from libgit2/cmn/idx-fill-hole
indexer: use lseek to extend the packfile
2015-06-10 16:43:48 -04:00
Edward Thomson
7f8cd672a1 Merge pull request #3204 from git-up/git_diff_find_similar
Fixed handling of GIT_DELTA_CONFLICTED  in git_diff_find_similar()
2015-06-10 16:42:07 -04:00
Edward Thomson
4f0f2b8473 Correct line endings on winhttp.def 2015-06-10 16:36:38 -04:00
Edward Thomson
2eecc2886b Introduce git_filter_list_contains
`git_filter_list_contains` can be used to query a filter list to
determine if a given filter will be run.
2015-06-10 14:43:49 -04:00
Carlos Martín Nieto
4e883b5ec7 Merge pull request #3203 from ethomson/gitattributes
gitattributes: let clients use native line endings
2015-06-10 19:55:18 +02:00
Pierre-Olivier Latour
50456801c0 Fixed handling of GIT_DELTA_CONFLICTED in git_diff_find_similar()
git_diff_find_similar() now ignores git_diff_delta records with a status
of GIT_DELTA_CONFLICTED, which fixes a crash due to assert() being hit.
2015-06-10 10:09:10 -07:00
Edward Thomson
f284e72946 gitattributes: let clients use native line endings
Use "text=auto" to ensure that we get LFs in the repository, but
let clients have their native line endings in their worktree.
2015-06-10 12:24:06 -04:00
Edward Thomson
da6720fcc5 Merge pull request #3201 from libgit2/cmn/coverity
A few more fixes from coverity
2015-06-10 09:02:54 -04:00
Carlos Martín Nieto
0137aba568 filter: close the descriptor in case of error
When we hit an error writing to the next stream from a file, we jump to
'done' which currently skips over closing the file descriptor.

Make sure to close the descriptor if it has been set to a valid value.
2015-06-10 11:08:05 +02:00
Carlos Martín Nieto
969d4b703c object: correct the expected ID size in prefix lookup
We take in a possibly partial ID by taking a length and working off of
that to figure out whether to just look up the object or ask the
backends for a prefix lookup.

Unfortunately we've been checking the size against `GIT_OID_HEXSZ` which
is the size of a *string* containing a full ID, whereas we need to check
against the size we can have when it's a 20-byte array.

Change the checks and comment to use `GIT_OID_RAWSZ` which is the
correct size of a git_oid to have when full.
2015-06-10 10:59:56 +02:00
Carlos Martín Nieto
878293f7e1 pack: use git_buf when building the index name
The way we currently do it depends on the subtlety of strlen vs sizeof
and the fact that .pack is one longer than .idx. Let's use a git_buf so
we can express the manipulation we want much more clearly.
2015-06-10 10:44:14 +02:00
Carlos Martín Nieto
ca2857d81b merge: actually increment the counts, not the pointers
`merge_diff_list_count_candidates()` takes pointers to the source and
target counts, but when it comes time to increase them, we're increasing
the pointer, rather than the value it's pointing to.

Dereference the value to increase.
2015-06-10 10:30:08 +02:00
Carlos Martín Nieto
2d73075a41 cache: add a check for a failed allocation
Rather minimal change, but it's the kind of thing we should do.
2015-06-10 10:23:08 +02:00
Edward Thomson
a166466cd1 Merge pull request #3198 from libgit2/cmn/coverity
A few fixes from Coverity
2015-06-09 17:06:28 -04:00