Yong Li [Mon, 4 May 2015 13:41:34 +0000 (09:41 -0400)]
Android build doesn't need deps/regex
deps/regex was included in Android build because Android NDK 4 has
a packaging bug and doesn't have the regular expression functions defined
in its libc.so. The bug has been fixed in subsequent Android NDK releases.
If it is still necessary to work around the bug in Android NDK 4, we
should consider to use an option like ANDROID_NDK_RELEASE or
ANDROID_NDK_RELEASE_NUM.
Edward Thomson [Mon, 27 Apr 2015 19:38:44 +0000 (15:38 -0400)]
config: lock the file for write before reading
When writing a configuration file, we want to take a lock on the
new file (eg, `config.lock`) before opening the configuration file
(`config`) for reading so that we can prevent somebody from changing
the contents underneath us.
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.
Edward Thomson [Mon, 27 Apr 2015 14:43:50 +0000 (10:43 -0400)]
config: write existing lines as-is when rewriting
When updating a configuration file, we want to copy the old data
from the file to preserve comments and funny whitespace, instead
of writing it in some "canonical" format. Thus, we keep a
pointer to the start of the line and the line length to preserve
these things we don't care to rewrite.
Edward Thomson [Thu, 23 Apr 2015 20:54:36 +0000 (16:54 -0400)]
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.
Edward Thomson [Thu, 23 Apr 2015 19:58:53 +0000 (15:58 -0400)]
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.
Edward Thomson [Tue, 31 Mar 2015 20:29:35 +0000 (16:29 -0400)]
checkout: break case-changes into delete/add
When checking out with a case-insensitive working directory, we
want to change the case of items in the working directory to
reflect changes that occured in the checkout target. Diff now
has an option to break case-changing renames into delete/add.
Edward Thomson [Wed, 1 Apr 2015 19:23:37 +0000 (15:23 -0400)]
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').
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.
Jiří Techet [Fri, 1 May 2015 20:48:33 +0000 (22:48 +0200)]
Don't search iconv in /opt/local
Since OpenSSL isn't used any more on OS X, there is no dependency
on any MacPorts library under /opt/local and there is no danger of
conflicts between MacPorts and system iconv. For this reason the
system iconv can always be used now.
Edward Thomson [Wed, 29 Apr 2015 21:23:02 +0000 (17:23 -0400)]
git_path_diriter: use FindFirstFile in win32
Using FindFirstFile and FindNextFile in win32 allows us to
use the directory information that is returned, instead of
us having to get the file attributes all over again, which
is a distinct cost savings on win32.
J Wyman [Thu, 26 Mar 2015 22:10:24 +0000 (18:10 -0400)]
Improvements to status performance on Windows.
Changed win32/path_w32.c to utilize NTFS' FindFirst..FindNext data instead of doing an lstat per file. Avoiding unnecessary directory opens and file scans reduces IO, improving overall performance. Effect is magnified due to NTFS being a kernel mode file system (as opposed to user mode).
Leo Yang [Tue, 28 Apr 2015 16:40:20 +0000 (12:40 -0400)]
Fix some build warnings
In checkout.c and filter.c we were casting a sub struct
to a parent struct which breaks the strict aliasing rules
in C. However we can use .parent or .base to access the
parent struct to avoid the build warnings.
In remote.c the local variable error was not initialized
or updated in some cases. For unintialized error a build
warning will be generated. So always keep error variable
up-to-date.
SecureTransport: allow overriding a bad certificate
Do not automatically fail on a bad certificate, but let the caller
decide. This means we don't need our switch on errors anymore but can
return a string representation from the security framework.
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
If git_config_delete is to work properly in the presence of duplicate section
headers, it cannot stop searching at the end of the first matching section, as
there may be another matching section later.
When config_write is used for deletion (value = NULL), it may only terminate
when the desired key is found or there are no sections left to parse.
Add a unittest to validate bug #3043, where a duplicate empty config header
could cause deletion of a config entry to fail silently. The bug is currently
unresolved and this test will fail.
John Fultz [Tue, 21 Apr 2015 04:41:04 +0000 (23:41 -0500)]
Fix index-adding functions to know when to trust filemodes.
The idea...sometimes, a filemode is user-specified via an
explicit git_index_entry. In this case, believe the user, always.
Sometimes, it is instead built up by statting the file system. In
those cases, go with the existing logic we have to determine
whether the file system supports all filemodes and symlinks, and
make the best guess.
On file systems which have full filemode and symlink support, this
commit should make no difference. On others (most notably Windows),
this will fix problems things like:
* git_index_add and git_index_add_frombuffer() should be believed.
* As a consequence, git_checkout_tree should make the filemodes in
the index match the ones in the tree.
* And diffs with GIT_DIFF_UPDATE_INDEX don't write the wrong filemodes.
* And merges, and probably other downstream stuff now fixed, too.
This makes my previous changes to checkout.c unnecessary,
so they are now reverted.
Also, added a test for index_entry permissions from git_index_add
and git_index_add_frombuffer, both of which failed before these changes.
Edward Thomson [Tue, 17 Mar 2015 14:04:08 +0000 (10:04 -0400)]
rebase: identify a rebase that has not started
In `git_rebase_operation_current()`, indicate when a rebase has not
started (with `GIT_REBASE_NO_OPERATION`) rather than conflating that
with the first operation being in-progress.