Commit Graph

1970 Commits

Author SHA1 Message Date
Carlos Martín Nieto
69d1494873 Merge pull request #3511 from ethomson/racy_fixes_2
Racy fixes for writing new indexes
2015-11-17 13:21:18 -05:00
Edward Thomson
88638f9b18 tests: use out-of-the-way config dir in sandbox
Don't put the configuration in a subdir of the sandbox named
`config`, lest some tests decide to create their own directory
called `config`.  Prefix with some underscores for uniqueness.
2015-11-17 11:22:01 -05:00
Edward Thomson
fe96374823 tests: set PROGRAMDATA directory for running tests 2015-11-17 08:47:26 -05:00
Edward Thomson
6f7c411834 config::global: use PROGRAMDATA configuration
Query the `GIT_CONFIG_LEVEL_PROGRAMDATA` location when setting it up
for tests, in case the test runner has sandboxed it.
2015-11-17 08:46:21 -05:00
Edward Thomson
5f32c50683 racy: make git_index_read_index handle raciness
Ensure that `git_index_read_index` clears the uptodate bit on
files that it modifies.

Further, do not propagate the cache from an on-disk index into
another on-disk index.  Although this should not be done, as
`git_index_read_index` is used to bring an in-memory index into
another index (that may or may not be on-disk), ensure that we do
not accidentally bring in these bits when misused.
2015-11-16 22:59:02 -05:00
Edward Thomson
c30051f0d0 racy: ensure git_index_read_tree clears uptodate
Ensure that `git_index_read_tree` clears the uptodate bit on files
that it modifies.
2015-11-16 22:59:01 -05:00
Edward Thomson
956f4da897 index: test for smudged entries on write only
Test that entries are only smudged when we write the index: the
entry smudging is to prevent us from updating an index in a way
that it would be impossible to tell that an item was racy.
Consider when we load an index:  any entries that have the same
(or newer) timestamp than the index itself are considered racy,
and are subject to further scrutiny.

If we *save* that index with the same entries that we loaded,
then the index would now have a newer timestamp than the entries,
and they would no longer be given that additional scrutiny, failing
our racy detection!  So test that we smudge those entries only on
writing the new index, but that we can detect them (in diff) without
having to write.
2015-11-16 22:58:59 -05:00
Edward Thomson
de999f260f checkout::crlf test: don't crash when no idx entry
When there's no matching index entry (for whatever reason), don't
try to dereference the null return value to get at the id.

Otherwise when we break something in the index API, the checkout
test crashes for confusing reasons and causes us to step through
it in a debugger thinking that we had broken much more than we
actually did.
2015-11-16 22:58:59 -05:00
Edward Thomson
d1101263f7 index: don't detect raciness in uptodate entries
Keep track of entries that we believe are up-to-date, because we
added the index entries since the index was loaded.  This prevents
us from unnecessarily examining files that we wrote during the
cleanup of racy entries (when we smudge racily clean files that have
a timestamp newer than or equal to the index's timestamp when we
read it).  Without keeping track of this, we would examine every
file that we just checked out for raciness, since all their timestamps
would be newer than the index's timestamp.
2015-11-16 22:58:58 -05:00
Vicent Marti
7ff7ca623e pool: Never return unaligned buffers 2015-11-13 04:57:19 +01:00
Carlos Martín Nieto
75a0ccf52f Merge pull request #3170 from CmdrMoozy/nsec_fix
git_index_entry__init_from_stat: set nsec fields in entry stats
2015-11-12 19:53:09 +01:00
Carlos Martín Nieto
2c26c8679f Merge pull request #3499 from ethomson/ref_dir_errmsgs
Improve error messages when dirs prevent ref/reflog creation
2015-11-12 19:22:31 +01:00
Carlos Martín Nieto
ecdc04287a Merge pull request #3448 from libgit2/cmn/custom-agent
Support setting custom user-agent
2015-11-12 19:20:36 +01:00
Carlos Martín Nieto
de870533e0 settings: add a setter for a custom user-agent 2015-11-12 17:18:42 +01:00
Edward Thomson
0a700ee368 reflog: error when a directory is at reflog path
When a non-empty directory exists and prevents the creation of a
reflog, provide a more informative error message.
2015-11-12 09:39:29 -05:00
Edward Thomson
b46c7ee5e2 refs: complain when a directory exists at ref
When a (non-empty) directory exists at the reference target
location, complain with a more actionable error message.
2015-11-12 09:35:51 -05:00
nulltoken
1314af8d63 Failing test for case sensitive conflicts in the index 2015-11-12 12:11:45 +01:00
Carlos Martín Nieto
1c34b717e0 Merge pull request #3498 from ethomson/windows_symlinks
Diff: Honor `core.symlinks=false` and fake symlinks
2015-11-08 05:10:18 +01:00
Carlos Martín Nieto
619488948b Merge pull request #3500 from ethomson/submodules_with_path
Handle submodules with paths in `git_submodule_update`
2015-11-08 04:54:55 +01:00
Edward Thomson
790012ce78 submodule: test updating a submodule w/ a path
Test that `git_submodule_update` can handle a submodule that is
freshly cloned and has a path differing from its name.
2015-11-04 16:53:41 -05:00
Edward Thomson
5aa28a8f2d Merge pull request #3465 from libgit2/cmn/tls-register
stream: allow registering a user-provided TLS constructor
2015-11-04 14:16:24 -05:00
Stjepan Rajko
f5f96a23ee Fix git_commit_summary to convert newlines to spaces even after
whitespace.  Collapse spaces around newlines for the summary.
2015-11-03 17:50:55 -05:00
Edward Thomson
ec50b23acc filebuf: detect directories in our way
When creating a filebuf, detect a directory that exists in our
target file location.  This prevents a failure later, when we try
to move the lock file to the destination.
2015-11-03 17:16:51 -05:00
Edward Thomson
2d556f3166 reflog: test reflog is deleted when ref is deleted 2015-11-03 14:48:31 -05:00
Edward Thomson
6cc5023bfd index: test that add_bypath preserves symlinks
Test that on platforms without `core.symlinks`, we preserve symlinks
in `git_index_add_bypath`.  (Users should correct the actual index
entry's mode to change a link to a regular file.)
2015-11-03 12:07:03 -05:00
Edward Thomson
f20480ab0c diff: test "symlinks" in wd are respected on win32
When `core.symlinks = false`, we write the symlinks content (target)
to a regular file.  We should ensure that when we later see that
regular file, we treat it specially - and that changing that regular
file would actually change the symlink target.  (For compatibility
with Git for Windows).
2015-11-03 12:06:43 -05:00
Carlos Martín Nieto
3ce6cd4bdc Merge pull request #3494 from leoyanggit/fix_unit_test_build
Fix build for unit test
2015-11-03 08:13:41 -08:00
Carlos Martín Nieto
7fafde6325 stream: allow registering a user-provided TLS constructor
This allows the application to use their own TLS stream, regardless of
the capabilities of libgit2 itself.
2015-11-03 08:10:29 -08:00
Jason Haslam
3138ad9366 Add diff progress callback. 2015-11-02 16:33:58 -05:00
Leo Yang
505e4531b7 Fix build for unit test
If none of GIT_OPENSSL, GIT_WINHTTP or GIT_SECURE_TRANSPORT
is defined we should also be able to build the unit test.
2015-11-02 16:19:25 -05:00
Edward Thomson
db1edf91e9 Merge pull request #3491 from libgit2/cmn/config-checksum
Use checksums to detect config file changes
2015-11-02 15:09:19 -05:00
Vicent Marti
b656e5eb4f merge: Fix memory leak in test 2015-11-02 13:47:04 +01:00
Vicent Marti
85196232e8 Add test case 2015-11-02 13:47:04 +01:00
Carlos Martín Nieto
a2f96479ab config: add failing test for an external modification
We currently use the timestamp in order to decide whether a config file
has changed since we last read it.

This scheme falls down if the file is written twice within the same
second, as we fail to detect the file change after the first read in
that second.
2015-10-30 19:49:34 +01:00
Carlos Martín Nieto
fd74bd0842 Merge pull request #3486 from srajko/reflog-segfault-fix
Fix segfault when reading reflog with extra newlines
2015-10-29 20:37:48 +01:00
Stjepan Rajko
335c9e2f45 Prevent segfault when parsing a reflog with oid parse error
Using calloc instead of malloc because the parse error will lead to an immediate free of committer (and its properties, which can segfault on free if undefined - test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_returns_error segfaulted before the fix).

#3458
2015-10-29 11:15:37 -07:00
Vicent Marti
66eb7660a8 pool: Handle 32 bit systems 2015-10-28 10:29:00 +01:00
Vicent Marti
1e5e02b4f4 pool: Simplify implementation 2015-10-28 10:13:13 +01:00
Edward Thomson
8683d31f08 merge: add GIT_MERGE_TREE_FAIL_ON_CONFLICT
Provide a new merge option, GIT_MERGE_TREE_FAIL_ON_CONFLICT, which
will stop on the first conflict and fail the merge operation with
GIT_EMERGECONFLICT.
2015-10-22 14:55:17 -04:00
Carlos Martín Nieto
dc2cf3eb1a Merge pull request #3480 from ethomson/nsecs
Nanoseconds in the index: ignore for diffing
2015-10-22 18:35:43 +02:00
Edward Thomson
99a09f7f18 index: test that we round-trip nsecs
Test that nanoseconds are round-tripped correctly when we read
an index file that contains them.  We should, however, ignore them
because we don't understand them, and any new entries in the index
should contain a `0` nsecs field, while existing preserving entries.
2015-10-22 09:29:40 -04:00
Edward Thomson
44b1e3e390 Merge pull request #3475 from libgit2/cmn/programdata-config
config: add a ProgramData level
2015-10-21 13:43:22 -07:00
Carlos Martín Nieto
8c7c5fa585 config: add a ProgramData level
This is where portable git stores the global configuration which we can
use to adhere to it even though git isn't quite installed on the system.
2015-10-21 15:11:18 +02:00
Vicent Marti
bbe1957b8c tests: Fix warnings 2015-10-21 12:09:29 +02:00
Vicent Marti
307c4a2b6d signature: Strip crud just like Git does 2015-10-21 11:58:44 +02:00
Edward Thomson
4280fabb9f Merge pull request #3466 from libgit2/cmn/quick-parse-64
revwalk: make commit list use 64 bits for time
2015-10-15 07:10:48 -07:00
Carlos Martín Nieto
8321596a49 Merge pull request #3444 from ethomson/add_preserves_conflict_mode
Preserve modes from a conflict in `git_index_insert`
2015-10-15 12:22:10 +02:00
Vicent Marti
a0a1b19ab0 odb: Prioritize alternate backends
For most real use cases, repositories with alternates use them as main
object storage. Checking the alternate for objects before the main
repository should result in measurable speedups.

Because of this, we're changing the sorting algorithm to prioritize
alternates *in cases where two backends have the same priority*. This
means that the pack backend for the alternate will be checked before the
pack backend for the main repository *but* both of them will be checked
before any loose backends.
2015-10-14 20:53:01 +02:00
Carlos Martín Nieto
5ffdea6f65 revwalk: make commit list use 64 bits for time
We moved the "main" parsing to use 64 bits for the timestamp, but the
quick parsing for the revwalk did not. This means that for large
timestamps we fail to parse the time and thus the walk.

Move this parser to use 64 bits as well.
2015-10-14 16:54:13 +02:00
Edward Thomson
6c014bcc54 diff: don't feed large files to xdiff 2015-10-05 22:59:50 +02:00
Edward Thomson
e43520660c merge_file: treat large files as binary
xdiff craps the bed on large files.  Treat very large files as binary,
so that it doesn't even have to try.

Refactor our merge binary handling to better match git.git, which
looks for a NUL in the first 8000 bytes.
2015-10-05 22:59:46 +02:00
Axel Rasmussen
c7b17fb5cd Merge branch 'master' into nsec_fix_next 2015-10-01 18:01:32 -07:00
Arthur Schreiber
d3b29fb94b refdb and odb backends must provide free function
As refdb and odb backends can be allocated by client code, libgit2
can’t know whether an alternative memory allocator was used, and thus
should not try to call `git__free` on those objects.

Instead, odb and refdb backend implementations must always provide
their own `free` functions to ensure memory gets freed correctly.
2015-10-01 00:50:37 +02:00
Edward Thomson
21515f228b index: also try conflict mode when inserting
When we do not trust the on-disk mode, we use the mode of an existing
index entry.  This allows us to preserve executable bits on platforms
that do not honor them on the filesystem.

If there is no stage 0 index entry, also look at conflicts to attempt
to answer this question:  prefer the data from the 'ours' side, then
the 'theirs' side before falling back to the common ancestor.
2015-09-30 09:06:09 -04:00
Carlos Martín Nieto
72b7c57093 Merge pull request #3411 from spraints/custom-push-headers
Include custom HTTP headers
2015-09-30 09:17:18 +02:00
Edward Thomson
10df661b8c index: test that add_bypath preserves mode 2015-09-29 14:16:51 -04:00
Edward Thomson
ea467e7487 win32::longpath: don't print path 2015-09-28 16:46:09 -04:00
Edward Thomson
fc3ef147ec Merge pull request #3441 from libgit2/cmn/badssl
net: add tests against badssl.com
2015-09-28 06:41:00 -07:00
Carlos Martín Nieto
5c5df666b0 Plug some leaks 2015-09-27 23:32:20 +02:00
Carlos Martín Nieto
53a2870514 net: add tests against badssl.com
These provide bad X.509 certificates, which we should refuse to connect
to by default.
2015-09-27 22:56:25 +02:00
Guille -bisho-
e4b2b919bb Fix binary diffs
git expects an empty line after the binary data:

literal X
...binary data...
<empty_line>

The last literal block of the generated patches were not containing the required empty line. Example:

	diff --git a/binary_file b/binary_file
	index 3f1b3f9098131cfecea4a50ff8afab349ea66d22..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 6
	Nc${NM%g@i}0ssZ|0lokL
	diff --git a/binary_file2 b/binary_file2
	index 31be99be19470da4af5b28b21e27896a2f2f9ee2..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 13
	Sc${NMEKbZyOexL+Qd|HZV+4u-

git apply of that diff results in:

	error: corrupt binary patch at line 9: diff --git a/binary_file2 b/binary_file2
	fatal: patch with only garbage at line 10

The proper formating is:

	diff --git a/binary_file b/binary_file
	index 3f1b3f9098131cfecea4a50ff8afab349ea66d22..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 6
	Nc${NM%g@i}0ssZ|0lokL
	diff --git a/binary_file2 b/binary_file2
	index 31be99be19470da4af5b28b21e27896a2f2f9ee2..86e5c1008b5ce635d3e3fffa4434c5eccd8f00b6 100644
	GIT binary patch
	literal 8
	Pc${NM&PdElPvrst3ey5{

	literal 13
	Sc${NMEKbZyOexL+Qd|HZV+4u-
2015-09-25 10:37:41 -07:00
Edward Thomson
9768ebb1f3 win32: test checkout msg on long path err 2015-09-23 08:27:24 -04:00
Carlos Martín Nieto
aebddbe736 Merge pull request #3434 from ethomson/reservednames
Win32 Reserved names: don't reserve names outside the working directory
2015-09-21 06:01:03 +02:00
Axel Rasmussen
0226f7dd36 diff/index: respect USE_NSEC for racily clean file detection 2015-09-18 23:33:56 -07:00
Axel Rasmussen
e9e6df2c8f cmake: Only provide USE_NSEC if struct stat members are avilable.
This allows us to remove OS checks from source code, instead relying
on CMake to detect whether or not `struct stat` has the nanoseconds
members we rely on.
2015-09-18 23:33:56 -07:00
Axel Rasmussen
2be7855727 caps: add test for GIT_FEATURES_NSEC 2015-09-18 23:33:56 -07:00
Axel Rasmussen
e7de893ef8 cmake: add USE_NSEC, and only check nanosec m/ctime if enabled 2015-09-18 23:33:55 -07:00
Edward Thomson
e8ddd8d76c repo::reservedname: test a submodule update
Test an initial submodule update, where we are trying to checkout
the submodule for the first time, and placing a file within the
submodule working directory with the same name as the submodule
(and consequently, the same name as the repository itself).
2015-09-18 12:17:49 -04:00
Linquize
08313c4b12 config: test that comments are left as with git 2015-09-18 12:09:33 +02:00
Carlos Martín Nieto
dfe2856d0f Fix a couple of warnings 2015-09-18 12:06:55 +02:00
Edward Thomson
e24c60dba4 mkdir: find component paths for mkdir_relative
`git_futils_mkdir` does not blindly call `git_futils_mkdir_relative`.

`git_futils_mkdir_relative` is used when you have some base directory
and want to create some path inside of it, potentially removing blocking
symlinks and files in the process.  This is not suitable for a general
recursive mkdir within the filesystem.

Instead, when `mkdir` is being recursive, locate the first existent
parent directory and use that as the base for `mkdir_relative`.
2015-09-17 10:11:56 -04:00
Edward Thomson
0862ec2eb9 core::mkdir tests: ensure we don't stomp symlinks in mkdir
In `mkdir` and `mkdir_r`, ensure that we don't try to remove symlinks
that are in our way.
2015-09-17 10:11:38 -04:00
Edward Thomson
08df66301e core::mkdir tests: include absolute mkdirs 2015-09-17 10:00:35 -04:00
Edward Thomson
ac2fba0ecd git_futils_mkdir_*: make a relative-to-base mkdir
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
assumes that we own everything beneath the base, as if it were
being called with a base of the repository or working directory,
and is tailored towards checkout and ensuring that there is no
bogosity beneath the base that must be cleaned up.

This is (at best) slow and (at worst) unsafe in the larger context
of a filesystem where we do not own things and cannot do things like
unlink symlinks that are in our way.
2015-09-17 10:00:35 -04:00
Edward Thomson
eea7c85024 checkout: overwrite files with differing modes
When a file exists on disk and we're checking out a file that differs
in executableness, remove the old file.  This allows us to recreate the
new file with p_open, which will take the new mode into account and
handle setting the umask properly.

Remove any notion of chmod'ing existing files, since it is now handled
by the aforementioned removal and was incorrect, as it did not take
umask into account.
2015-09-16 10:33:59 -04:00
Edward Thomson
6fe322843b checkout::tree tests: don't use hardcoded mode 2015-09-16 10:33:53 -04:00
Edward Thomson
b4d183a77a checkout::tree tests: don't use static buffer 2015-09-16 04:12:47 +00:00
Matti Virolainen
33cad99589 Check that checkout preserves filemode in working directory. 2015-09-16 04:07:48 +00:00
Matti Virolainen
6124d983b6 Check that an executable in index is not an executable after checkout. 2015-09-16 04:07:43 +00:00
Edward Thomson
8452fecc8f cl_git_path_url: assert sane static buffer size 2015-09-14 14:05:01 -04:00
Edward Thomson
4cc355c97b clone::nonetwork: don't use fixed size buffer 2015-09-14 13:58:38 -04:00
Carlos Martín Nieto
b0885675f7 Merge pull request #3425 from ethomson/diriter_root
Handle `git_path_diriter` instances at the drive root on Windows
2015-09-13 23:21:14 +02:00
Edward Thomson
2cde210d47 diriter: test we can iterate root
Ensure that we can iterate the filesystem root and that paths come
back well-formed, not with an additional '/'.  (eg, when iterating
`c:/`, expect that we do not get some path like `c://autoexec.bat`).
2015-09-13 13:52:23 -04:00
Carlos Martín Nieto
f2b25261cf Merge pull request #3423 from libgit2/cmn/push-tests-inline-oid
push: put the git_oid inline in the test structure
2015-09-13 19:43:55 +02:00
Arthur Schreiber
548cb33434 Don't free config in git_transaction_commit.
The config is not owned by the transaction, so please don’t free it.
2015-09-13 16:32:24 +02:00
Carlos Martín Nieto
1e80bf27ea Merge branch 'cmn/ignore-dir-check' 2015-09-13 06:21:18 +02:00
Carlos Martín Nieto
657afd359e ignore: add test and adjust style and comment for dir with wildmatch
The previous commit left the comment referencing the earlier state of
the code, change it to explain the current logic. While here, change the
logic to avoid repeating the copy of the base pattern.
2015-09-13 06:18:49 +02:00
Carlos Martín Nieto
305407e1bb Merge pull request #3370 from libgit2/cmn/submodule-refactor
submodule: refactor to be more explicit in the search
2015-09-13 06:03:12 +02:00
Carlos Martín Nieto
1af5aecb96 push: put the git_oid inline in the test structure
These are small pieces of data, so there is no advantage to allocating
them separately. Include the two ids inline in the struct we use to
check that the expected and actual ids match.
2015-09-13 05:38:29 +02:00
Edward Thomson
92f7d32b59 diff::workdir: ensure ignored files are not returned
Ensure that a diff with the workdir is not erroneously returning
directories.
2015-09-12 13:46:22 -04:00
Carlos Martín Nieto
a3b9731ff8 submodule: add a test for a renamed submdoule dir 2015-09-10 21:23:03 +02:00
Matt Burke
3245896bb7 Add a test for custom header validation
Also, *some* custom headers actually are valid.
2015-09-10 13:18:26 -04:00
Edward Thomson
8e736a73ca futils: ensure we can write a hidden file 2015-09-08 15:56:50 -04:00
Edward Thomson
ea3f2c296a filebuf: ensure we can lock a hidden file 2015-09-08 15:56:35 -04:00
Matt Burke
4f2b6093a6 Tell the git_transport about the custom_headers 2015-09-08 14:02:33 -04:00
Carlos Martín Nieto
6d6020defc Merge pull request #3353 from ethomson/wrongcase_add
index: canonicalize directory case when adding
2015-09-08 18:34:51 +02:00
Edward Thomson
2964cbeae1 Merge pull request #3381 from leoyanggit/index_directory_iterator
New feature: add the ablility to iterate through a directory in index
2015-09-08 11:50:08 -04:00
Edward Thomson
a32bc85e84 git_index_add: allow case changing renames
On case insensitive platforms, allow `git_index_add` to provide a new
path for an existing index entry.  Previously, we would maintain the
case in an index entry without the ability to change it (except by
removing an entry and re-adding it.)

Higher-level functions (like `git_index_add_bypath` and
`git_index_add_frombuffers`) continue to keep the old path for easier
usage.
2015-09-08 11:34:00 -04:00
Edward Thomson
280adb3f94 index: canonicalize directory case when adding
On case insensitive systems, when given a user-provided path in the
higher-level index addition functions (eg `git_index_add_bypath` /
`git_index_add_frombuffer`), examine the index to try to match the
given path to an existing directory.

Various mechanisms can cause the on-disk representation of a folder
to not match the representation in HEAD or the index - for example,
a case changing rename of some file `a/file.txt` to `A/file.txt`
will update the paths in the index, but not rename the folder on
disk.

If a user subsequently adds `a/other.txt`, then this should be stored
in the index as `A/other.txt`.
2015-09-08 11:32:40 -04:00
Edward Thomson
e1d27bcaaf Merge pull request #3413 from libgit2/cmn/follow-symlink
filebuf: follow symlinks when creating a lock file
2015-09-06 10:51:29 -04:00
Edward Thomson
9fd4c9c867 Merge pull request #3366 from libgit2/cmn/index-hashmap
Use a hashmap for path-based lookups in the index
2015-09-06 10:50:22 -04:00
Carlos Martín Nieto
d83b2e9f51 filebuf: follow symlinks when creating a lock file
We create a lockfile to update files under GIT_DIR. Sometimes these
files are actually located elsewhere and a symlink takes their place. In
that case we should lock and update the file at its final location
rather than overwrite the symlink.
2015-09-05 16:43:49 +02:00
Leo Yang
c097f7173d New API: git_index_find_prefix
Find the first index entry matching a prefix.
2015-09-04 12:24:36 -04:00
Carlos Martín Nieto
21e7015ca3 Merge pull request #3402 from ethomson/faster_diff
Provide path matching in the iterators (for faster diffs)
2015-09-01 02:26:11 +02:00
Edward Thomson
03210cfa00 iterator test: handle case (in)sensitivity 2015-08-31 12:16:16 -04:00
Edward Thomson
4d19bced3f iterator test: use new iter opts in fifo test 2015-08-31 11:48:12 -04:00
Edward Thomson
d53c888069 iterator: saner pathlist matching for idx iterator
Some nicer refactoring for index iteration walks.

The index iterator doesn't binary search through the pathlist space,
since it lacks directory entries, and would have to binary search
each index entry and all its parents (eg, when presented with an index
entry of `foo/bar/file.c`, you would have to look in the pathlist for
`foo/bar/file.c`, `foo/bar` and `foo`).  Since the index entries and the
pathlist are both nicely sorted, we walk the index entries in lockstep
with the pathlist like we do for other iteration/diff/merge walks.
2015-08-31 11:48:06 -04:00
Edward Thomson
71ef639e5f status test: brackets are now literal 2015-08-30 18:57:06 -04:00
Edward Thomson
1af84271dd tree_iterator: use a pathlist 2015-08-30 18:55:18 -04:00
Edward Thomson
4a0dbeb0d3 diff: use new iterator pathlist handling
When using literal pathspecs in diff with `GIT_DIFF_DISABLE_PATHSPEC_MATCH`
turn on the faster iterator pathlist handling.

Updates iterator pathspecs to include directory prefixes (eg, `foo/`)
for compatibility with `GIT_DIFF_DISABLE_PATHSPEC_MATCH`.
2015-08-30 17:06:26 -04:00
Edward Thomson
3273ab3f0b diff: better document GIT_DIFF_PATHSPEC_DISABLE
Document that `GIT_DIFF_PATHSPEC_DISABLE` is not necessarily about
explicit path matching, but also includes matching of directory
names.  Enforce this in a test.
2015-08-28 20:45:08 -04:00
Edward Thomson
aa06ecaf5b Merge pull request #3352 from ethomson/hidden
win32: ensure hidden files can be staged
2015-08-28 19:30:08 -04:00
Edward Thomson
6c9352bf30 iterator: sort subdirs properly with pathlist
When given a pathlist, don't assume that directories sort before
files.  Walk through any list of entries sorting before us to make
sure that we've exhausted all entries that *aren't* directories.

Eg, if we're searching for 'foo/bar', and we have a 'foo.c', keep
advancing the pathlist to keep looking for an entry prefixed with
'foo/'.
2015-08-28 18:40:02 -04:00
Edward Thomson
ef206124de Move filelist into the iterator handling itself. 2015-08-28 18:39:52 -04:00
Edward Thomson
ed1c64464a iterator: use an options struct instead of args 2015-08-28 18:39:47 -04:00
Carlos Martín Nieto
e451cd5c03 diff: don't error out on an invalid regex
When parsing user-provided regex patterns for functions, we must not
fail to provide a diff just because a pattern is not well
formed. Ignore it instead.
2015-08-15 18:46:38 +02:00
Carlos Martín Nieto
c232d6c32d index: add tests around case switching
We were missing tests for switching the case-sensitivity of an index
in-memory and then looking up entries in it.
2015-08-14 21:06:51 +02:00
Edward Thomson
9f1af7f279 Merge pull request #3168 from libgit2/cmn/config-tx
Locking and transactional/atomic updates for config
2015-08-13 10:22:50 -07:00
Carlos Martín Nieto
5340d63d38 config: perform unlocking via git_transaction
This makes the API for commiting or discarding changes the same as for
references.
2015-08-12 04:09:38 +02:00
Carlos Martín Nieto
36f784b538 config: expose locking via the main API
This lock/unlock pair allows for the cller to lock a configuration file
to avoid concurrent operations.

It also allows for a transactional approach to updating a configuration
file. If multiple updates must be made atomically, they can be done
while the config is locked.
2015-08-12 04:09:38 +02:00
Carlos Martín Nieto
b166703964 config: implement basic transactional support
When a configuration file is locked, any updates made to it will be done
to the in-memory copy of the file. This allows for multiple updates to
happen while we hold the lock, preventing races during complex
config-file manipulation.
2015-08-12 04:09:09 +02:00
Carlos Martín Nieto
a879276783 remote: add failing test for a mirror refspec
While we download the remote's remote-tracking branches, we don't
download the tag. This points to the tag auto-follow rules interfering
with the refspec.
2015-08-11 20:44:19 +02:00
Edward Thomson
ef4857c2b3 errors: tighten up git_error_state OOMs a bit more
When an error state is an OOM, make sure that we treat is specially
and do not try to free it.
2015-08-03 19:44:51 -04:00
Edward Thomson
bdec336301 win32: ensure hidden files can be staged 2015-08-03 18:33:15 -05:00
Michael Procter
988ea59443 Test: check restored oom error points to static buffer 2015-08-03 15:23:17 +01:00
Michael Procter
5ef4b86015 Add failing test for capture/restore oom error 2015-08-03 15:23:17 +01:00
Edward Thomson
69adb781e1 Merge pull request #3325 from libgit2/cmn/filebuf-rename-error
filebuf: remove lockfile upon rename errors
2015-08-03 08:33:53 -05:00
Carlos Martín Nieto
b426ac90a9 index: test that an unregistered submodule gets staged
When we pass the path of a repository to `_bypath()`, we should behave
like git and stage it as a `_COMMIT` regardless of whether it is
registered a a submodule.
2015-08-01 19:52:25 +02:00
Linquize
63e5b55122 index: add test for adding an old-style submodule to index 2015-08-01 19:35:59 +02:00
Edward Thomson
9d4b7d2524 Merge pull request #3328 from libgit2/cmn/iterator-skip-diriter
iterator: skip over errors in diriter init
2015-07-29 16:46:47 -05:00
Carlos Martín Nieto
0e391d8526 iterator: adjust unreadable-dir test to new behaviour
We don't want the iterator to make us stop whenever we hit an unreadable
dir. We should instead move over to the next item.
2015-07-27 13:31:06 +02:00
Carlos Martín Nieto
19d9beb7ff filebuf: remove lockfile upon rename errors
When we have an error renaming the lockfile, we need to make sure
that we remove it upon cleanup. For this, we need to keep track of
whether we opened the file and whether the rename succeeded.

If we did create the lockfile but the rename did not succeed, we
remove the lockfile. This won't protect against all errors, but
the most common ones (target file is open) does get handled.
2015-07-24 23:02:11 +02:00
Carlos Martín Nieto
668053befe filebuf: failing test for leaving the lockfile when failing to rename
When we fail to rename, we currently leave the lockfile laying
around. This shows that behaviour.
2015-07-24 22:55:43 +02:00
Edward Thomson
2dfd5eae33 Merge pull request #3307 from libgit2/cmn/submodule-backslash
Normalize submodule urls before looking at them
2015-07-24 15:05:16 -05:00
Edward Thomson
759b2230a5 Merge pull request #3303 from libgit2/cmn/index-add-submodule
Allow adding a submodule through git_index_add_bypath
2015-07-24 15:04:20 -05:00
Edward Thomson
91dad18143 Merge pull request #3305 from libgit2/cmn/reflog-del-backend
refdb: delete a ref's reflog upon deletion
2015-07-24 15:01:04 -05:00
Carlos Martín Nieto
ceb5873913 Merge pull request #3302 from libgit2/cmn/submodule-foreach-diff-path
List a submodule only once when the path matches a submodule in the index
2015-07-13 18:50:39 +02:00
Carlos Martín Nieto
aa51fa1e03 submodule: add failing test for backslash in url 2015-07-13 08:39:35 +02:00
Carlos Martín Nieto
f861abadfe Merge branch 'portable-zu' 2015-07-12 19:56:19 +02:00
Matthew Plough
768f8be31c Fix #3094 - improve use of portable size_t/ssize_t format specifiers.
The header src/cc-compat.h defines portable format specifiers PRIuZ, PRIdZ, and PRIxZ. The original report highlighted the need to use these specifiers in examples/network/fetch.c.  For this commit, I checked all C source and header files not in deps/ and transitioned to the appropriate format specifier where appropriate.
2015-07-12 19:55:19 +02:00
Carlos Martín Nieto
01d0c02dba refdb: delete a ref's reflog upon deletion
Removing a reflog upon ref deletion is something which only some
backends might wish to do. Backends which are database-backed may wish
to archive a reflog, log-based ones may not need to do anything.
2015-07-12 19:08:06 +02:00
Carlos Martín Nieto
247d27c2c6 index: allow add_bypath to update submodules
Similarly to how git itself does it, allow the index update operation to
stage a change in a submodule's HEAD.
2015-07-12 12:11:22 +02:00
Carlos Martín Nieto
0d98af0911 blob: fail to create a blob from a dir with EDIRECTORY
This also affects `git_index_add_bypath()` by providing a better error
message and a specific error code when a directory is passed.
2015-07-12 12:11:22 +02:00
Carlos Martín Nieto
a34c4f8dce submdule: reproduce double-reporting of a submodule in foreach
When we rename a submodule, we should be merging two sets of information
based on whether their path is the same. We currently only deduplicate
on equal name, which causes us to double-report.
2015-07-11 13:32:57 +02:00
Edward Thomson
9a99ca7b21 wildcard filters: move CHANGELOG message to 0.23+1 2015-07-10 09:53:30 -05:00
Edward Thomson
bae467aec4 wildcard filters: clean up some warnings in tests 2015-07-10 09:53:29 -05:00
Carlos Martín Nieto
9847d80ddc Merge pull request #3281 from ethomson/wildcard_filters
filters: custom filters with wildcard attributes
2015-07-09 18:21:31 +02:00
Edward Thomson
43ce8cb52e revert: correct test that added trailing newline 2015-07-07 17:01:49 -05:00
Edward Thomson
ae8f7260ec merge_files: don't add trailing newlines
When invoked with three files that each lack a trailing newline,
the merge result should also lack a trailing newline.
2015-07-07 17:01:48 -05:00
Carlos Martín Nieto
3704ac35d3 Merge pull request #3277 from git-up/git_diff_index_to_index
Added git_diff_index_to_index()
2015-07-07 12:38:47 +02:00
Carlos Martín Nieto
ea445e0602 Merge pull request #3288 from ethomson/getenv
git__getenv: utf-8 aware env reader
2015-07-07 00:48:17 +02:00
Carlos Martín Nieto
3c831113ca Merge pull request #3202 from jeffhostetler/windows_stack_trace
Stacktraces with CRTDBG memory leaks on Windows
2015-07-06 19:04:48 +02:00
Edward Thomson
e069c621bd git__getenv: utf-8 aware env reader
Introduce `git__getenv` which is a UTF-8 aware `getenv` everywhere.
Make `cl_getenv` use this to keep consistent memory handling around
return values (free everywhere, as opposed to only some platforms).
2015-07-02 16:35:43 +00:00
Carlos Martín Nieto
f034c8518e Merge pull request #3287 from ethomson/filter_test_cleanup
filter::stream: free the filter sanely
2015-07-02 17:55:16 +02:00
Edward Thomson
79306d8d59 filter::stream: free the filter sanely
Don't use the filter's free callback to free the actual data structure
holding the filter, as we may not always actually initialize it (the
test may be skipped).
2015-07-02 10:21:48 -05:00
Carlos Martín Nieto
e8e848a8da submodule: add failing test for loading the wrong submodule
When two submodules are fairly similar, we may end up loading the wrong
one.
2015-07-01 21:14:55 +02:00
Carlos Martín Nieto
34065968ed submodule: completely remove reload_all
The function was removed, but its declaration and changelog entry about
its removal were forgotten.

The comment in the test doesn't make any sense as the function doesn't
exist anymore, so get rid of it as well.
2015-07-01 17:49:07 +02:00
Edward Thomson
63924435a1 filters: custom filters with wildcard attributes
Allow custom filters with wildcard attributes, so that clients
can support some random `filter=foo` in a .gitattributes and look
up the corresponding smudge/clean commands in the configuration file.
2015-07-01 09:40:11 -05:00
Pierre-Olivier Latour
ccef5adb63 Added git_diff_index_to_index() 2015-06-30 10:03:32 -07:00
Edward Thomson
eb29292aed index tests: add eol to avoid compiler warning 2015-06-30 14:31:07 +00:00
Edward Thomson
504b069701 checkout test: mark unused vars 2015-06-30 14:31:07 +00:00
Carlos Martín Nieto
7bfdd1c2d2 Merge pull request #3270 from ethomson/warnings2
Remove some warnings
2015-06-30 10:21:06 +02:00
Edward Thomson
64c415c2ae checkout test: check getcwd return value 2015-06-29 22:34:00 +00:00
Edward Thomson
eadf37151b clar: test chdir 2015-06-29 22:13:40 +00:00
Edward Thomson
d88abb8949 filter test: pass base type 2015-06-29 22:13:40 +00:00
Edward Thomson
0175971e91 stash: const up conflict params 2015-06-29 21:23:09 +00:00
Edward Thomson
2cf33fee89 index test: include repository.h for decl 2015-06-29 21:23:09 +00:00
Jeff Hostetler
93b4272895 Include stacktrace summary in memory leak output. 2015-06-29 16:39:11 -04:00
Carlos Martín Nieto
c28a5c972d submodule: remove trailing slashes from submodule paths
We allow looking up a submodule by path, but we lost the path
normalisation during the recent changes. Bring it back.
2015-06-29 21:10:47 +02:00
Carlos Martín Nieto
fa399750c6 Merge pull request #3265 from libgit2/leaks
Plug a bunch of leaks
2015-06-27 21:26:27 +02:00
Carlos Martín Nieto
92ec9ed328 Merge pull request #3260 from ethomson/apply_with_reflog_indices
stash: test we apply using reflog-like indices
2015-06-27 21:15:00 +02:00
Carlos Martín Nieto
24fa21f38e index, iterator, fetchhead: plug leaks 2015-06-26 19:00:33 +02:00
Carlos Martín Nieto
afd8a94ee7 checkout: plug a few leaks 2015-06-26 18:49:39 +02:00
Carlos Martín Nieto
9568660f62 diff: fix leaks in diff printing 2015-06-26 18:31:39 +02:00
Carlos Martín Nieto
cfafeb843d Merge pull request #3263 from git-up/fixes
Fixes
2015-06-26 18:11:05 +02:00
Edward Thomson
ee6eed5188 stash: test we apply using reflog-like indices 2015-06-26 11:48:48 -04:00
Carlos Martín Nieto
354268ca48 Merge pull request #3259 from ethomson/stash_apply_argh
Stash apply: stage new files even when not updating the index
2015-06-26 17:46:35 +02:00
Pierre-Olivier Latour
492851c9a2 Removed unused variables 2015-06-26 08:18:06 -07:00
Vicent Marti
13e5e344a6 test-diff-blob: Pass proper nibble sizes 2015-06-26 16:52:26 +02:00
Vicent Marti
a2f8d1ae2b revparse: Add test to make sure this doesn't regress 2015-06-26 16:48:58 +02:00
Edward Thomson
619423f238 diff: test we don't update index unnecessarily
Test that workdir diffs, when presented with UPDATE_INDEX, only
write the index when they actually make a change.
2015-06-26 02:00:20 -04:00
Edward Thomson
c0280bdd15 Merge pull request #3255 from libgit2/cmn/rename-unspecified
Rename FALLBACK to UNSPECIFIED
2015-06-25 18:55:48 -04:00
Edward Thomson
b7f5cb8dd7 stash: stage new files when unstashing them
Files that were new (staged additions) in the stash tree should
be staged when unstashing, even when not applying the index.
2015-06-25 18:34:38 -04:00
Edward Thomson
82b1c93d08 stash: don't allow apply with staged changes 2015-06-25 18:34:36 -04:00
Edward Thomson
1db6a0ab52 stash apply: add a newly staged file to tests 2015-06-25 18:33:56 -04:00
Edward Thomson
3b66c6a397 Merge pull request #3256 from libgit2/cmn/fetch-spec-fetchhead
remote: insert refspecs with no rhs in FETCH_HEAD
2015-06-25 15:36:53 -04:00
Edward Thomson
87987fd1e0 Merge pull request #3246 from libgit2/cmn/dont-grow-borrowed
Don't allow growing borrowed buffers
2015-06-25 15:26:43 -04:00
Carlos Martín Nieto
23aa7c9037 remote: insert refspecs with no rhs in FETCH_HEAD
When a refspec contains no rhs and thus won't cause an explicit update,
we skip all the logic, but that means that we don't update FETCH_HEAD
with it, which is what the implicit rhs is.

Add another bit of logic which puts those remote heads in the list of
updates so we put them into FETCH_HEAD.
2015-06-25 13:40:38 +02:00
Carlos Martín Nieto
c2418f4613 Rename FALLBACK to UNSPECIFIED
Fallback describes the mechanism, while unspecified explains what the
user is thinking.
2015-06-25 12:48:44 +02:00
Carlos Martín Nieto
a65992355d buffer: make use of EINVALID for growing a borrowed buffer
This explains more closely what happens. While here, set an error
message.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
caab22c0d4 buffer: don't allow growing borrowed buffers
When we don't own a buffer (asize=0) we currently allow the usage of
grow to copy the memory into a buffer we do own. This muddles the
meaning of grow, and lets us be a bit cavalier with ownership semantics.

Don't allow this any more. Usage of grow should be restricted to buffers
which we know own their own memory. If unsure, we must not attempt to
modify it.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
daacf96d10 Merge pull request #3097 from libgit2/cmn/submodule-config-state
Remove run-time configuration settings from submodules
2015-06-24 23:34:40 +02:00
Carlos Martín Nieto
9d5efab89f Merge pull request #3254 from ethomson/diff-binary-patch
Handle binary DIFFABLEness properly
2015-06-24 21:13:23 +02:00
Carlos Martín Nieto
c2f274c69e Merge pull request #3250 from ethomson/stash
Stash workdir correctly when added in the index, modified in the workdir
2015-06-24 19:47:34 +02:00
Edward Thomson
ba8fb7c46a diff::binary tests: empty diff when forced binary
Ensure that even when we're forcing a binary diff that we do not
assume that there *is* a diff.  There should be an empty diff for
no change.
2015-06-24 11:39:59 -04:00
Carlos Martín Nieto
76633215d1 binary diff: test that the diff and patch otputs are the same
We test the generation of the textual patch via the patch function,
which are just one of two possibilities to get the output.

Add a second patch generation via the diff function to make sure both
outputs are in sync.
2015-06-24 14:33:02 +02:00
Pierre-Olivier Latour
8113056c7a Fixed Xcode 6.1 build warnings 2015-06-23 20:57:09 -07:00
Edward Thomson
cc605e73ac Merge pull request #3222 from git-up/conflicted
Fixed GIT_DELTA_CONFLICTED not returned in some cases
2015-06-23 23:52:03 -04:00
Edward Thomson
bd670abd23 Merge pull request #3226 from libgit2/cmn/racy-diff-again
racy-git, the missing link
2015-06-23 23:30:58 -04:00
Edward Thomson
14304b0e87 stash tests: ensure we save the workdir file
Ensure that when a file is added in the index and subsequently
modified in the working directory, the stashed working directory
tree contains the actual working directory contents.
2015-06-23 18:17:24 -04:00
Carlos Martín Nieto
16c73d3804 repository: check the format version
This is something we do on re-init but not when opening a
repository. This hasn't particularly mattered up to now as the version
has been 0 ever since the first release of git, but the times, they're
a-changing and we will soon see version 1 in the wild. We need to make
sure we don't open those.
2015-06-23 20:44:27 +02:00
Pierre-Olivier Latour
8d8a2eefef Fixed GIT_DELTA_CONFLICTED not returned in some cases
If an index entry for a file that is not in HEAD is in conflicted state,
when diffing HEAD with the index, the status field of the corresponding git_diff_delta was incorrectly reported as GIT_DELTA_ADDED instead of GIT_DELTA_CONFLICTED.

This was due to handle_unmatched_new_item() initially setting the status
to GIT_DELTA_CONFLICTED but then overriding it later with GIT_DELTA_ADDED.
2015-06-23 07:48:26 -07:00
Pierre-Olivier Latour
cb63e7e897 Explicitly handle GIT_DELTA_CONFLICTED in git_diff_merge()
This fixes a bug where if a file was in conflicted state in either diff,
it would not always remain in conflicted state in the merged diff.
2015-06-22 21:37:41 -07:00
Edward Thomson
1e46d54584 crlf tests: ensure that Unix obeys autocrlf=true
All platforms do terrible, horrible, no good, very bad translation
when core.autocrlf=true.  It's not just Windows!
2015-06-22 12:00:26 -04:00
Edward Thomson
8293c8f9a3 git_buf_text_lf_to_crlf: allow mixed line endings
Allow files to have mixed line endings instead of skipping processing
on them.
2015-06-22 12:00:23 -04:00
Edward Thomson
71686ddca6 clar: support hierarchical test resource data
Support hierarchical test resource data, such that you can have
`tests/resources/foo/bar` and move the `bar` directory in as
a fixture.

Calling `cl_fixture_sandbox` on a path that is not directly beneath
the test resources directory succeeds, placing that directory into
the test fixture.  (For example, `cl_fixture_sandbox("foo/bar")`
will sandbox the `foo/bar` directory as `bar`).

Add support for cleaning up directories created this way, by only
cleaning up the basename (in this example, `bar`) from the fixture
directory.
2015-06-22 12:00:15 -04:00
Edward Thomson
e774fa6c0b crlf tests: posix known-good data
A corpus of files checked out with Git (Linux, 1.9.1) to ensure that
produce identical data when checking out using a CRLF filter.
2015-06-22 12:00:11 -04:00
Edward Thomson
4ebe320a31 crlf tests: windows known-good data
A corpus of files checked out with Git for Windows (2.4.1.windows.1)
to ensure that we produce identical data when checking out using a
CRLF filter.
2015-06-22 12:00:06 -04:00
Edward Thomson
3d92b9abaa crlf tests: use known-good data produced by git
Given a variety of combinations of core.autocrlf settings and
attributes settings, test that we check out data into the working
directory the same as a known-good test resource created by git.git.
2015-06-22 12:00:02 -04:00
Edward Thomson
bf8c0a9b91 crlf: script to generate expected crlf data
Include a shell script that will generate the expected CRLF data,
calling git.git to capture its output as a test resource for the
current platform.
2015-06-22 11:59:58 -04:00
Edward Thomson
bd5e59ee72 crlf: include utf8 resources in master branch
Include the UTF8 and UTF8 BOM tests in the master crlf test
branch for completeness.
2015-06-22 11:59:54 -04:00
Edward Thomson
84f8f50046 crlf: include additional test resources
Include additional test data for CRLF tests: files with mixed
line endings and binary files.
2015-06-22 11:59:50 -04:00
Carlos Martín Nieto
0496330004 submodule: test unsetting config options
In addition to mapping enums to strings in the configuration, we need to
know to delete the configuration option when given the "none" or "no"
option.
2015-06-22 17:02:56 +02:00
Carlos Martín Nieto
4536574acc submodule: test more accurately for non-existence
The current code will always fail, but only because it's asking for a
string on a live config. Take a snapshot and make sure we fail with
ENOTFOUND instead of any old error.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
adb58f7d64 submodule: fix potential leak in the tests 2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
961861fafa submodule: get rid of _save()
We no longer have any setters which affect an instance, so
`git_submodule_save()` is no longer relevant.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
d6073b30f3 submodule: make _set_url() affect the configuration
With this one, we can get rid of the edit_and_save test.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
486ba4cdd3 submodule: make _set_branch() affect the configuration 2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
4e63642321 submodule: make _set_update_fetch_recurse_submodules() affect the config
Similarly to the other ones. In this test we copy over testing
`RECURSE_YES` which shows an error in our handling of the `YES` variant
which we may have to port to the rest.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
e8a39f8ed1 submodule: make _set_update() affect the configuration
Moving on with the removal of runtime-changing variables, the update
setting for a remote is whatever it was when it was looked up.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
c6f489c964 submodule: add an ignore option to status
This lets us specify in the status call which ignore rules we want to
use (optionally falling back to whatever the submodule has in its
configuration).

This removes one of the reasons for having `_set_ignore()` set the value
in-memory. We re-use the `IGNORE_RESET` value for this as it is no
longer relevant but has a similar purpose to `IGNORE_FALLBACK`.

Similarly, we remove `IGNORE_DEFAULT` which does not have use outside of
initializers and move that to fall back to the configuration as well.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
64bbd47a32 submodule: don't let status change an existing instance
As submodules are becomes more like values, we should not let a status
check to update its properties. Instead of taking a submodule, have
status take a repo and submodule name.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
5a9fc6c83c submodule: make set_ignore() affect the configuration
Instead of affecting a particular instance, make it change the
configuration.
2015-06-22 17:02:55 +02:00
Carlos Martín Nieto
dfda2f68ea submodule: remove the per-repo cache
Having this cache and giving them out goes against our multithreading
guarantees and it makes it impossible to use submodules in a
multi-threaded environment, as any thread can ask for a refresh which
may reallocate some string in the submodule struct which we've accessed
in a different one via a getter.

This makes the submodules behave more like remotes, where each object is
created upon request and not shared except explicitly by the user. This
means that some tests won't pass yet, as they assume they can affect the
submodule objects in the cache and that will affect later operations.
2015-06-22 17:02:54 +02:00
Carlos Martín Nieto
6e611f7c3c index: add a diff test for smudging a file which becomes empty
Even though the file is empty and thus the size in the entry matches, we
should be able to detect it as a difference.
2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
27133caf3c tests: move racy tests to the index
They fit there much better, even though we often check by diffing, it's
about the behaviour of the index.
2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
5b05f95424 merge: work around write-side racy protection when hacking the index
As we attempt to replicate a situation in which an older checkout has
put a file on disk with different filtering settings from us, set the
timestamp on the entry and file to a second before we're performing the
operation so the entry in the index counts as old.

This way we can test that we're not looking at the on-disk file when the
index has the entry and we detect it as clean.
2015-06-22 16:11:58 +02:00
Carlos Martín Nieto
a3f42fe8e4 commit: allow retrieving an arbitrary header field
This allows the user to look up fields which we don't parse in libgit2,
and allows them to access gpgsig or mergetag fields if they wish to
check the signature.
2015-06-22 15:56:31 +02:00
Carlos Martín Nieto
26432a9c62 tests: set racy times manually 2015-06-22 12:47:30 +02:00
Carlos Martín Nieto
6c5eaead49 tests: plug leaks in the racy test 2015-06-22 12:47:30 +02:00
Carlos Martín Nieto
ff47537557 diff: check files with the same or newer timestamps
When a file on the workdir has the same or a newer timestamp than the
index, we need to perform a full check of the contents, as the update of
the file may have happened just after we wrote the index.

The iterator changes are such that we can reach inside the workdir
iterator from the diff, though it may be better to have an accessor
instead of moving these structs into the header.
2015-06-22 12:47:30 +02:00
Edward Thomson
fc6568021c status: test that symlinks don't lose their mode
Test to ensure that when status updates an index, it does not alter
the original mode for file types that are not supported (eg, symlinks
on Windows).
2015-06-20 15:37:32 -04:00
Edward Thomson
9018529b4e Merge pull request #3238 from git-up/double_free
Fixed index being double-freed in stash tests
2015-06-20 14:34:34 -04:00
Edward Thomson
883cb642cb Merge pull request #3236 from libgit2/cmn/index-checksum
Use the checksum to check whether an index has been modified
2015-06-20 14:05:02 -04:00
Pierre-Olivier Latour
07ea3a7f57 Fixed index being double-freed in stash tests 2015-06-20 10:57:03 -07:00
Carlos Martín Nieto
863dd89abf tests: tick over five seconds instead of one
When ticking over one second, it can happen that the actual time ticks
over the same second between the time that we undermine our own race
protections and the time in which we perform the index update. Such
timing would make the time in the entries match the index' timestamp and
we have not gained anything.

Ticking over five seconds makes it so that if real-time rolls over that
second, our index is still ahead. This is still suboptimal as we're
dealing with timing, but five seconds should be long enough for any
reasonable test runner to finish the tests.
2015-06-20 10:46:10 +02:00
Carlos Martín Nieto
46c84c7260 index: user a better assertion when comparing sizes
This will tell us which numbers we were trying to compare, rather than
just telling us that they're different.
2015-06-19 21:56:42 +02:00
Pierre-Olivier Latour
85a5e8ebe1 Fixed Xcode 6.1 build warnings 2015-06-17 09:00:23 -07:00
Jeff Hostetler
534d136da3 Fix memory leak in tests/network/refspecs.c 2015-06-17 08:52:28 -04:00
Carlos Martín Nieto
a56db99234 Merge pull request #3219 from libgit2/cmn/racy-diff
Zero out racily-clean entries' file_size
2015-06-17 08:15:49 +02:00
Edward Thomson
fef5344c50 merge::workdir::dirty: tick idx to defeat racy-git 2015-06-16 16:39:13 -04:00
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
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
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
Pierre-Olivier Latour
0f4d9c0367 Fixed Xcode 6.1 build warnings 2015-06-15 09:55:12 -07: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
Jeff Hostetler
26d5c0b823 Fix leaks in tests/checkout/icase 2015-06-12 09:28:47 -07: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
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
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
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
82a7a24cf4 Merge pull request #3165 from ethomson/downcase
Downcase
2015-06-08 15:22:01 +02:00
Carlos Martín Nieto
b6011e296e Merge pull request #3185 from libgit2/cmn/foreach-cancel-loose
path: error out if the callback returns an error
2015-06-07 15:10:28 +02:00
Carlos Martín Nieto
8da4404705 path: error out if the callback returns an error
When the callback returns an error, we should stop immediately. This
broke when trying to make sure we pass specific errors up the chain.

This broke cancelling out of the loose backend's foreach.
2015-06-06 03:55:28 +02:00
Pierre-Olivier Latour
9f3c18e2ac Fixed build warnings on Xcode 6.1 2015-06-02 11:49:38 -07:00
Patrick Steinhardt
9e88a823f6 remote: test insteadOf for anonymous remotes 2015-05-31 13:26:05 +02:00
Patrick Steinhardt
ec0c4c4001 remote: apply insteadOf configuration.
A remote's URLs are now modified according to the url.*.insteadOf
and url.*.pushInsteadOf configurations. This allows a user to
replace URL prefixes by setting the corresponding keys. E.g.
"url.foo.insteadOf = bar" would replace the prefix "bar" with the
new prefix "foo".
2015-05-31 13:21:53 +02:00
Edward Thomson
bad33a5dfb git__tolower: test that some non-ASCII downcasing isn't 2015-05-29 18:16:51 -04:00
Edward Thomson
006548da91 git__strcasecmp: treat input bytes as unsigned
Treat input bytes as unsigned before doing arithmetic on them,
lest we look at some non-ASCII byte (like a UTF-8 character) as a
negative value and perform the comparison incorrectly.
2015-05-29 16:07:51 -04:00
Carlos Martín Nieto
2c8550f040 Merge pull request #3157 from mgorny/ssh_memory_auth
Support getting SSH keys from memory, pt. 2
2015-05-29 19:38:11 +02:00
Edward Thomson
885b94aac0 Rename GIT_EMERGECONFLICT to GIT_ECONFLICT
We do not error on "merge conflicts"; on the contrary, merge conflicts
are a normal part of merging.  We only error on "checkout conflicts",
where a change exists in the index or the working directory that would
otherwise be overwritten by performing the checkout.

This *may* happen during merge (after the production of the new index
that we're going to checkout) but it could happen during any checkout.
2015-05-29 09:55:09 -04:00
Carlos Martín Nieto
ff8d635adb Merge pull request #3139 from ethomson/diff_conflicts
Include conflicts when diffing
2015-05-28 18:45:57 +02:00
Edward Thomson
fb92b48d54 Merge pull request #3149 from libgit2/cmn/upstream-matching-push
Fill the pointers for matching refspecs
2015-05-28 10:13:07 -04:00
Carlos Martín Nieto
2b92283221 Merge pull request #3127 from libgit2/cmn/remote-fixups
Tackle remote API issues from bindings
2015-05-28 16:09:17 +02:00
Edward Thomson
666ae18821 git_index_add_all: test that conflicts are handled
When confronted with a conflict in the index, `git_index_add_all`
should stage the working directory copy.  If there is no file in the
working directory, the conflict should simply be removed.
2015-05-28 09:47:43 -04:00
Edward Thomson
1c4b5cee00 Introduce cl_git_sandbox_init_new()
cl_git_sandbox_init_new() will create a clar temp directory and
initialize a new repository at that location.
2015-05-28 09:47:39 -04:00
Edward Thomson
9f545b9d71 introduce git_index_entry_is_conflict
It's not always obvious the mapping between stage level and
conflict-ness.  More importantly, this can lead otherwise sane
people to write constructs like `if (!git_index_entry_stage(entry))`,
which (while technically correct) is unreadable.

Provide a nice method to help avoid such messy thinking.
2015-05-28 09:47:31 -04:00
Edward Thomson
2f1080ea04 conflict tests: use GIT_IDXENTRY_STAGE_SET 2015-05-28 09:44:22 -04:00
Edward Thomson
191e97a02b diff conflicts: don't include incorrect ID
Since a diff entry only concerns a single entry, zero the information
for the index side of a conflict.  (The index entry would otherwise
erroneously include the lowest-stage index entry - generally the
ancestor of a conflict.)

Test that during status, the index side of the conflict is empty.
2015-05-28 09:44:18 -04:00
Edward Thomson
b22369efa2 diff conflicts: test index to workdir w/ conflicts 2015-05-28 09:44:14 -04:00
Edward Thomson
bb815157da diff conflicts: add tests for tree to index 2015-05-28 09:44:10 -04:00
Edward Thomson
7c94801400 diff/status: introduce conflicts
When diffing against an index, return a new `GIT_DELTA_CONFLICTED`
delta type for items that are conflicted.  For a single file path,
only one delta will be produced (despite the fact that there are
multiple entries in the index).

Index iterators now have the (optional) ability to return conflicts
in the index.  Prior to this change, they would be omitted, and callers
(like diff) would omit conflicted index entries entirely.
2015-05-28 09:44:02 -04:00
Edward Thomson
d67f270e58 index: validate mode of new conflicts 2015-05-28 09:43:57 -04:00
Edward Thomson
ecd60a56eb conflicts: when adding conflicts, remove staged
When adding a conflict for some path, remove the staged entry.
Otherwise, an illegal index (with both stage 0 and high-stage
entries) would result.
2015-05-28 09:43:49 -04:00
Carlos Martín Nieto
c6e942fb3d remote: validate refspecs before adding to config
When we moved from acting on the instance to acting on the
configuration, we dropped the validation of the passed refspec, which
can lead to writing an invalid refspec to the configuration. Bring that
validation back.
2015-05-28 15:32:20 +02:00
Carlos Martín Nieto
ae5b93629c remote: remove fetch parameter from create_anonymous
An anonymous remote is not configured and cannot therefore have
configured refspecs. Remove the parameter which adds this from the
constructor.
2015-05-28 15:32:20 +02:00
Michał Górny
8085adf82c test: Add a test for in-memory SSH private key cred_cb 2015-05-27 20:36:53 +02:00
Colomban Wendling
1ecbcd8e51 Fix ident replacement to match Git behavior
Git inserts a space after the SHA1 (as of 2.1.4 at least), so do the
same.
2015-05-26 19:56:06 +02:00
Carlos Martín Nieto
5014fe95f5 branch: error out if we cannot find the remote
When we look for which remote corresponds to a remote-tracking branch,
we look in the refspecs to see which ones matches. If none do, we should
abort. We currently ignore the error message from this operation, so
let's not do that anymore.

As part of the test we're writing, let's test for the expected behaviour
if we cannot find a refspec which tells us what the remote-tracking
branch for a remote would look like.
2015-05-22 12:31:39 +02:00
Carlos Martín Nieto
7cd4ba1b17 refspec: make sure matching refspecs have src, dst and input strings
When we find out that we're dealing with a matching refspec, we set the
flag and return immediately. This leaves the strings as NULL, which
breaks the contract.

Assign these pointers to a string with the correct values.
2015-05-22 12:11:42 +02:00
Carlos Martín Nieto
6675aaba88 Merge pull request #3146 from ethomson/add_untracked_files
index_add_all: include untracked files in new subdirs
2015-05-21 04:58:16 +02:00
Edward Thomson
fa9a969d80 index_add_all: include untracked files in new subdirs 2015-05-20 20:05:55 -04:00
Carlos Martín Nieto
2c57114f11 ignore: clear the error when matching a pattern negation
When we discover that we want to keep a negative rule, make sure to
clear the error variable, as it we otherwise return whatever was left by
the previous loop iteration.
2015-05-20 21:49:02 +02:00
Edward Thomson
acc573cba3 Merge pull request #3109 from libgit2/cmn/index-use-diff
Use a diff for iteration in index_update_all and index_add_all
2015-05-19 14:12:40 -04:00
Carlos Martín Nieto
7b5ce2e5c4 clone: don't rely on auto-saving for single-branch
The code used to rely on the clone code calling the remote's save, which
does not happen anymore, meaning that the configuration settings the
remote expected were not being written to disk.

The run-time configuration was still being affected, so the right branch
was being cloned. The tests continued to pass as we did not check for
the configuration entires. Fix this by creating the remote with the
single-branch refspec we want and checking for its existence in the
configuration.
2015-05-17 15:45:37 +02:00
Carlos Martín Nieto
2b2dfe80f0 index: include TYPECHANGE in the diff
Without this option, we would not be able to catch exec bit changes.
2015-05-14 15:23:12 +02:00
Carlos Martín Nieto
041ad7dbd6 push: add tests for the push negotiation callback
The functionality was meged without including tests, so let's add them
now.
2015-05-14 10:34:05 +02:00
Carlos Martín Nieto
16d742ebdb Merge pull request #3119 from ethomson/ignore
Attributes: don't match files for folders
2015-05-13 21:43:58 +02:00
Edward Thomson
cd430bc786 Merge pull request #3103 from libgit2/cmn/local-push-message
Use the packbuilder in local push
2015-05-13 14:26:20 -04:00
Edward Thomson
882cc37f83 attr tests: make explicit our dir/file match tests 2015-05-13 10:56:55 -04:00
Carlos Martín Nieto
3e529e9d2d Fix a few leaks
The interesting one is the notification macro, which was returning
directly on a soft-abort instead of going through the cleanup.
2015-05-13 16:40:18 +02:00
Edward Thomson
6cd9219385 Merge pull request #3115 from libgit2/cmn/clone-submodule
submodule: add test initialising and cloning a repo
2015-05-13 09:07:15 -04:00
Carlos Martín Nieto
0bc3d56dde tests: don't push to our resources
A couple of tests use the wrong remote to push to. We did not notice up
to now because the local push would copy individual objects, and those
already existed, so it became a no-op.

Once we made local push create the packfile, it became noticeable that
there was a new packfile where it didn't belong.
2015-05-13 10:56:37 +02:00
Carlos Martín Nieto
a4b6452a6a remote: remove git_remote_save()
It has now become a no-op, so remove the function and all references to
it.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
7725499072 remote: remove live changing of refspecs
The base refspecs changing can be a cause of confusion as to what is the
current base refspec set and complicate saving the remote's
configuration.

Change `git_remote_add_{fetch,push}()` to update the configuration
instead of an instance.

This finally makes `git_remote_save()` a no-op, it will be removed in a
later commit.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
35a8a8c546 remote: move the tagopt setting to the fetch options
This is another option which we should not be keeping in the remote, but
is specific to each particular operation.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
3eff2a5728 remote: move the update_fetchhead setting to the options
While this will rarely be different from the default, having it in the
remote adds yet another setting it has to keep around and can affect its
behaviour. Move it to the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
058b753ceb remote: move the transport ctor to the callbacks
Instead of having it set in a different place from every other callback,
put it the main structure. This removes some state from the remote and
makes it behave more like clone, where the constructors are passed via
the options.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
22261344de remote: remove url and pushurl from the save logic
As a first step in removing the repository-saving logic, don't allow
chaning the url or push url from a remote object, but change the
configuration on the configuration immediately.
2015-05-13 09:46:36 +02:00
Carlos Martín Nieto
8f0104ecc5 Remove the callbacks struct from the remote
Having the setting be different from calling its actions was not a great
idea and made for the sake of the wrong convenience.

Instead of that, accept either fetch options, push options or the
callbacks when dealing with the remote. The fetch options are currently
only the callbacks, but more options will be moved from setters and
getters on the remote to the options.

This does mean passing the same struct along the different functions but
the typical use-case will only call git_remote_fetch() or
git_remote_push() and so won't notice much difference.
2015-05-13 09:46:35 +02:00
Edward Thomson
9486d20336 attr test: test a file beneath ignored folder 2015-05-12 14:36:48 -04:00
Edward Thomson
97fb9ac739 attr: test that a file is not ignored for a folder
When a .gitignore specifies some folder "foo/", ensure that a file
with the same name "foo" is not ignored.
2015-05-12 14:36:45 -04:00
Edward Thomson
adad518129 attr: regression tests for ignore matching
Ensure that when examining a .gitignore in a subdirectory, we do not
erroneously apply the paths contained therein to the root of the
repository.  (Fixed in c02a0e4).
2015-05-12 14:36:41 -04:00
Carlos Martín Nieto
1e44ea97f6 submodule: add test initialising and cloning a repo
We have a few tests checking each step, but we do not yet have a test
which tests the documented workflow for creating a submodule, namely
`setup_add` followed by cloning into it, followed by `add_finalize`.

Add such a test to protect against regressions in this workflow.
2015-05-12 11:13:41 +02:00
Edward Thomson
4ea3eebf4b stash_apply: provide progress callbacks 2015-05-11 14:12:42 -04:00
Edward Thomson
19c80a6fd1 stash_apply: provide its own options structure 2015-05-11 14:12:39 -04:00
Edward Thomson
249616685e stash: test checkout notify callbacks 2015-05-11 14:12:35 -04:00
Edward Thomson
f78bb2afb3 stash: return GIT_EMERGECONFLICT on merge conflict 2015-05-11 14:12:27 -04:00
Edward Thomson
f0957589ee stash: refactor to use merge_iterators 2015-05-11 14:12:19 -04:00
Edward Thomson
d0dd3fcee7 stash apply: check out a tree, not piecewise 2015-05-11 14:12:12 -04:00
Edward Thomson
35d3976151 index: introduce git_index_read_index 2015-05-11 14:12:05 -04:00
Edward Thomson
9ebb5a3ff3 merge: merge iterators 2015-05-11 14:11:56 -04:00
Pierre-Olivier Latour
bf8dd3f53d Added git_stash_apply() and git_stash_pop() APIs 2015-05-11 14:11:53 -04:00
Carlos Martín Nieto
074d323f73 Merge pull request #3079 from ethomson/config
Configuration changes for handling multiple of the same sections
2015-05-04 15:23:40 +02:00
Edward Thomson
d6b7e40497 config: test all multivars are updated
If a multivar exists within two sections (of the same name)
then they should both be updated in a `set_multivar`.  Ensure
that this is the case.
2015-05-04 07:41:41 -05:00
Edward Thomson
0daf998de7 config: use wildcard in test instead of empty expr 2015-05-04 07:41:40 -05:00
Edward Thomson
63c0cc65bc config: cleanup some now-unused variables 2015-05-04 07:41:38 -05:00
Ryan Roden-Corrent
5a70df9436 Test setting config var under duplicate header.
Add a test that exposes a bug in config_write.
It is valid to have multiple separate headers for the same config section, but
config_write will exit after finding the first matching section in certain
situations.
This test proves that config_write will duplicate a variable that already
exists instead of overwriting it if the variable is defined under a duplicate
section header.
2015-05-04 07:41:36 -05:00
Edward Thomson
bf99390eef config: examine whole file when writing
Previously we would try to be clever when writing the configuration
file and try to stop parsing (and simply copy the rest of the old
file) when we either found the value we were trying to write,
or when we left the section that value was in, the assumption being
that there was no more work to do.

Regrettably, you can have another section with the same name later
in the file, and we must cope with that gracefully, thus we read the
whole file in order to write a new file.

Now, writing a file looks even more than reading.  Pull the config
parsing out into its own function that can be used by both reading
and writing the configuration.
2015-05-04 07:41:33 -05:00
Edward Thomson
f79c7322a9 config: test overwriting cvar in multiple regions 2015-05-04 07:41:31 -05:00
Edward Thomson
7ee61b8ee3 config: ensure we can write to an empty file 2015-05-04 07:41:30 -05:00
Edward Thomson
cd79d99a4c checkout test: better case-insensitive test on Mac
On Mac OS, `realpath` is deficient in determining the actual filename
on-disk as it will simply provide the string you gave it if that file
exists, instead of returning the filename as it exists.  Instead we
must read the directory entries for the parent directory to get the
canonical filename.
2015-05-04 07:18:30 -05:00
Edward Thomson
f286e2715d status test: always test the new file path 2015-05-04 07:18:29 -05:00
Edward Thomson
64842d8756 checkout test: only run icase on icase platform 2015-05-04 07:18:29 -05:00
Edward Thomson
05f690122e checkout: remove blocking dir when FORCEd 2015-05-04 07:18:27 -05:00
Edward Thomson
3520c97057 Revert "Always checkout with case sensitive iterator"
This reverts commit 40d791545a.
2015-05-04 07:18:27 -05:00
Edward Thomson
6dfd8506b7 checkout test: ensure we write to casechanged dir
Ensure that on a case insensitive filesystem that we can checkout
into some folder 'FOLDER' that exists on disk, even if the target
of the checkout is a different case (eg 'folder').
2015-05-04 07:18:26 -05:00
Edward Thomson
431f98070f checkout test: ignore unstaged case-changing renames
On Windows, you might sloppily rewrite a file (or have a sloppy
text editor that does it for you) and accidentally change its
case.  (eg, "README" -> "readme").  Git ignores this accidental
case changing rename during checkout and will happily write the
new content to the file despite the name change.  We should, too.
2015-05-04 07:18:25 -05:00
Carlos Martín Nieto
cfc2e56d59 Merge pull request #3087 from ethomson/pr/3054
Performance Improvements to Status on Windows
2015-05-04 11:16:52 +02:00
Edward Thomson
5c387b6c5a git_path_diriter: next shouldn't take path ptr
The _next method shouldn't take a path pointer (and a path_len
pointer) as 100% of current users use the full path and ignore
the filename.

Plus let's add some docs and a unit test.
2015-05-01 12:31:29 -04:00
Edward Thomson
07bbc045c7 git_path_dirload: use git_path_diriter 2015-05-01 12:31:09 -04:00
Edward Thomson
cbe8a61dfa Merge pull request #3059 from libgit2/cmn/negotiation-notify
[WIP/RFC] push: report the update plan to the caller
2015-05-01 11:28:54 -04:00
Tomas Paladin Volf
cf2380a623 Fixed unused warning in tests/rebase/merge.c 2015-04-30 14:17:05 +02:00
J Wyman
4c09e19a37 Improvements to ignore performance on Windows.
Minimizing the number directory and file opens, minimizes the amount of IO thus reducing the overall cost of performing ignore operations.
2015-04-28 14:24:58 -04:00
Carlos Martín Nieto
65808406bb Merge pull request #3063 from ethomson/config_validate_name
Validate configuration keys
2015-04-24 02:46:49 +02:00
Carlos Martín Nieto
24e53d2fba Rename GIT_SSL to GIT_OPENSSL
This is what it's meant all along, but now we actually have multiple
implementations, it's clearer to use the name of the library.
2015-04-23 17:39:51 +02:00
Carlos Martín Nieto
6bb54cbff3 Add a SecureTransport TLS channel
As an alternative to OpenSSL when we're on OS X. This one can actually
take advantage of stacking the streams.
2015-04-23 17:39:51 +02:00
Edward Thomson
6dc55872a8 config: ensure we can write to an empty file 2015-04-23 11:25:03 -04:00
Edward Thomson
23fb4004ed config: test that we validate the key 2015-04-23 11:24:50 -04:00
Carlos Martín Nieto
69c333f997 Merge pull request #3064 from rcorre/config-write-fix
config_write -- handle duplicate section headers when deleting entries
2015-04-23 17:23:04 +02:00
Carlos Martín Nieto
63e8b08dfc Merge branch 'attr-ignore' 2015-04-23 17:08:10 +02:00
Mike McQuaid
c6bf03b44f Add failing subdirectory gitignore attr test. 2015-04-23 17:07:37 +02:00
Edward Thomson
27fa7477b0 Merge pull request #3032 from jfultz/index-file-modes
Fix git_checkout_tree() to do index filemodes correctly on Windows.
2015-04-23 10:54:08 -04:00
cthomas
fc6f044ea3 Fix for Issue #3023 tests fail with no network
Moved offending tests from network to online so they will get skipped
when there is a lack of network connectivity:
-test_online_remotes__single_branch
-test_online_remotes__restricted_refspecs
2015-04-21 20:02:24 -04:00