Commit Graph

5238 Commits

Author SHA1 Message Date
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
Vicent Marti
d88e6e9b3c mkdir-ext: Retry lstat on EEXIST race 2015-03-19 18:38:13 +01:00
Tony Kelman
b631e0d96d Use swprintf_s everywhere except mingw.org 2015-03-19 08:42:45 -07:00
Carlos Martín Nieto
2c4e90f3fa Merge pull request #2996 from ethomson/dll_comments
win32 resource: allow custom comments field in DLL
2015-03-19 01:03:41 +01:00
Edward Thomson
523526e55d win32 resource: allow custom comments field in DLL 2015-03-18 18:25:14 -04:00
Edward Thomson
89ba9f1acc Merge pull request #2967 from jacquesg/merge-whitespace
Allow merges of files (and trees) with whitespace problems/fixes
2015-03-18 13:17:04 -04:00
Leo Yang
142e5379ca Add a custom param to git_smart_subtransport_definition
The smart transport has already take the payload param. For the
sub transport a payload param is useful for the implementer.
2015-03-18 13:15:21 -04:00
Carlos Martín Nieto
03b51b5d94 Merge pull request #2955 from git-up/update_tips_fixes
Update tips fixes
2015-03-18 05:04:12 +01:00
Carlos Martín Nieto
83ad46f726 Merge remote-tracking branch 'ethomson/submodule_8dot3' 2015-03-18 04:59:16 +01:00
Edward Thomson
fa8a38a490 Merge pull request #2983 from jeffhostetler/jeffhostetler/perf_merge_lazy_binary_check
PERF: In MERGE, lazily compute is_binary
2015-03-17 22:22:38 -04:00
Sebastian Bauer
cdedef4061 Initialize refs vector in git_remote_update_tips().
Otherwise, bailing out early when ls_to_vector() fails accesses
uninitialized memory.
2015-03-17 22:03:51 +01:00
Carlos Martín Nieto
c84a9dd2da local: recusrively insert non-branch objects into the packfile
When we insert e.g. a tag or tagged object into the packfile, we must
make sure to insert any referenced objects as well, or we will have
broken links.

Use the recursive version of packfile insertion to make sure we send
over not just the tagged object but also the objects it references.
2015-03-17 20:51:47 +01:00
Carlos Martín Nieto
84511143fd tree: add more correct error messages for not found
Don't use the full path, as that's not what we are asserting does not
exist, but just the subpath we were looking up.
2015-03-17 20:51:14 +01:00
Carlos Martín Nieto
a61fa4c0c7 packbuilder: introduce git_packbuilder_insert_recur()
This function recursively inserts the given object and any referenced
ones. It can be thought of as a more general version of the functions to
insert a commit or tree.
2015-03-17 20:51:14 +01:00
Carlos Martín Nieto
385449b1df note: use a git_buf to return the default namespace
The caller has otherwise no way to know how long the string will be
allocated or ability to free it.

This fixes #2944.
2015-03-17 20:50:02 +01:00
Edward Thomson
9bbc8f350b Merge pull request #2962 from libgit2/cmn/reflog-annotated
Add annotated versions of ref-modying functions
2015-03-17 10:21:28 -04:00
Edward Thomson
7800048afb Merge pull request #2972 from libgit2/cmn/pack-objects-walk
[WIP] Smarter pack-building
2015-03-17 10:06:50 -04:00
Edward Thomson
828e595969 Merge pull request #2982 from libgit2/cmn/stream-check-ec
Don't ask for a stream's certificate unless it's encrypted
2015-03-17 09:44:56 -04:00
Edward Thomson
c07d02064d Merge pull request #2977 from pks-t/submodule-sync-url-fix
Fix git_submodule_sync writing URL to wrong key.
2015-03-17 09:44:25 -04:00
Alex Crichton
3066026b04 Fix build on mingw-w64 2015-03-16 13:59:29 -07:00
Philip Kelley
8f426d7dd2 Win32: Enable WinHTTP for MinGW 2015-03-16 12:59:55 -07:00
Jeff Hostetler
fea24c5300 PERF: In MERGE, lazily compute is_binary 2015-03-16 15:54:53 -04:00
Carlos Martín Nieto
84d83b8e75 http: do not try to use the cert callback on unencrypted streams
When the user has a certificate check callback set, we still have to
check whether the stream we're using is even capable of providing a
certificate.

In the case of an unencrypted certificate, do not ask for it from the
stream, and do not call the callback.
2015-03-16 19:43:46 +01:00
Carlos Martín Nieto
62dd4d71db annotated_commit: provide a constructor from a revspec
This extra constructor will be useful for the annotated versions of
ref-modifying functions, as it allows us to create a commit with the
extended sha syntax which was used to retrieve it.
2015-03-16 16:57:30 +01:00
Carlos Martín Nieto
62d38a1ddb Add annotated commit versions of reflog-modifying functions
We do not always want to put the id directly into the reflog, but we
want to speicfy what a user typed. For this use-case we provide
annotated version of a few functions which let the caller specify what
user-friendly name was used when asking for the operation.
2015-03-16 16:57:30 +01:00
Jacques Germishuys
74c37c2a48 Added options to enable patience and minimal diff drivers 2015-03-16 09:53:27 +02:00
Jacques Germishuys
13de936316 Collapse whitespace flags into git_merge_file_flags_t 2015-03-16 09:53:27 +02:00
Jacques Germishuys
f29dde6828 Renamed git_merge_options 'flags' to 'tree_flags' 2015-03-16 09:53:27 +02:00
Jacques Germishuys
45a86bbfd0 Allow for merges with whitespace discrepancies 2015-03-16 09:53:27 +02:00
Carlos Martín Nieto
d675982a15 Merge pull request #2975 from git-up/diff_index_retain
Avoid retaining / releasing the index more than necessary when GIT_DIFF_...
2015-03-15 00:24:36 +01:00
Carlos Martín Nieto
7c63a33ffe indexer: bring back the error message on duplcate commits
It turns out that erroring out on duplicate commits is the right thing
to do, but git was not hitting the bug on the server-side.

Bring back a descriptive error message in case of duplicate entries and
error out.
2015-03-13 19:41:40 +01:00
Carlos Martín Nieto
dccf59ad38 indexer: don't worry about duplicate objects
If a packfile includes duplicate objects, we can choose to use the
secon copy instead of the first by using the same logic as if it were
the first.

Change the error condition from 0 to -1, which indicates a bad resize,
and set the OOM message in that case.

This does mean we will leak the first copy of the object. We can deal
with that later, but making fetches work is more important.
2015-03-13 18:28:07 +01:00
Carlos Martín Nieto
a34692c419 indexer: set an error message on duplicate objects in pack
While this is not even close to a fix, we can at least set an error
message so we know which error we are facing. Up to know we just
returned an error without a message.
2015-03-13 18:00:15 +01:00
Edward Thomson
12e1fff79d Merge pull request #2973 from libgit2/cmn/local-pack-threading
local: create pack with multiple threads
2015-03-12 18:04:25 -04:00
Patrick Steinhardt
e6903ea278 Fix git_submodule_sync writing URL to wrong key.
Currently git_submodule_sync writes the submodule's URL to the
key 'branch.<REMOTE_NAME>.remote' while the reference
implementation of `git submodule sync` writes to
'remote.<REMOTE_NAME>.url', which is the intended behavior
according to git-submodule(1).
2015-03-12 16:05:07 +01:00
Pierre-Olivier Latour
8a3934e49b Avoid retaining / releasing the index more than necessary when GIT_DIFF_UPDATE_INDEX is enabled 2015-03-11 19:29:36 -07:00
Pierre-Olivier Latour
1034f1b583 Fixed active refspecs not reset by git_remote_upload() 2015-03-11 11:51:12 -07:00
Pierre-Olivier Latour
e22ffb4209 Fixed update_tips callback called for failed pushed references
The current implementation does not set 'fire_callback' back to 0 for failed updates so the callback still fires.

Instead of adding yet another condition check to set 'fire_callback' to 0 if needed, considering this function should be a no-op for failed updates anyway, the best fix is to simplify its logic to check upfront if the update is a failed one.
2015-03-11 11:51:12 -07:00
Carlos Martín Nieto
15f581747c Merge commit 'refs/pull/2879/head' of ssh://github.com/libgit2/libgit2 2015-03-11 17:55:39 +01:00
Carlos Martín Nieto
0ef54a6358 local: create pack with multiple threads
The default behaviour for the packbuilder is to perform the work in a
single thread, which is fine for the public API, but we currently have
no way for a user to determine the number of threads to use when
creating the packfile, which makes our clone behaviour over the
filesystem quite a bit slower than what git offers.

This is a very particular scenario, in which we avoid spawning git by
being ourselves the server-side, so it's probably ok to auto-set the
threading, as the upload-pack process would do if we were talking to
git.
2015-03-11 17:24:14 +01:00
Carlos Martín Nieto
61ccba0d56 Merge pull request #2969 from adrienthebo/remote_add_invalid_refspec
refspec: report errors when parsing an invalid refspec
2015-03-11 16:13:31 +01:00
Carlos Martín Nieto
522df1cf1d Merge pull request #2970 from ethomson/inmemory_bare
"In-memory" repos are bare by default
2015-03-11 03:03:54 +01:00
Carlos Martín Nieto
e68b31a1a9 local: let the packbuilder perform smarter object insertion
Currently we use the most naïve and inefficient method for figuring out
which objects to send to the remote whereby we end up trying to insert
subdirs which have not changed multiple times.

Instead, make use of the packbuilder's built-in more efficient method
which uses the walk to feed the object list and avoids inserting an
object and its descendants.
2015-03-11 02:37:25 +01:00
Carlos Martín Nieto
04a36feff1 pack-objects: fill a packbuilder from a walk
Most use-cases for the object packer communicate in terms of commits
which each side has. We already have an object to specify this
relationship between commits, namely git_revwalk.

By knowing which commits we want to pack and which the other side
already has, we can perform similar optimisations to git, by marking
each tree as interesting or uninteresting only once, and not sending
those trees which we know the other side has.
2015-03-11 02:36:11 +01:00
Carlos Martín Nieto
b63b76e0b0 Reorder some khash declarations
Keep the definitions in the headers, while putting the declarations in
the C files. Putting the function definitions in headers causes
them to be duplicated if you include two headers with them.
2015-03-11 02:36:11 +01:00
Adrien Thebo
b523194d21 refspec: set err message on invalid refspec
If a refspec could not be parsed, the git_refspec__parse function would
return an error value but would not provide additional error information
for the callers. This commit amends that function to set a more useful
error message.
2015-03-10 13:31:26 -07:00
Edward Thomson
770aca94bd repository: in-memory repos are bare by default 2015-03-10 15:02:02 -04:00
Edward Thomson
d7c81945b0 Merge pull request #2964 from git-up/fixes
Fixes
2015-03-09 10:18:39 -04:00
Edward Thomson
959482e104 Merge pull request #2946 from tkelman/appveyor-mingw
RFC: add mingw to appveyor matrix
2015-03-09 09:18:37 -04:00
Pierre-Olivier Latour
2461e0d20f Removed unnecessary GIT_CHECKOUT_SKIP_UNMERGED for GIT_RESET_HARD 2015-03-08 14:10:02 -07:00
Carlos Martín Nieto
d578b45f3f refdb: use the same id for old and new when renaming a reference
When we rename a reference, we want the old and new ids to be the same
one (as we did not change it). The normal code path looks up the old id
from the current value of the brtanch, but by the time we look it up, it
does not exist anymore and thus we write a zero id.

Pass the old id explicitly instead.
2015-03-08 16:50:27 +01:00
Edward Thomson
01c3b184d3 Merge pull request #2961 from ethomson/filter_relative_paths
Filter relative paths
2015-03-06 16:52:07 -05:00
Edward Thomson
6a2edc5a11 filter: accept relative paths in apply_to_file 2015-03-06 15:16:40 -05:00
Matti Virolainen
78c34af016 Use secure API if available. 2015-03-06 12:07:54 -08:00
Tony Kelman
04c5a9c083 Add some missing definitions for mingw.org
these shouldn't be necessary if _WIN32_WINNT >= _WIN32_WINNT_VISTA
2015-03-06 12:07:05 -08:00
Tony Kelman
1a7ea63d22 Move definitions of strcasecmp and strncasecmp to msvc-compat.h
should cut down on compiler warnings with mingw
2015-03-06 12:07:05 -08:00
Edward Thomson
9a823badbf filter: drop old TODO 2015-03-06 14:37:41 -05:00
nulltoken
05e644dd7e Drop trailing whitespaces 2015-03-04 22:09:51 +01:00
nulltoken
7eb7673406 branch: fix generated reflog message upon renaming 2015-03-04 22:09:49 +01:00
nulltoken
015d4b7b38 branch: fix generated reflog message upon creation 2015-03-04 22:09:44 +01:00
Carlos Martín Nieto
bdf0e73450 Merge pull request #2932 from jeffhostetler/jeffhostetler/big_clone_crash
Fix crash in git_clone on extremely large repos
2015-03-04 14:55:56 +01:00
Edward Thomson
8e851c1e8c libgit2_shutdown: free TLS data (win32)
Free TLS data on thread exit (win32)
2015-03-04 14:48:46 +01:00
Edward Thomson
83fe60fa1b libgit2_shutdown: clear err message on shutdown
Clear the error message on git_libgit2_shutdown for all versions of
the library (no threads and Win32 threads).  Drop the giterr_clear
in clar, as that shouldn't be necessary.
2015-03-04 14:48:46 +01:00
Leo Yang
3a8b69d13d Fix leak of TLS error message in shutdown (ptherad version) 2015-03-04 14:47:57 +01:00
Carlos Martín Nieto
c69c042e0e Merge pull request #2945 from ethomson/empty_hashsig_heap
diff_tform: don't compare empty hashsig_heaps
2015-03-04 12:47:59 +01:00
Edward Thomson
f78d9b6cfe diff_tform: account for whitespace options
When comparing seemingly blank files, take whitespace options into
account.
2015-03-04 00:01:34 -05:00
Carlos Martín Nieto
fe21d708b0 Plug a few leaks 2015-03-04 00:29:37 +01:00
Edward Thomson
a212716fc3 diff_tform: don't compare empty hashsig_heaps
Don't try to compare two empty hashsig_heaps.
2015-03-03 18:19:42 -05:00
Edward Thomson
9ce97782b4 Merge pull request #2941 from libgit2/cmn/http-enforce-cred
http: enforce the credential types
2015-03-03 17:59:44 -05:00
Jeff Hostetler
d8be508777 Change ifdef for MINGW32. 2015-03-03 13:35:10 -05:00
Carlos Martín Nieto
9a97f49e3a config: borrow refcounted references
This changes the get_entry() method to return a refcounted version of
the config entry, which you have to free when you're done.

This allows us to avoid freeing the memory in which the entry is stored
on a refresh, which may happen at any time for a live config.

For this reason, get_string() has been forbidden on live configs and a
new function get_string_buf() has been added, which stores the string in
a git_buf which the user then owns.

The functions which parse the string value takea advantage of the
borrowing to parse safely and then release the entry.
2015-03-03 18:35:12 +01:00
Carlos Martín Nieto
e892b6a927 http: enforce the credential types
The user may decide to return any type of credential, including ones we
did not say we support. Add a check to make sure the user returned an
object of the right type and error out if not.
2015-03-03 18:07:16 +01:00
Carlos Martín Nieto
76f034180a Remove swp files 2015-03-03 17:04:38 +01:00
Edward Thomson
20273e4d3c Merge pull request #2934 from akikoskinen/mingw_build_fix
Fix build on mingw (master branch)
2015-03-03 10:08:51 -05:00
Edward Thomson
018fdbb580 Merge pull request #2913 from ethomson/stash_fixup
stash: correctly stash wd modified/index deleted
2015-03-03 10:08:28 -05:00
Jeff Hostetler
7e9b21aa2a Fix p_ftruncate to handle big files for git_clone 2015-03-03 08:47:44 -05:00
Carlos Martín Nieto
4e498646b6 repository: remove log message override for switching the active branch
We want to use the "checkout: moving from ..." message in order to let
git know when a change of branch has happened. Make the convenience
functions for this goal write this message.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
412a380888 push: remove reflog message override
We always use "update by push".
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
6bfb990dc7 branch: don't accept a reflog message override
This namespace is about behaving like git's branch command, so let's do
exactly that instead of taking a reflog message.

This override is still available via the reference namespace.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
23a17803b6 reset: remove reflog message override
This function is meant to simulate what git does in the reset command,
so we should include the reflog message in that.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
659cf2029f Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.

In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
99b68a2aec Merge pull request #2908 from ethomson/safe_create
Allow checkout to handle newly cloned repositories, remove `GIT_CHECKOUT_SAFE_CREATE`
2015-03-03 13:47:13 +01:00
Carlos Martín Nieto
31bc6c0440 branch: do capture the error code
We want to ignore GIT_ENOTFOUND, but for that we need to capture the
error code from the reflog deletion.
2015-03-03 13:25:40 +01:00
Carlos Martín Nieto
5ac2b7cb2a Merge pull request #2937 from git-up/branch_delete_reflog
git_branch_delete() should ignore errors from non-existing reflogs
2015-03-03 13:03:54 +01:00
Pierre-Olivier Latour
7986391719 git_branch_delete() should ignore errors from non-existing reflogs 2015-03-02 10:24:54 -08:00
Edward Thomson
bf1476f190 win32: add the patch level to the .dll fileversion
Win32 DLLs have four fields for the version number (major, minor,
teeny, patch).  If a consumer wants to build a custom DLL, it may
be useful to set the patchlevel version number in the DLL.

This value only affects the DLL version number, it does not affect
the resultant "version number", which remains major.minor.teeny.
2015-03-02 10:35:26 -05:00
Aki Koskinen
45df2237bf Include ws2tcpip.h in order to get in6_addr
It's currently required in src/openssl_stream.c only.
2015-03-02 11:15:32 +02:00
Aki Koskinen
ec03244227 Include openssl headers last
Windows headers #define some names that openssl uses too. Openssl
headers #undef the offending names before reusing them. But if those
offending Windows headers get included after the openssl headers the
namespace is polluted and nothing good happens.

Fixes issue #2850.
2015-03-02 11:15:13 +02:00
Aki Koskinen
a944c6cc40 Don't include headers on windows that aren't available
This mainly concerns mingw build.
2015-03-02 11:14:07 +02:00
Edward Thomson
96b82b11c6 checkout: remove GIT_CHECKOUT_SAFE_CREATE as a strategy 2015-02-27 13:50:44 -05:00
Edward Thomson
e6da3e4496 checkout: upgrade to SAFE_CREATE when no index file
When the repository does not contain an index, emulate git's behavior
and upgrade to `SAFE_CREATE`.  This allows us to check out repositories
created with `git clone --no-checkout`.
2015-02-27 13:50:32 -05:00
Edward Thomson
094cfc2904 cherrypick, revert: drop unnecessary SAFE_CREATE 2015-02-27 13:47:30 -05:00
Edward Thomson
3cbaa5872c rebase: check alloc result 2015-02-27 04:39:54 +00:00
Edward Thomson
4196dd8e8f repository: Introduce "reserved names"
A repository can have multiple "reserved names" now, not just
a single "short name" for the repository folder itself.  Refactor
to include a git_repository__reserved_names that returns all the
reserved names for a repository.
2015-02-27 04:36:47 +00:00
Damien PROFETA
a275fbc0f7 Add API to add a memory buffer to an index
git_index_add_frombuffer enables now to store a memory buffer in the odb
and to store an entry in the index directly if the index is attached to a
repository.
2015-02-25 10:24:13 +01:00
Jeff Hostetler
c92987d157 Fix MAX 32 bit build problem described in libgit2/libgit2#2917 2015-02-20 18:59:43 +01:00
Carlos Martín Nieto
5091aff782 Merge pull request #2907 from jasonhaslam/git_packfile_unpack_race
Fix race in git_packfile_unpack.
2015-02-20 08:40:40 +01:00
Edward Thomson
9c9aa1bad3 filter: take temp_buf in git_filter_options 2015-02-19 11:45:46 -05:00
Edward Thomson
d05218b06f filter: add git_filter_list__load_ext
Refactor `git_filter_list__load_with_attr_reader` into
`git_filter_list__load_ext`, which takes a `git_filter_options`.
2015-02-19 11:25:26 -05:00
Edward Thomson
795eaccd66 git_filter_opt_t -> git_filter_flag_t
For consistency with the rest of the library, where an opt is an
options *structure*.
2015-02-19 11:09:54 -05:00
Edward Thomson
d4cf167515 buffer: introduce git_buf_attach_notowned
Provide a convenience function that creates a buffer that can be provided
to callers but will not be freed via `git_buf_free`, so the buffer
creator maintains the allocation lifecycle of the buffer's contents.
2015-02-19 10:05:33 -05:00