Commit Graph

5238 Commits

Author SHA1 Message Date
J Wyman
7eb7e03db8 Adjusting stream buffer size to 64KB
64K is optimal buffer size per https://technet.microsoft.com/en-us/library/cc938632.aspx
2015-05-07 08:50:12 -07:00
Carlos Martín Nieto
b162d97a4f config: plug a couple of leaks 2015-05-05 09:47:16 +02: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
63c0cc65bc config: cleanup some now-unused variables 2015-05-04 07:41:38 -05:00
Edward Thomson
9c26de0fd1 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.
2015-05-04 07:41:37 -05:00
Edward Thomson
2a950c945a 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.
2015-05-04 07:41:35 -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
4beab1f8bb 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.
2015-05-04 07:18:28 -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
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
be3f104967 diriter: actually use iconv on mac 2015-05-01 12:31:47 -04:00
Edward Thomson
cd39e4e2f3 git_buf_put_w: introduce utf16->utf8 conversion 2015-05-01 12:31:44 -04:00
Edward Thomson
f63a1b729b 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.
2015-05-01 12:31:40 -04: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
7ef005f165 git_path_dirload_with_stat: moved to fs_iterator 2015-05-01 12:31:26 -04:00
Edward Thomson
ba8ef18a53 git_path_dirload_with_stat: use git_path_diriter 2015-05-01 12:31:21 -04:00
Edward Thomson
35c1d20750 git_win32_path_dirload_with_stat: removed 2015-05-01 12:31:14 -04:00
Edward Thomson
07bbc045c7 git_path_dirload: use git_path_diriter 2015-05-01 12:31:09 -04:00
Edward Thomson
edbfc52cdd git_path: introduce 'git_path_diriter'
Introduce a new `git_path_diriter` that can iterate directories
efficiently for each platform.
2015-05-01 12:31:05 -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
Edward Thomson
9f73e1f335 Merge pull request #3081 from leoyanggit/build_warnings
Fix some build warnings
2015-05-01 09:01:34 -04:00
Yong Li
e30438ccb0 Do not call regfree() on an empty regex that is not successfully created by regcomp
(also removed an unused member "has_regex" from all_iter)
2015-04-29 13:40:42 -04:00
Edward Thomson
544139f50b win32: keep full path for realpath usage 2015-04-28 17:15:28 -04:00
Edward Thomson
c074d7a4c5 win32: mimic git_path_dirload_with_stat closely 2015-04-28 17:15:18 -04:00
Edward Thomson
b3f6cef066 dirload: loop conditional; less path mangling 2015-04-28 14:25:13 -04:00
Edward Thomson
e05531ddbd win32 dirload: don't heap allocate DIR structure 2015-04-28 14:25:09 -04:00
Edward Thomson
f3c444b879 win32: abstract file attributes -> struct stat fn 2015-04-28 14:25:06 -04:00
J Wyman
1920ee4ef6 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).
2015-04-28 14:25:02 -04: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
Leo Yang
69f0032b4c 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.
2015-04-28 12:40:20 -04:00
Edward Thomson
d969d41547 Merge pull request #3071 from linquize/git_reflog_drop
Fix wrong format string in git_reflog_drop() error message
2015-04-24 12:00:51 -04:00
Linquize
31d5dce372 Fix wrong format string in git_reflog_drop() error message 2015-04-24 23:56:59 +08: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
44b769e497 SecureTransport: handle graceful closes
On close, we might get a return code which looks like an error but just
means that the other side closed gracefully. Handle that.
2015-04-23 17:43:44 +02:00
Carlos Martín Nieto
65ac7ddccc SecureTransport: require TLS v1.x
Anything SSL is deprecated. Let's make sure we don't try to use SSL v3
when talking to the server.
2015-04-23 17:43:44 +02:00
Carlos Martín Nieto
b7e1c81d1b 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.
2015-04-23 17:43:43 +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
70b852cee2 Silence unused warnings when not using OpenSSL 2015-04-23 17:39:51 +02:00
Carlos Martín Nieto
6946a3be95 Abstract away the TLS stream implementation
Instead, provide git_tls_stream_new() to ask for the most appropriate
encrypted stream and use it in our HTTP transport.
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
d369d71f6a config: peek returns '\n' on EOF; handle in write 2015-04-23 11:25:07 -04:00
Edward Thomson
2c8c00c646 config: validate config keys 2015-04-23 11:24:59 -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
c02a0e46eb attr_file: fix subdirectory attr case.
Closes #2966.
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
Edward Thomson
aaf42c8df7 Merge pull request #3051 from jeffhostetler/jeffhostetler/memleak_windows_tls_data
Attempt to fix Windows TLS memory leak.
2015-04-21 18:21:59 -04:00
Ryan Roden-Corrent
9a810c5e33 git_config_delete: search until last section.
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.
2015-04-21 14:24:08 -04:00
Carlos Martín Nieto
7636f740b3 Merge pull request #2992 from ethomson/rebase_fixes
Rebase fixes
2015-04-21 14:38:23 +02:00
Carlos Martín Nieto
3a63e8c299 Merge pull request #3060 from ethomson/2851
Handle invalid multiline configuration
2015-04-21 14:04:45 +02:00
John Fultz
d3282680ed 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.
2015-04-21 02:17:23 -05:00
Edward Thomson
94c988f6d6 rebase: include checkout opts within rebase opts 2015-04-20 17:19:08 -04:00
Edward Thomson
f3a199dd99 rebase: init and open take a rebase_options
`git_rebase_init` and `git_rebase_open` should take a
`git_rebase_options` and use it for future rebase operations on
that `rebase` object.
2015-04-20 16:22:54 -04:00
Edward Thomson
5ae38538c6 rebase: take checkout_options where appropriate 2015-04-20 16:22:49 -04:00
Edward Thomson
649834fd6e reset: git_checkout_options is const 2015-04-20 16:22:44 -04:00
Edward Thomson
eaf0d68830 rebase: block rebase_commit with unstaged changes 2015-04-20 16:22:39 -04:00
Edward Thomson
30640aa9ad 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.
2015-04-20 16:22:27 -04:00
Edward Thomson
e009a7059d config_file: comment char can be invalid escape
Don't assume that comment chars are comment chars, they may be (an
attempt to be escaped).  If so, \; is not a valid escape sequence,
complain.
2015-04-20 00:26:00 -04:00
Edward Thomson
7f2e61f3ee config_file: parse multilines generously
Combine unquoting and multiline detection to avoid ambiguity when
parsing.
2015-04-20 00:25:44 -04:00
Edward Thomson
08c45213b1 Merge pull request #3024 from git-up/diff_merge_fix
Make sure to also update delta->nfiles when merging diffs
2015-04-19 19:58:03 -04:00
Carlos Martín Nieto
efc2fec50e push: report the update plan to the caller
It can be useful for the caller to know which update commands will be
sent to the server before the packfile is pushed up. git does this via
the pre-push hook.

We don't have hooks, but as it adds introspection into what is
happening, we can add a callback which performs the same function.
2015-04-19 01:02:29 +02:00
Jeff Hostetler
06c985d864 Rename routine to free TLS data 2015-04-18 09:07:48 -04:00
Edward Thomson
4c02d39374 Merge pull request #3016 from pks-t/ignore-exclude-fix
ignore: fix negative ignores without wildcards.
2015-04-17 16:57:26 -05:00
Edward Thomson
a0e652d281 Merge pull request #2999 from pks-t/submodule-set-url
Implement git_submodule_set_branch.
2015-04-17 12:35:41 -05:00
Edward Thomson
a5bf599c9d Merge pull request #3047 from git-up/diff_fixes
Diff fixes
2015-04-17 12:32:39 -05:00
Jeff Hostetler
d3fb7d93a6 Remove DllMain now that TLS data freed by threads 2015-04-17 10:04:01 -04:00
Jeff Hostetler
f5ffb40e2b Also fix leak of TLS data on main thread. 2015-04-17 09:58:09 -04:00
Jeff Hostetler
55c5f756d8 Attempt to fix Windows TLS memory leak. 2015-04-17 09:30:22 -04:00
Patrick Steinhardt
4f3586034b ignore: fix negative ignores without wildcards. 2015-04-17 09:59:16 +02:00
Edward Thomson
c332bb70cd Merge pull request #3042 from libgit2/cmn/odd-slowdown
revwalk: detect when we're out of interesting commits
2015-04-16 19:26:40 -05:00
Edward Thomson
6f80bf4afb Merge pull request #3037 from libgit2/cmn/hide-then-push
Handle hide-then-push in the revwalk
2015-04-16 19:12:28 -05:00
Edward Thomson
fa7281db4e Merge pull request #3039 from jeffhostetler/jeffhostetler/msvc_crtdbg
Add memory leak detection/reporting using MSVC CRTDBG facility.
2015-04-16 18:26:47 -05:00
John Fultz
6598aa7e94 Oops...need bitwise, not logical negation. 2015-04-16 14:10:34 -05:00
Pierre-Olivier Latour
db853748f6 Fixed GIT_DIFF_UPDATE_INDEX not being aware of executable bit changes
In the prior implementation, enabling GIT_DIFF_UPDATE_INDEX would overwrite
entries in the index with the ones generated from scanning the working if the
OID was the same.

Because this OID comparison ignores file modes, this means an file in the
workdir with only an exec bit difference with the one in the index would end
up being overwritten, resulting in the exec bit being loss. There might be
other related bugs but the fix of comparing OIDs and file modes should
address them all.
2015-04-15 15:28:03 -07:00
Pierre-Olivier Latour
cc93ad1650 Removed unnecessary condition
The variable noid is guaranteed to be zero at this point of the code path.
2015-04-15 15:27:59 -07:00
Pierre-Olivier Latour
35df76bdd9 Use git_oid_cpy() instead of memcpy() 2015-04-15 15:27:56 -07:00
Jeff Hostetler
d06c589f48 Add MSVC CRTDBG memory leak reporting. 2015-04-15 10:25:09 -04:00
Carlos Martín Nieto
a05416951e revwalk: detect when we're out of interesting commits
When walking backwards and marking parents uninteresting, make sure we
detect when the list of commits we have left has run out of
uninteresting commits so we can stop marking commits as
uninteresting. Failing to do so can mean that we walk the whole history
marking everything uninteresting, which eats up time, CPU and IO for
with useless work.

While pre-marking does look for this, we still need to check during the
main traversal as there are setups for which pre-marking does not leave
enough information in the commits. This can happen if we push a commit
and hide its parent.
2015-04-14 03:26:45 +02:00
Patrick Steinhardt
129788a623 Implement git_submodule_set_branch. 2015-04-12 10:51:08 +02:00
Edward Thomson
623fbd93f1 Merge pull request #2974 from libgit2/cmn/clone-everything
Make sure to pack referenced objects for non-branches
2015-04-10 11:38:07 +02:00
Edward Thomson
63af449e24 Merge pull request #3030 from linquize/symlink_supported
If work_dir is not specified, use repo_dir to test if symlink is supported
2015-04-10 11:33:14 +02:00
Edward Thomson
8932c32c21 Merge branch 'pr/3035' 2015-04-10 10:50:01 +02:00
Patrick Steinhardt
129022ee1e Fix checking of return value for regcomp.
The regcomp function returns a non-zero value if compilation of
a regular expression fails. In most places we only check for
negative values, but positive values indicate an error, as well.
Fix this tree-wide, fixing a segmentation fault when calling
git_config_iterator_glob_new with an invalid regexp.
2015-04-10 09:40:33 +02:00
Carlos Martín Nieto
50fdfe2bcb revwalk: don't insert uninteresting commits into the queue
When a commit is first set as unintersting and then pushed, we must take
care that we do not put it into the commit list as that makes us return
at least that commit (but maybe more) as we've inserted it into the list
because we have the assumption that we want anything in the commit list.
2015-04-08 23:51:49 +02:00
Jozef Matula
2a06976165 ISO C90 forbids mixed declarations and code
GIT_UNUSED() macro generates code therefore it should be used after
variable declarations.
2015-04-08 16:30:44 +02:00
Patrick Steinhardt
08e1fd6517 describe: only abort without tags if fallback is not allowed.
When no reference names could be found we did error out when trying to describe
a commit. This is wrong, though, when the option to fall back to a commit's
object ID is set.
2015-04-07 17:32:56 +02:00
John Fultz
67db2bdeea Fix git_checkout_tree() to do index filemodes correctly on Windows.
git_checkout_tree() has some fallback behaviors for file systems
which don't have full support of filemodes.  Generally works fine,
but if a given file had a change of type from a 0644 to 0755 (i.e.,
you add executable permissions), the fallback behavior incorrectly
triggers when writing hte updated index.

This would cause a git_checkout_tree() command, even with the
GIT_CHECKOUT_FORCE option set, to leave a dirty index on Windows.

Also added checks to an existing test to catch this case.
2015-04-06 18:22:17 -05:00
Linquize
466d2e7a5f For bare repository, use repo_dir to test if symlinks are supported 2015-04-04 23:23:06 +08:00
Pierre-Olivier Latour
807566d554 Entry argument passed to git_index_add_frombuffer() should be const 2015-04-03 18:59:11 -07:00
Pierre-Olivier Latour
b978082312 Make sure to also update delta->nfiles when merging diffs
When diffs are generated, the value for the 'nfiles' field of 'git_diff_delta'
will be consistent with the value in the 'status' field. Merging diffs can
modify the 'status' field of some deltas and the 'nfiles' field needs to be
updated accordingly.
2015-03-30 14:06:21 -07:00
Edward Thomson
de355f2341 Merge pull request #3011 from ethomson/filter_zero_tempbuf
Clear temporary buffer when filtering
2015-03-25 13:14:28 -04:00
Edward Thomson
669ae27422 filter: clear the temp_buf if we're using one
If we are using a temporary buffer for filtering, be sure to clear
it before using it, in case the file that we are filtering is empty.
2015-03-25 10:20:59 -04:00
Edward Thomson
78db0239db squash some leaks 2015-03-24 20:58:00 +00:00
Edward Thomson
c5e071873c Merge pull request #2990 from leoyanggit/custom_param
Add a custom param to git_smart_subtransport_definition
2015-03-24 14:03:51 -04:00
Edward Thomson
aa7a4a5077 Merge pull request #2986 from tkelman/mingw_winhttp
WinHTTP for MinGW
2015-03-24 09:06:20 -04:00
Edward Thomson
95d1624b8d Merge pull request #2947 from libgit2/cmn/notes-buf
note: use a git_buf to return the default namespace
2015-03-24 08:34:12 -04:00
Carlos Martín Nieto
7c3834d124 Merge pull request #3010 from ethomson/checkout_invalid_path_err
checkout: report correct invalid path
2015-03-24 10:18:44 +01:00
Edward Thomson
3cda9cf247 checkout: report correct invalid path 2015-03-23 11:30:30 -04:00
Carlos Martín Nieto
2a0f67f04c git: make sure to close the network stream
In case of a bad url or other error during the connection setup, we
close the stream via free.
2015-03-21 21:49:27 +01:00