Commit Graph

5238 Commits

Author SHA1 Message Date
Carlos Martín Nieto
13da562a87 Merge pull request #2785 from jacquesg/coverity
Coverity fixes
2014-12-30 16:48:52 +00:00
Jacques Germishuys
dfda1cf507 Check for OOM 2014-12-30 12:33:40 +02:00
Jacques Germishuys
0beb7fe427 Added missing error handling path 2014-12-30 12:33:40 +02:00
Jacques Germishuys
3dbd9a0e86 Check the result of git_buf_joinpath 2014-12-30 12:33:39 +02:00
Edward Thomson
4ceb388b13 Merge pull request #2784 from jacquesg/undef-stat
Undef stat for Mingw
2014-12-29 14:22:36 -06:00
Jacques Germishuys
6f73e02605 Plug some leaks 2014-12-29 18:18:49 +02:00
Jacques Germishuys
a1daec3c53 Undef stat first 2014-12-29 18:11:33 +02:00
Edward Thomson
ddf9532498 Merge pull request #2783 from libgit2/cmn/treebuilder-new
treebuilder: rename _create() to _new()
2014-12-29 09:30:05 -06:00
Sebastian Bauer
7cf86f923a Added AmigaOS-specific implementation of git__timer().
The clock_gettime() function is normally not available under
AmigaOS, hence another solution is required. We are using now
GetUpTime() that is present in current versions of this
operating system.
2014-12-28 10:35:47 +01:00
Carlos Martín Nieto
208a2c8aef treebuilder: rename _create() to _new()
This function is a constructor, so let's name it like one and leave
_create() for the reference functions, which do create/write the
reference.
2014-12-27 12:09:11 +00:00
Carlos Martín Nieto
5692dcf181 Merge pull request #2772 from ethomson/case_changing_rename
Case changing rename
2014-12-24 06:24:42 +00:00
Carlos Martín Nieto
171c2ff121 Merge pull request #2778 from ethomson/whitespace_85
don't treat 0x85 as whitespace
2014-12-24 06:23:36 +00:00
Edward Thomson
73f0278e5d global: include sys/openssl.h for GIT_EXPORT of fn
The openssl setup function needs to be GIT_EXPORT'ed, be sure
to include the `sys/openssl.h` header so that it is appropriately
decorated as an export function.
2014-12-23 16:40:01 -06:00
Edward Thomson
fe5f7722f5 don't treat 0x85 as whitespace
A byte value of 0x85 is not whitespace, we were conflating that with
U+0085 (UTF8: 0xc2 0x85).  This caused us to incorrectly treat valid
multibyte characters like U+88C5 (UTF8: 0xe8 0xa3 0x85) as whitespace.
2014-12-23 11:27:01 -06:00
Edward Thomson
40d791545a Always checkout with case sensitive iterator
On a case-insensitive filesystem, we need to deal with case-changing
renames (eg, foo -> FOO) by removing the old and adding the new,
exactly as if we were on a case-sensitive filesystem.

Update the `checkout::tree::can_cancel_checkout_from_notify` test, now
that notifications are always sent case sensitively.
2014-12-23 10:14:04 -06:00
Edward Thomson
2fe8157e1b index: reuc and name entrycounts should be size_t
For the REUC and NAME entries, we use size_t internally, and we take
size_t for the get_byindex() functions, but the entrycount() functions
strangely cast to an unsigned int instead.
2014-12-22 18:42:03 -06:00
Jameson Miller
9d1f97df10 Introduce a convenience function for submodule update
This introduces the functionality of submodule update in
'git_submodule_do_update'. The existing 'git_submodule_update' function is
renamed to 'git_submodule_update_strategy'. The 'git_submodule_update'
function now refers to functionality similar to `git submodule update`,
while `git_submodule_update_strategy` is used to get the configured value
of submodule.<name>.update.
2014-12-22 16:37:35 -05:00
Jameson Miller
b2ab887e11 submodule init should resolve relative url paths
Submodule init should handle relative paths in .gitmodules files
and resolve these urls when updating the git config file.
2014-12-22 16:35:45 -05:00
Edward Thomson
d147900ea4 Merge pull request #2759 from libgit2/cmn/openssl-sys
Make OpenSSL locking warnings more severe
2014-12-20 21:24:45 -06:00
Edward Thomson
c7d9839f54 Merge pull request #2763 from libgit2/cmn/local-proto-progress
Show progress output on fetch for the local transport
2014-12-20 21:22:30 -06:00
Linquize
6fd00266a8 COM0 is a valid path, although Windows Explorer does not allow to create this 2014-12-19 23:54:01 +08:00
Carlos Martín Nieto
629417bd10 Fix ming32 compilation
We need to know what wchar_t and MAX_PATH are. Including common.h takes
care of that for us.
2014-12-19 08:08:47 +00:00
Edward Thomson
dce7b1a4e7 treebuilder: take a repository for path validation
Path validation may be influenced by `core.protectHFS` and
`core.protectNTFS` configuration settings, thus treebuilders
can take a repository to influence their configuration.
2014-12-17 13:05:27 -05:00
Edward Thomson
ec74b40cee Introduce core.protectHFS and core.protectNTFS
Validate HFS ignored char ".git" paths when `core.protectHFS` is
specified.  Validate NTFS invalid ".git" paths when `core.protectNTFS`
is specified.
2014-12-17 12:52:07 -05:00
Vicent Marti
8e35527de2 path: Use UTF8 iteration for HFS chars 2014-12-16 10:24:18 -06:00
Edward Thomson
11d67b754d checkout: disallow bad paths on HFS
HFS filesystems ignore some characters like U+200C.  When these
characters are included in a path, they will be ignored for the
purposes of comparison with other paths.  Thus, if you have a ".git"
folder, a folder of ".git<U+200C>" will also match.  Protect our
".git" folder by ensuring that ".git<U+200C>" and friends do not match it.
2014-12-16 10:08:59 -06:00
Edward Thomson
ee5da720e5 reference_create: validate loose names
Validate loose reference names on Win32.
2014-12-16 10:08:56 -06:00
Edward Thomson
a64119e396 checkout: disallow bad paths on win32
Disallow:
 1. paths with trailing dot
 2. paths with trailing space
 3. paths with trailing colon
 4. paths that are 8.3 short names of .git folders ("GIT~1")
 5. paths that are reserved path names (COM1, LPT1, etc).
 6. paths with reserved DOS characters (colons, asterisks, etc)

These paths would (without \\?\ syntax) be elided to other paths - for
example, ".git." would be written as ".git".  As a result, writing these
paths literally (using \\?\ syntax) makes them hard to operate with from
the shell, Windows Explorer or other tools.  Disallow these.
2014-12-16 10:08:53 -06:00
Vicent Marti
0d388adc86 index: Check for valid paths before creating an index entry 2014-12-16 10:08:49 -06:00
Vicent Marti
62155257d2 tree: Check for .git with case insensitivy 2014-12-16 10:08:46 -06:00
Edward Thomson
cceae9a25d win32: use NT-prefixed "\\?\" paths
When turning UTF-8 paths into UCS-2 paths for Windows, always use
the \\?\-prefixed paths.  Because this bypasses the system's
path canonicalization, handle the canonicalization functions ourselves.

We must:
 1. always use a backslash as a directory separator
 2. only use a single backslash between directories
 3. not rely on the system to translate "." and ".." in paths
 4. remove trailing backslashes, except at the drive root (C:\)
2014-12-16 10:08:43 -06:00
Carlos Martín Nieto
4fd2bda9ff local: send 'counting objects' output
Pretend we have a git process at the other end by creating a similar
progress output when inserting objects into the packbuilder.
2014-12-16 10:25:45 +01:00
Carlos Martín Nieto
26186b155b fetch: remove the prune setter
This option does not get persisted to disk, which makes it different
from the rest of the setters. Remove it until we go all the way.

We still respect the configuration option, and it's still possible to
perform a one-time prune by calling the function.
2014-12-14 21:52:27 +01:00
Carlos Martín Nieto
59ff8b6790 fetch: perform prune in separate steps
For each remote-tracking branch we want to remove, we need to consider
it against every other refspec in case we have overlapping refspecs,
such as with

    refs/heads/*:refs/remotes/origin/*
    refs/pull/*/head:refs/remotes/origin/pr/*

as we'd otherwise remove too many refspecs.

Create a list of condidates, which are the references matching the rhs
of any active refspec and then filter that list by removing those
entries for which we find a remove reference with any active
refspec. Those which are left after this are removed.
2014-12-14 21:25:08 +01:00
Carlos Martín Nieto
8c13eaedbb fetch: prune after updating tips
This makes a fetch+prune more similar to a connect+prune and makes it
more likely that we see errors in the decision to prune a reference.
2014-12-14 17:04:02 +01:00
David Calavera
439e19f632 Test that prune overlapping works as expected. 2014-12-14 17:04:01 +01:00
Linquize
5f47394753 remote: prune refs when fetching 2014-12-14 17:04:01 +01:00
Carlos Martín Nieto
263b1d6ed9 Make the OpenSSL locking function warnings more severe
Our git_openssl_set_locking() would ideally not exist. Make it clearer
that we provide it as a last resort and you should prefer anything else.
2014-12-12 15:46:57 +01:00
Carlos Martín Nieto
d524b2d3d1 push: fold unpack_ok() into finish()
The push cannot be successful if we sent a bad packfile. We should
return an error in that case instead of storing it elsewhere.
2014-12-10 18:55:54 +01:00
Edward Thomson
cd305c2f56 Merge pull request #2678 from libgit2/cmn/io-stream
Introduce stackable IO streams
2014-12-10 11:30:28 -05:00
Carlos Martín Nieto
a2fd56ab18 Fix a couple of compiler warnings 2014-12-10 16:22:50 +01:00
Carlos Martín Nieto
49ae22baac stream: constify the write buffer 2014-12-10 16:20:52 +01:00
Carlos Martín Nieto
1b75c29e3e gitno: remove code which is no longer needed
Most of the network-facing facilities have been copied to the socket and
openssl streams. No code now uses these functions directly anymore, so
we can now remove them.
2014-12-10 01:39:09 +01:00
Carlos Martín Nieto
4fd4341fe5 ssh: use socket_stream to perform the connection
Having an ssh stream would require extra work for stream capabilities we
don't need anywhere else (oob auth and command execution) so for now
let's move away from the gitno connection to use socket_stream.

We can introduce an ssh stream interface if and as we need it.
2014-12-10 01:39:09 +01:00
Carlos Martín Nieto
b6f5464e28 Port HTTP(S) to the new stream API 2014-12-10 01:39:09 +01:00
Carlos Martín Nieto
02b4c1e2a4 Port the TCP transport to the new stream API 2014-12-10 01:39:09 +01:00
Carlos Martín Nieto
468d7b11f9 Add an OpenSSL IO stream
This unfortunately isn't as stackable as could be possible, as it
hard-codes the socket stream. This is because the method of using a
custom openssl BIO is not clear, and we do not need this for now. We can
still bring this in if and as we need it.
2014-12-10 01:17:41 +01:00
Carlos Martín Nieto
dd4ff2c9b5 Introduce stackable IO streams
We currently have gitno for talking over TCP, but this needs to know
about both plaintext and OpenSSL connections and the code has gotten
somewhat messy with ifdefs determining which version of the function
should be called.

In order to clean this up and abstract away the details of sending over
the different types of streams, we can instead use an interface and
stack stream implementations.

We may not be able to use the stackability with all streams, but we
are definitely be able to use the abstraction which is currently spread
between different bits of gitno.
2014-12-10 01:17:40 +01:00
Edward Thomson
ad2bf40a9d winhttp: plug some leaks 2014-12-09 12:04:55 -05:00
Edward Thomson
c251f3bbe7 win32: remember to cleanup our hash_ctx 2014-12-09 12:04:47 -05:00
Edward Thomson
19ae843937 Merge pull request #2746 from libgit2/cmn/neg-ignore-dir
Fix negative ignores withing ignored dirs
2014-12-06 20:17:16 -05:00
Edward Thomson
013924c17c Merge pull request #2730 from libgit2/cmn/local-push
Adjust the local transport for the common refspec parser
2014-12-05 23:44:34 -05:00
Carlos Martín Nieto
21083a7129 notes: move the notes name argument
Make it consistent between git_note_create() and git_note_remote() by
putting it after the repository.
2014-12-06 04:20:09 +01:00
Carlos Martín Nieto
e05b2ff127 ignore: match git's rule negation rules
A rule can only negate something which was explicitly mentioned in the
rules before it. Change our parsing to ignore a negative rule which does
not negate something mentioned in the rules above it.

While here, fix a wrong allocator usage. The memory for the match string
comes from pool allocator. We must not free it with the general
allocator. We can instead simply forget the string and it will be
cleaned up.
2014-12-05 20:13:24 +01:00
nulltoken
30ec05260d Merge pull request #2744 from epmatsw/spelling
Spelling fixes
2014-12-05 07:44:09 +01:00
Carlos Martín Nieto
e79fbd9e8a Merge pull request #2743 from ethomson/init_val
init: return the number of initializations
2014-12-05 07:09:08 +01:00
Will Stamper
b874629b2d Spelling fixes 2014-12-04 21:06:59 -06:00
Edward Thomson
6d91dc5351 init: return the number of initializations 2014-12-04 20:42:27 -05:00
Carlos Martín Nieto
8bfbe6988f Merge pull request #2742 from stewid/add_missing_else_directive
Add missing else directive
2014-12-03 21:54:44 +01:00
Stefan Widgren
2d2cd625ea Add missing else directive
Add missing else directive to fix compiler warning: control reaches
end of non-void function
2014-12-03 21:01:42 +01:00
Edward Thomson
70d21742bf win32: clear connection data on close 2014-12-03 00:41:46 -05:00
Edward Thomson
32e2b758cf describe: check error codes 2014-11-29 15:57:35 -05:00
Edward Thomson
e952bc5a57 Merge pull request #2718 from libgit2/cmn/peeling-errors
peel: reject bad queries with EPEEL
2014-11-23 17:15:18 -05:00
Carlos Martín Nieto
d5c84f67d3 local: adjust to the common refspec parser
We no longer have NULL strings, but empty ones and duplicate the sides
if necessar, so the first check will never do anything.

While in the area, remove unnecessary ifs and early returns.
2014-11-23 21:34:45 +01:00
Carlos Martín Nieto
52ee0e8e6d remote: verify there is a push foreach callback set 2014-11-23 21:26:53 +01:00
Carlos Martín Nieto
f7fcb18f8a Plug leaks
Valgrind is now clean except for libssl and libgcrypt.
2014-11-23 15:51:31 +01:00
Carlos Martín Nieto
753e17b0f5 peel: reject bad queries with EINVALIDSPEC
There are some combination of objects and target types which we know
cannot be fulfilled. Return EINVALIDSPEC for those to signify that there
is a mismatch in the user-provided data and what the object model is
capable of satisfying.

If we start at a tag and in the course of peeling find out that we
cannot reach a particular type, we return EPEEL.
2014-11-22 18:55:22 +01:00
Carlos Martín Nieto
e06b1040d7 Merge pull request #2723 from ravindp/ravindp/fix_4_missing_delta_bases
Fix for misleading "missing delta bases" error.
2014-11-22 18:39:50 +01:00
Ravindra Patel
ec7e680c6c Fix for misleading "missing delta bases" error - Fix #2721. 2014-11-21 15:05:34 -05:00
Vicent Marti
24cce2398f text: Null-terminate a string if we've been gouging it 2014-11-21 18:09:57 +01:00
Vicent Marti
b7fb71e39c notes: Use git__strndup 2014-11-21 17:38:55 +01:00
Vicent Marti
1ba48b7caf notes: Do not assume blob contents are NULL-terminated 2014-11-21 17:21:34 +01:00
Vicent Marti
72d0024134 attr_file: Do not assume ODB data is NULL-terminated
That's a bad assumption to make, even though right now it holds
(because of the way we've implemented decompression of packfiles),
this may change in the future, given that ODB objects can be
binary data.

Furthermore, the ODB object can return a NULL pointer if the object
is empty. Copying the NULL pointer to the strbuf lets us handle it
like an empty string. Again, the NULL pointer is valid behavior because
you're supposed to check the *size* of the object before working
on it.
2014-11-21 17:21:34 +01:00
Vicent Marti
92e0b67930 buffer: Do not put anything if len is 0 2014-11-21 17:21:33 +01:00
Carlos Martín Nieto
deadc43e1d Merge pull request #2720 from ravindp/master
Fix for memory leak issue in indexer.c, that surfaces on windows
2014-11-21 15:21:00 +01:00
Vicent Marti
e015665142 odb: git_odb_object contents are never NULL
This is a contract that we made in the library and that we need to uphold. The
contents of a blob can never be NULL because several parts of the library (including
the filter and attributes code) expect `git_blob_rawcontent` to always return a
valid pointer.
2014-11-21 14:09:53 +01:00
Vicent Marti
fc6ac074ee Merge pull request #2713 from libgit2/jamill/push_fetch_first
Update message for error during push
2014-11-20 13:13:46 +01:00
Vicent Marti
fd10b110de Merge pull request #2717 from libgit2/cmn/remote-ls
Clarify the git_remote_ls() documentation
2014-11-20 13:12:49 +01:00
Carlos Martín Nieto
1ca61bdcb9 fetch: clear the connection data on close
When we fetch twice with the same remote object, we did not properly
clear the connection flags, so we would leak state from the last
connection.

This can cause the second fetch with the same remote object to fail if
using a HTTP URL where the server redirects to HTTPS, as the second
fetch would see `use_ssl` set and think the initial connection wanted to
downgrade the connection.
2014-11-19 20:57:15 +01:00
Ravindra Patel
7561f98d6d Fix for memory leak issue in indexer.c, that surfaces on windows 2014-11-19 14:54:30 -05:00
Carlos Martín Nieto
699dfcc3bc remote: clarify which list of references _ls() returns
Make it clear that this is not the ls-remote command but a way to access
the data we have and how long it's kept around.
2014-11-19 15:49:02 +01:00
Edward Thomson
45301cca30 Merge pull request #2608 from libgit2/cmn/remote-push
Provide a convenience function `git_remote_push()`
2014-11-18 11:44:59 -05:00
Edward Thomson
8b5b814e55 Merge pull request #2671 from swisspol/remote_create_fix
Fixed active_refspecs field not initialized on new git_remote objects
2014-11-17 20:10:58 -05:00
Edward Thomson
7f1b73b7c8 Merge pull request #2693 from libgit2/cmn/push-refspec-refactor
push: use the common refspec parser
2014-11-17 17:03:55 -05:00
Edward Thomson
a4221ccb09 Merge pull request #2699 from swisspol/fix_warnings
Fixed a couple Clang warnings
2014-11-17 16:36:54 -05:00
Jameson Miller
a03f6caf5c Update message for error during push
When attempting to update a reference on a remote during push, and the
reference on the remote refers to a commit that does not exist locally,
then we should report a more clear error message.
2014-11-17 16:30:31 -05:00
Pierre-Olivier Latour
d3cd7da51f Fixed active_refspecs field not initialized on new git_remote objects
When creating a new remote, contrary to loading one from disk,
active_refspecs was not populated. This means that if using the new
remote to push, git_push_update_tips() will be a no-op since it
checks the refspecs passed during the push against the base ones
i.e. active_refspecs. And therefore the local refs won't be created
or updated after the push operation.
2014-11-17 22:46:22 +09:00
Carlos Martín Nieto
5915d7001b branch: consider an empty upstream remote config as not found 2014-11-17 14:28:22 +01:00
Ungureanu Marius
d6ecc31140 Plug possible leak in the openssl locks 2014-11-17 14:03:15 +01:00
Pierre-Olivier Latour
692c040843 Fixed a couple Clang warnings 2014-11-10 08:18:48 +09:00
Carlos Martín Nieto
aad638f3a1 push: use the common refspec parser
There is one well-known and well-tested parser which we should use,
instead of implementing parsing a second time.

The common parser is also augmented to copy the LHS into the RHS if the
latter is empty.

The expressions test had to change a bit, as we now catch a bad RHS of a
refspec locally.
2014-11-09 16:07:43 +01:00
Carlos Martín Nieto
64e3e6d43a remote: use configured push refspecs if none are given
If the user does not pass any refspecs to push, try to use those
configured via the configuration or via add_push().
2014-11-09 00:01:58 +01:00
Carlos Martín Nieto
3149547b5a remote: introduce git_remote_push()
This function, similar in style to git_remote_fetch(), performs all the
steps required for a push, with a similar interface.

The remote callbacks struct has learnt about the push callbacks, letting
us set the callbacks a single time instead of setting some in the remote
and some in the push operation.
2014-11-09 00:01:58 +01:00
Carlos Martín Nieto
799e22ea0c Rename git_threads_ to git_libgit2_
This describes their purpose better, as we now initialize ssl and some
other global stuff in there. Calling the init function is not something
which has been optional for a while now.
2014-11-08 23:46:39 +01:00
Pierre-Olivier Latour
e284c451b0 Changed GIT_REMOTE_DOWNLOAD_TAGS_ALL to behave like git 1.9.0 2014-11-09 07:27:30 +09:00
Edward Thomson
02bc523304 Merge pull request #2698 from libgit2/cmn/fetchhead-refactor
Refactor fetchhead
2014-11-08 17:05:13 -05:00
Edward Thomson
bc8c4a8aeb Merge pull request #2695 from libgit2/cmn/remote-lookup
remote: rename _load() to _lookup()
2014-11-08 16:55:23 -05:00
Edward Thomson
e3bd48a793 Merge pull request #2696 from libgit2/cmn/empty-objects
odb: hardcode the empty blob and tree
2014-11-08 16:52:43 -05:00
Carlos Martín Nieto
2c9b9c8bb4 remote: refactor the reference-update decision
This is an ugly chunk of code, so let's put it into its own function.
2014-11-08 21:02:19 +01:00
Carlos Martín Nieto
e1ac010148 odb: hardcode the empty blob and tree
git hardocodes these as objects which exist regardless of whether they
are in the odb and uses them in the shell interface as a way of
expressing the lack of a blob or tree for one side of e.g. a diff.

In the library we use each language's natural way of declaring a lack of
value which makes a workaround like this unnecessary. Since git uses it,
it does however mean each shell application would need to perform this
check themselves.

This makes it common work across a range of applications and an issue
with compatibility with git, which fits right into what the library aims
to provide.

Thus we introduce the hard-coded empty blob and tree in the odb
frontend. These hard-coded objects are checked for before going to the
backends, but after the cache check, which means the second time they're
used, they will be treated as normal cached objects instead of creating
new ones.
2014-11-08 20:53:38 +01:00
Carlos Martín Nieto
64fdd86d0e remote: don't check for upstream on an anonymous remote
If the remote is anonymous, then we cannot check for any configuration,
as there is no name. Check for this before we try to use the name, which
may be a NULL pointer.

This fixes #2697.
2014-11-08 20:21:14 +01:00
Carlos Martín Nieto
e235db0212 remote: use git_branch_upstream_remote()
This reduces the clutter somewhat and lets us see what we're asking
about the reference.
2014-11-08 20:09:11 +01:00
Carlos Martín Nieto
82374d9825 branch: add getter for the upstream remote name
This gets the value from branch.<foo>.remote.
2014-11-08 20:00:17 +01:00
Carlos Martín Nieto
209425ce26 remote: rename _load() to _lookup()
This brings it in line with the rest of the lookup functions.
2014-11-08 13:28:27 +01:00
Ungureanu Marius
6818208569 git_status_file now takes an exact path
This function has one output but can match multiple files, which can be
unexpected for the user, which would usually path the exact path of the
file he wants the status of.
2014-11-07 21:34:54 +02:00
Carlos Martín Nieto
62a617dc68 iterator: submodules are determined by an index or tree
We cannot know from looking at .gitmodules whether a directory is a
submodule or not. We need the index or tree we are comparing against to
tell us. Otherwise we have to assume the entry in .gitmodules is stale
or otherwise invalid.

Thus we pass the index of the repository into the workdir iterator, even
if we do not want to compare against it. This follows what git does,
which even for `git diff <tree>`, it will consider staged submodules as
such.
2014-11-07 08:33:27 +01:00
Edward Thomson
2d24816b46 checkout_index: Remove stage 0 when checking out conflicts 2014-11-06 18:50:10 -05:00
Edward Thomson
9f664347ff checkout_index: remove conflicts when checking out new files 2014-11-06 18:49:57 -05:00
Edward Thomson
64dc248577 Merge pull request #2598 from libgit2/cmn/stacked-ignore
ignore: don't leak rules into higher directores
2014-11-06 10:38:25 -05:00
Edward Thomson
7bb639911b Merge pull request #2676 from libgit2/cmn/threading
Threading and crypto libraries
2014-11-06 10:25:23 -05:00
Edward Thomson
f890a84fe0 Merge pull request #2682 from libgit2/cmn/fetch-tags-refspec
remote: check for the validity of the refspec when updating FETCH_HEAD
2014-11-06 10:19:22 -05:00
Carlos Martín Nieto
6069042fcb ignore: don't leak rules into higher directories
A rule "src" in src/.gitignore must only match subdirectories of
src/. The current code does not include this context in the match rule
and would thus consider this rule to match the top-level src/ directory
instead of the intended src/src/.

Keep track fo the context in which the rule was defined so we can
perform a prefix match.
2014-11-06 10:10:26 +01:00
Edward Thomson
b4e5432ff0 Merge pull request #2688 from libgit2/cmn/ignore-file-trailing-cr
ignore: consider files with a CR in their names
2014-11-05 10:47:19 -05:00
Carlos Martín Nieto
5c54e2162a ignore: consider files with a CR in their names
We currently consider CR to start the end of the line, but that means
that we miss cases with CR CR LF which can be used with git to match
files whose names have CR at the end of their names.

The fix from the patch comes from Russell's comment in the issue.

This fixes #2536.
2014-11-05 16:22:01 +01:00
Edward Thomson
cce27d8242 git_remote_rename: propogate GIT_ENOTFOUND 2014-11-03 14:10:31 -05:00
Edward Thomson
de0c4555da Merge pull request #2679 from jfultz/missing-include
Make config reading continue after hitting a missing include file.
2014-11-03 11:32:47 -05:00
Carlos Martín Nieto
6d20006f7e remote: check the relevance of the refspec when updating FETCH_HEAD
Before trying to rtransform using the given refspec to figure out what
the name of the upstream branch is on the remote, we must make sure that
the target of the refspec applies to the current branch's upstream.
2014-11-03 15:12:32 +01:00
Edward Thomson
0a62918188 Merge pull request #2661 from swisspol/2656
Changed context_lines and interhunk_lines to uint32_t to match struct s_xdemitconf
2014-11-03 15:10:14 +01:00
Edward Thomson
4bb8708730 Merge pull request #2683 from libgit2/cmn/remote-unify
remote: unify the creation code
2014-11-03 15:01:41 +01:00
Edward Thomson
873eb899e4 Merge pull request #2680 from libgit2/cmn/invalid-cert-return
netops: return GIT_ECERTIFICATE when it fails the basic tests
2014-11-03 14:57:39 +01:00
Edward Thomson
0fab748e91 Merge pull request #2685 from libgit2/cmn/mmap-readable
Fix segmentation fault observed on OpenBSD/sparc64
2014-11-03 14:52:34 +01:00
Stefan Sperling
aad0bd6bc7 Fix segmentation fault observed on OpenBSD/sparc64
A non-readable mapping of a file causes an access violation in
the pack tests. Always use PROT_READ to work around this.
2014-11-03 13:49:04 +01:00
Jacques Germishuys
bc48bcdcb3 Make the Visual Studio compiler happy 2014-11-03 14:23:13 +02:00
John Fultz
ebc13b2b7c Clean up issues include.path issues found during code review.
* Error-handling is cleaned up to only let a file-not-found error
  through, not other sorts of errors.  And when a file-not-found
  error happens, we clean up the error.
* Test now checks that file-not-found introduces no error.  And
  other minor cleanups.
2014-11-02 19:16:49 -06:00
Carlos Martín Nieto
a68e217f5c remote: unify the creation code
The create function with default refspec is the same as the one with a
custom refspec, but it has the default refspec, so we can create the one
on top of the other.
2014-11-02 21:58:39 +01:00
Carlos Martín Nieto
22fbb2656e netops: return GIT_ECERTIFICATE when it fails the basic tests
When we first ask OpenSSL to verify the certfiicate itself (rather
than the HTTPS specifics), we should also return
GIT_ECERTIFICATE. Otherwise, the caller would consider this as a failed
operation rather than a failed validation and not call the user's own
validation.
2014-11-02 16:12:10 +01:00
John Fultz
727ae380a5 Make config reading continue after hitting a missing include file.
For example, if you have

[include]
path = foo

and foo didn't exist, git_config_open_ondisk() would just give up
on the rest of the file.  Now it ignores the unresolved include
without error and continues reading the rest of the file.
2014-11-01 11:21:45 -05:00
Carlos Martín Nieto
fe6b51ae40 ssl: separate locking init from general init
Extract the lock-setting functions into their own, as we cannot assume
that it's ok for us to set this unconditionally.
2014-11-01 10:58:55 +01:00
Carlos Martín Nieto
e083657771 ssl: clear the OpenSSL locking function
We're freeing the memory which holds the locks so we must make sure that
the locking function doesn't try to use it.
2014-11-01 10:47:22 +01:00
Pierre-Olivier Latour
64bcf567c3 Fixed potential crash with uninitialized variables 2014-10-27 09:19:07 -07:00
Pierre-Olivier Latour
ea66215d87 Removed some useless variable assignments 2014-10-27 09:19:07 -07:00
Pierre-Olivier Latour
d88766c4e1 Changed context_lines and interhunk_lines to uint32_t to match struct s_xdemitconf 2014-10-27 09:17:01 -07:00
Carlos Martín Nieto
177a29d832 Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2 2014-10-27 10:39:45 +01:00
Sven Strickroth
334a0696f9 Minor cleanup: Use defined no_check_cert_flags instead of C&P them again
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-10-26 23:23:08 -04:00
Edward Thomson
979645a719 rebase: updates based on PR comments 2014-10-26 22:59:50 -04:00
Edward Thomson
18b00406c6 s/git_merge_head/git_annotated_commit
Rename git_merge_head to git_annotated_commit, as it becomes used
in more operations than just merge.
2014-10-26 22:59:48 -04:00
Edward Thomson
796b03bd49 rebase: clean up some warnings and memory leaks 2014-10-26 22:59:46 -04:00
Edward Thomson
e69737d760 rebase: oid member of operation should be const 2014-10-26 22:59:43 -04:00
Edward Thomson
ed2c06a6a1 git_rebase: iterators for operations 2014-10-26 22:59:41 -04:00
Edward Thomson
f152f8ac0c rebase: preload all operations 2014-10-26 22:59:38 -04:00
Edward Thomson
b6b636a7fa rebase: init/open a git_rebase object 2014-10-26 22:59:36 -04:00
Edward Thomson
18b439b9be git_rebase_next: provide info about the operation 2014-10-26 22:59:34 -04:00
Edward Thomson
5ae9d296e3 git_rebase_finish: rewrite notes when finishing rebase 2014-10-26 22:59:32 -04:00
Edward Thomson
bad4937ea5 Introduce git_note_author, git_note_committer 2014-10-26 22:59:29 -04:00
Edward Thomson
a612a25fa6 git_rebase_commit: write HEAD's reflog appropriately 2014-10-26 22:59:27 -04:00
Edward Thomson
517644cce4 Introduce git_rebase_finish to complete a rebase 2014-10-26 22:59:25 -04:00
Edward Thomson
93a7004cc2 git_rebase_commit: drop already-picked commits
Already cherry-picked commits should not be re-included.  If all changes
included in a commit exist in the upstream, then we should error with
GIT_EAPPLIED.
2014-10-26 22:59:21 -04:00
Edward Thomson
a35a9890b0 Introduce git_rebase_commit
Commit the current patch of a rebase process.
2014-10-26 22:59:19 -04:00
Edward Thomson
443d5674fe git_rebase_next: write conflicts nicely during rebase 2014-10-26 22:59:16 -04:00
Edward Thomson
950a709159 Introduce git_rebase_next
`git_rebase_next` will apply the next patch (or cherry-pick)
operation, leaving the results checked out in the index / working
directory so that consumers can resolve any conflicts, as appropriate.
2014-10-26 22:59:14 -04:00
Edward Thomson
4fe84d624b Introduce git_rebase_abort
Abort an in-progress rebase and move the working directory and
repository back to the ORIG_HEAD state.
2014-10-26 22:59:12 -04:00
Edward Thomson
daf395b795 git_reset: const the git_signature arg 2014-10-26 22:59:10 -04:00
Edward Thomson
867a36f3a6 Introduce git_rebase to set up a rebase session
Introduce `git_rebase` to set up a rebase session that can
then be continued.  Immediately, only merge-type rebase is
supported.
2014-10-26 22:59:08 -04:00
Edward Thomson
5b0c63061b Remove unused warning on non-win32 2014-10-26 22:38:45 -04:00
Edward Thomson
5a7cd1bcc0 iterator: free paths when skipping them 2014-10-26 22:28:00 -04:00
Edward Thomson
8c8ca7309b mwindow: clean up pack map at shutdown 2014-10-26 22:27:56 -04:00
Edward Thomson
50aae0007b global: clean up openssl_locks on shutdown 2014-10-26 22:27:52 -04:00
Edward Thomson
bc42479aaa Cleanup memory leak in ssh transport 2014-10-26 22:27:46 -04:00
Edward Thomson
cdd71711ce Clean up some memory leaks 2014-10-26 22:27:44 -04:00
Edward Thomson
369b021733 Clean up various compiler warnings 2014-10-26 22:13:40 -04:00
Edward Thomson
d09458f3e9 Merge pull request #2638 from libgit2/cmn/config-refresh-remove
config: remove the refresh function and backend field
2014-10-24 16:52:39 -07:00
Edward Thomson
725cd5f29d Merge pull request #2646 from libgit2/cmn/remote-rename
remote: accept a repo and name for renaming
2014-10-24 16:44:07 -07:00
Edward Thomson
b8041215cf Merge pull request #2649 from swisspol/2630
Fixed memory leak in git_tag_delete()
2014-10-24 14:02:53 -07:00
Edward Thomson
cdfd2b62b7 Merge pull request #2645 from libgit2/cmn/common-crypto
[RFC] Use CommonCrypto for hashing
2014-10-24 08:27:38 -07:00
Pierre-Olivier Latour
1ad15540e4 Fixed memory leak in git_tag_delete() 2014-10-24 08:23:14 -07:00
Carlos Martín Nieto
46c8f7f845 remote: accept a repo and name for renaming
Remote objects are not meant to be changed from under the user. We did
this in rename, but only the name and left the refspecs, such that a
save would save the wrong refspecs (and a fetch and anything else would
use the wrong refspecs).

Instead, let's simply take a name and not change any loaded remote from
under the user.
2014-10-24 16:25:59 +02:00
Carlos Martín Nieto
0862f617da remote: delete git_remote_supported_url()
This function does not in fact tell us anything, as almost anything with
a colon in it is a valid rsync-style SSH path; it can not tell us that
we do not support ftp or afp or similar as those are still valid SSH
paths and we do support that.
2014-10-24 13:40:42 +02:00
Carlos Martín Nieto
d9c0dbb042 hash: use CommonCrypto on OSX for SHA-1
OSX has its own cryptographic library, let's make use of it instead of
calling out to OpenSSL.
2014-10-24 13:31:18 +02:00
Carlos Martín Nieto
55cb499972 config: remove the refresh function and backend field
We have been refreshing on read and write for a while now, so
git_config_refresh() is at best a no-op, and might just end up wasting
cycles.
2014-10-23 19:05:02 +02:00
Carlos Martín Nieto
4bb6ffb6bb Merge pull request #2622 from libgit2/refresh-config-snapshot
Refresh git configuration before looking for the tracking branch redux.
2014-10-23 18:58:39 +02:00
Edward Thomson
d676af43da Merge pull request #2625 from libgit2/cmn/ssl-tls
ssl: dump the SSL ciphers in favour of TLS
2014-10-23 08:27:13 -07:00
Carlos Martín Nieto
f0f9737094 ssl: dump the SSL ciphers in favour of TLS
All versions of SSL are considered deprecated now, so let's ask OpenSSl
to only use TLSv1. We still ask it to load those ciphers for
compatibility with servers which want to use an older hello but will use
TLS for encryption.

For good measure we also disable compression, which can be exploitable,
if the OpenSSL version supports it.
2014-10-23 15:56:29 +02:00
Alan Rogers
ad5adacb1d Patch from @carlosmn to refresh the parent config before snapshotting. 2014-10-23 15:21:30 +11:00
Edward Thomson
12f32d9193 Remote paths: canonicalize UNC paths on Win32
Git for Windows will handle UNC paths only when in forward-slash
format, eg "//server/path".  When given a UNC path as a remote,
rewrite standard format ("\\server\path") into this ridiculous
format.
2014-10-22 17:49:53 -04:00
Carlos Martín Nieto
bb0757d56c tree-cache: correct the entry_count calculation
The entry_count field is the amount of index entries covered by a
particular cache entry, that is how many files are there (recursively)
under a particular directory.

The current code that attemps to do this is severely defincient and is
trying to count the amount of children, which always comes up to zero.

We don't even need to recount, since we have the information during the
cache creation. We can take that number and keep it, as we only ever
invalidate or replace.
2014-10-22 21:25:08 +02:00
Edward Thomson
e0383fa35f Merge pull request #2609 from linquize/describe-opts
Handle describe options better
2014-10-13 16:59:56 -04:00
Edward Thomson
c6e2621052 Merge pull request #2615 from ethomson/mount_points
Mount points
2014-10-13 16:52:44 -04:00
Edward Thomson
6a26488f8b Don't copy buffer in checkout unless needed 2014-10-13 13:36:20 -04:00
Jacques Germishuys
5e2cf2ca2c Ensure filters (i.e. CRLF) are applied when checking out conflict content 2014-10-13 13:36:18 -04:00
Edward Thomson
969b6a4710 is_empty_dir (wi32): cope with empty mount points
FindFirstFile will fail with INVALID_HANDLE_VALUE if there are no
children to the given path, which can happen if the given path is a
file (and obviously has no children) or if the given path is an empty
mount point.  (Most directories have at least directory entries '.'
and '..', but ridiculously another volume mounted in another drive
letter's path space do not, and thus have nothing to enumerate.)

If FindFirstFile fails, check if this is a directory-like thing
(a mount point).
2014-10-13 10:58:05 -04:00
Edward Thomson
8d45b4691c p_lstat win32: don't canonicalize volume mounts
A reparse point that is an IO_REPARSE_TAG_MOUNT_POINT could be
a junction or an actual filesystem mount point.  (Who knew?)
If it's the latter, its reparse point will report the actual
volume information \??\Volume{GUID}\ and we should not attempt
to dereference that further, instead readlink should report
EINVAL since it's not a symlink / junction and its original
path was canonical.

Yes, really.
2014-10-13 10:58:03 -04:00
Sven Strickroth
cf1013a888 There is no "z" size specifier on MSVC
See http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx and https://stackoverflow.com/questions/6655410/why-doesnt-zd-printf-format-work-in-vs2010

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-10-13 16:32:26 +02:00
Linquize
59186d9b15 describe: Initialize options for git_describe_format() if null 2014-10-11 07:52:47 +08:00
Linquize
0494a7c9a9 describe: Do not crash if pass null option to git_describe_commit() 2014-10-11 07:52:47 +08:00
Russell Belfer
85fe63bc58 Don't use cl_git_pass for POSIX functions
If there is a failure then cl_git_pass tries to get the libgit2
error, but p_... functions don't set that.

Also - trailing whitespace cleanup.
2014-10-10 15:17:27 -07:00
Russell Belfer
babbff347c Move un-namespaced constant to internal header
FLAG_BITS only seems to be used internally
2014-10-10 15:17:05 -07:00
Carlos Martín Nieto
7465e87399 index: fill the tree cache on write-tree
An obvious place to fill the tree cache is on write-tree, as we're
guaranteed to be able to fill in the whole tree cache.

The way this commit does this is not the most efficient, as we read the
root tree from the odb instead of filling in the cache as we go along,
but it fills the cache such that successive operations (and persisting
the index to disk) will be able to take advantage of the cache, and it
reuses the code we already have for filling the cache.

Filling in the cache as we create the trees would require some
reallocation of the children vector, which is currently not possible
with out pool implementation. A different data structure would likely
allow us to perform this operation at a later date.
2014-10-10 19:43:42 +02:00
Carlos Martín Nieto
795d8e9328 index: make sure to write cached subtrees if parent is invalidated
If e.g. the root tree is invalidated, we still want to write out
its children, since those may still have valid cache entries.
2014-10-10 19:43:42 +02:00
Carlos Martín Nieto
c2f8b21593 index: write out the tree cache extension
Keeping the cache around after read-tree is only one part of the
optimisation opportunities. In order to share the cache between program
instances, we need to write the TREE extension to the index.

Do so, taking the opportunity to rename 'entries' to 'entry_count' to
match the name given in the format description. The included test is
rather trivial, but works as a sanity check.
2014-10-10 19:43:42 +02:00
Carlos Martín Nieto
46bb006730 tree-cache: remove the parent pointer
This wasn't used. We invalidate based on the full path, so we always go
down the tree, never up.
2014-10-10 19:37:48 +02:00
Carlos Martín Nieto
6843cebe17 index: fill the tree cache when reading from a tree
When reading from a tree, we know what every tree is going to look like,
so we can fill in the tree cache completely, making use of the index for
modification of trees a lot quicker.
2014-10-10 19:35:19 +02:00
Carlos Martín Nieto
19c88310cb tree-cache: move to use a pool allocator
This simplifies freeing the entries quite a bit; though there aren't
that many failure paths right now, introducing filling the cache from a
tree will introduce more. This makes sure not to leak memory on errors.
2014-10-10 19:35:18 +02:00
Carlos Martín Nieto
d091a9dbde tree-cache: extract the allocation 2014-10-10 19:35:18 +02:00
Edward Thomson
a6ed1fcbe1 Merge pull request #2593 from libgit2/cmn/remote-delete-name
remote: accept a repository and remote name for deletion
2014-10-10 12:21:28 -04:00
Carlos Martín Nieto
bab92a8dcf Merge pull request #2575 from cirosantilli/factor-struct-typedef
[factor] Join typedef and struct definitions in single file.
2014-10-10 18:06:36 +02:00
Carlos Martín Nieto
4c0c001529 Merge pull request #2498 from linquize/read-large-file
Can read large file larger than 2GB on Win64
2014-10-10 17:58:35 +02:00
Carlos Martín Nieto
33ca356598 Merge pull request #2556 from sbc100/fix_warnings
Fix warnings in thread-utils.h when building without -DTHREADSAFE=ON
2014-10-10 17:52:31 +02:00
Carlos Martín Nieto
2139c9b76c Merge pull request #2542 from linquize/fetch-head
Do not error out when fetching from second remote
2014-10-10 17:50:28 +02:00
Carlos Martín Nieto
9b36537de4 Merge pull request #2588 from swansontec/ssl-cert-path2
Add support for setting the SSL CA location
2014-10-10 17:42:52 +02:00
Carlos Martín Nieto
0625638f06 Merge pull request #2499 from csware/hard-reset-checkout-callbacks
Allow to propagate checkout callbacks to git HARD reset
2014-10-10 17:40:53 +02:00
Edward Thomson
f54d8d528a Merge pull request #2574 from csware/hostname-for-certificate_check_cb
Provide host name to certificate_check_cb
2014-10-10 11:28:58 -04:00
Edward Thomson
533da4ea00 Merge pull request #2473 from arthurschreiber/arthur/new-javascript-test-files
New test files for the javascript diff driver.
2014-10-10 10:03:06 -04:00
Edward Thomson
f339f441f9 Merge pull request #2603 from libgit2/cmn/revwalk-merge-base
Walk only as far as the common ancestors of uninteresting commits
2014-10-10 09:59:26 -04:00
Arthur Schreiber
8e398e4c84 Treat an empty list of refspecs the same as a NULL value. 2014-10-10 13:17:53 +02:00
Carlos Martín Nieto
46a2b8e855 Merge pull request #2592 from libgit2/cmn/describe
Implement git-describe
2014-10-09 22:24:40 +02:00
Arthur Schreiber
994a3006b6 Update the javascript diff driver's function pattern. 2014-10-09 22:21:34 +02:00
Anurag Gupta (OSG)
5623e627d4 git_filter: dup the filter name 2014-10-09 14:54:48 -04:00
Edward Thomson
dfff1b5bcb Merge pull request #2599 from linquize/config-trailing-spaces
config: Handle multiple spaces that follow a configuration value and precede a comment char
2014-10-09 12:16:17 -04:00
Edward Thomson
8371457ce2 Merge pull request #2597 from ethomson/fixup
Trivial fixups
2014-10-09 11:32:26 -04:00
Carlos Martín Nieto
eecc177272 Fix an uninitialized variable 2014-10-09 17:02:11 +02:00
Edward Thomson
10cf4b26a0 Merge pull request #2448 from libgit2/cmn/reference-transaction
Introduce reference transactions
2014-10-09 10:49:37 -04:00
Edward Thomson
8be28acfcd Merge pull request #2462 from libgit2/cmn/remote-fetch-refs
Implement opportunistic ref updates
2014-10-09 10:41:38 -04:00
Carlos Martín Nieto
c327d5db8b transaction: rename lock() to lock_ref()
This leaves space for future expansion to locking other resources
without having to change the API for references.
2014-10-09 16:29:30 +02:00
Arthur Schreiber
917f85a1a4 Extract shared functionality. 2014-10-09 14:19:00 +02:00
Arthur Schreiber
eca07bcd83 Add git_merge_bases_many. 2014-10-09 14:19:00 +02:00
Carlos Martín Nieto
d6afda62d9 revwalk: clear first-parent flag on reset
This should have been included when implementing the feature but was
missed.
2014-10-08 17:17:31 +02:00
Carlos Martín Nieto
9b5d6cea4a revwalk: catch no-push and no-hide cases
If there have been no pushes, we can immediately return ITEROVER. If
there have been no hides, we must not run the uninteresting pre-mark
phase, as we do not want to hide anything and this would simply cause us
to spend time loading objects.
2014-10-08 17:14:48 +02:00
Carlos Martín Nieto
e7970576f1 revwalk: mark uninteresting only up to the common ancestors
This introduces a phase at the start of preparing a walk which pre-marks
uninteresting commits, but only up to the common ancestors.

We do this in a similar way to git, by walking down the history and
marking (which is what we used to do), but we keep a time-sorted
priority queue of commits and stop marking as soon as there are only
uninteresting commits in this queue.

This is a similar rule to the one used to find the merge-base. As we
keep inserting commits regardless of the uninteresting bit, if there are
only uninteresting commits in the queue, it means we've run out of
interesting commits in our walk, so we can stop.

The old mark_unintesting() logic is still in place, but that stops
walking if it finds an already-uninteresting commit, so it will stop on
the ones we've pre-marked; but keeping it allows us to also hide those
that are hidden via the callback.
2014-10-08 15:52:11 +02:00
Carlos Martín Nieto
ad66bf88df revwalk: keep a single list of user inputs
The old separation was due to the old merge-base finding, so it's no
longer necessary.
2014-10-08 10:45:47 +02:00
Carlos Martín Nieto
42835aa6b8 revwalk: clear the flags on reset
These store merge-base information which is only valid for a single run.
2014-10-08 10:24:06 +02:00
Linquize
0a64164700 config: Fix multiple trailing spaces before comments not completely trimmed 2014-10-04 23:27:06 +08:00
Edward Thomson
7c9bf891d5 repository_head_unborn: clear error when HEAD is unborn 2014-10-03 19:34:37 -04:00
Vicent Marti
737b505116 hashsig: Export as a sys header 2014-10-01 12:03:24 +02:00
William Swanson
737b445a18 Add support for setting the SSL CA location
This allows users to specify self-signed certificates, or to provide their
own certificate stores on limited platforms such as mobile phones.
2014-09-30 17:26:39 -07:00
Erdur
44802c551e path: fix invalid access 2014-09-30 16:19:24 +02:00
Carlos Martín Nieto
262eec23fe remote: accept a repository and remote name for deletion
We don't need the remote loaded, and the function extracted both of
these from the git_remote in order to do its work, so let's remote a
step and not ask for the loaded remote at all.

This fixes #2390.
2014-09-30 16:09:55 +02:00
Carlos Martín Nieto
f99ca52378 stash: use a transaction to modify the reflog
The stash is implemented as the refs/stash reference and its reflog. In
order to modify the reflog, we need avoid races by making sure we're the
only ones allowed to modify the reflog.

We achieve this via the transactions API. Locking the reference gives us
exclusive write access, letting us modify and write it without races.
2014-09-30 15:52:13 +02:00
Carlos Martín Nieto
ab8d9242f5 Introduce reference transactions
A transaction allows you to lock multiple references and set up changes
for them before applying the changes all at once (or as close as the
backend supports).

This can be used for replication purposes, or for making sure some
operations run when the reference is locked and thus cannot be changed.
2014-09-30 15:44:32 +02:00
Carlos Martín Nieto
bdeb8772fe signature: add a dup function which takes a pool
This will be used by the transaction code.
2014-09-30 15:44:32 +02:00
Carlos Martín Nieto
20363d583c reflog: constify byindex 2014-09-30 15:44:32 +02:00
Carlos Martín Nieto
c5837cad85 remote: implement opportunistic remote-tracking branch updates
When a list of refspecs is passed to fetch (what git would consider
refspec passed on the command-line), we not only need to perform the
updates described in that refspec, but also update the remote-tracking
branch of the fetched remote heads according to the remote's configured
refspecs.

These "fetches" are not however to be written to FETCH_HEAD as they
would be duplicate data, and it's not what the user asked for.
2014-09-30 15:43:24 +02:00
Carlos Martín Nieto
2cdd5c5752 remote: store passive refspecs
The configured/base fetch refspecs need to be taken into account in
order to implement opportunistic remote-tracking branch updates. DWIM
them and store them in the struct, but don't do anything with them yet.
2014-09-30 15:42:32 +02:00
Carlos Martín Nieto
c300d84a64 remote: don't DWIM refspecs unnecessarily
We can only DWIM when we've connected to the remote and have the list of
the remote's references. Adding or setting the refspecs should not
trigger an attempt to DWIM the refspecs as we typically cannot do it,
and even if we did, we would not use them for the current fetch.
2014-09-30 15:42:32 +02:00
Carlos Martín Nieto
3f89420523 remote: allow overriding the refspecs for download and fetch
With opportunistic ref updates, git has introduced the concept of having
base refspecs *and* refspecs that are active for a particular fetch.

Let's start by letting the user override the refspecs for download.
2014-09-30 15:42:32 +02:00
Carlos Martín Nieto
886710b77e describe: make mingw happy
The MinGW compiler does not like it when we declare a typedef twice.
2014-09-30 09:20:08 +02:00
Carlos Martín Nieto
25345c0cbe describe: rename git_describe_opts to git_describe_options
And implement the option init functions for this and the format options.
2014-09-30 09:18:22 +02:00
Carlos Martín Nieto
55f1b6b641 describe: implement abbreviated ids 2014-09-30 08:56:27 +02:00
Carlos Martín Nieto
fd8126e4c6 describe: implement describing the workdir
When we describe the workdir, we perform a describe on HEAD and then
check to see if the worktree is dirty. If it is and we have a suffix
string, we append that to the buffer.
2014-09-30 08:56:20 +02:00
Carlos Martín Nieto
3b6534b807 describe: split into gather and format steps
Instead of printing out to the buffer inside the information-gathering
phase, write the data to a intermediate result structure.

This allows us to split the options into gathering options and
formatting options, simplifying the gathering code.
2014-09-30 07:24:28 +02:00
Carlos Martín Nieto
1f501a086b describe: rename _object() to _commit()
We don't describe arbitrary object, so let's give it the name of the one
object type we accept.
2014-09-30 04:58:02 +02:00
Carlos Martín Nieto
af6cc38fc0 Merge remote-tracking branch 'upstream/master' into cmn/describe 2014-09-30 04:38:05 +02:00
Edward Thomson
4c53489260 Merge pull request #2581 from jacquesg/stash-ignored-directories
Stash ignored directories
2014-09-29 14:57:54 -04:00
Edward Thomson
89602a1a23 Merge pull request #2584 from jacquesg/pool-alignment
Pool/Index data is not aligned
2014-09-29 10:39:40 -04:00
Edward Thomson
ffe34a7cdc Merge pull request #2582 from swansontec/master
Correctly handle getaddrinfo return result
2014-09-29 10:37:37 -04:00
Edward Thomson
ced843f417 Merge pull request #2559 from libgit2/cmn/free-tls-error
global: free the error message when exiting a thread
2014-09-29 10:29:00 -04:00
Jacques Germishuys
7b7aa75f80 Recurse ignored directories when stashing 2014-09-26 13:11:49 +02:00
Jacques Germishuys
5387cfee4c Ensure patch is initialized to zero, otherwise, the allocated flag may be set 2014-09-26 12:12:09 +02:00
Jacques Germishuys
e640a77c9f Silence uninitialized warning 2014-09-26 12:12:08 +02:00
Jacques Germishuys
ff97778a7a The raw index buffer content is not guaranteed to be aligned
* Ensure alignment by copying the content into a structure on the stack
2014-09-26 12:12:08 +02:00
Jacques Germishuys
ad8c8d9325 Ensure pool data is aligned on an 8 byte boundary 2014-09-25 17:56:56 +02:00
Jacques Germishuys
3aaa5c7b46 Introduce GIT_ALIGN 2014-09-25 12:05:26 +02:00
William Swanson
d0cf1040c7 Correctly handle getaddrinfo return result
The getaddrinfo function indicates failure with a non-zero return code,
but this code is not necessarily negative. On platforms like Android
where the code is positive, a failed call causes libgit2 to segfault.
2014-09-24 12:01:14 -07:00
Ciro Santilli
062804570c Join typedef and struct definitions in single file. 2014-09-24 11:00:51 +02:00
Sven Strickroth
e6e834a129 Provide host name to certificate_check_cb
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-09-22 16:27:52 +02:00
Vicent Marti
14556cbff7 Merge pull request #2567 from cirosantilli/factor-41
Factor 40 and 41 constants from source.
2014-09-17 17:13:25 +02:00
Vicent Marti
276d9ea3a6 Merge pull request #2571 from libgit2/vmg/walk-up-path
Fix `git_path_walk_up` to work with non-rooted paths
2014-09-17 15:39:57 +02:00
The rugged tests are fragile
74240afb9c repository: Do not double-free config 2014-09-17 15:35:50 +02:00
Vicent Marti
4592b62ee5 Merge pull request #2572 from cirosantilli/factor-void
Replace void casts with GIT_UNUSED.
2014-09-17 15:26:48 +02:00
The rugged tests are fragile
4e96411748 Style 2014-09-17 15:24:56 +02:00
The rugged tests are fragile
a2b4407dc3 attr: Do not walk path if we're at the root 2014-09-17 15:24:17 +02:00
Ciro Santilli
c5cf8cade3 Replace void casts with GIT_UNUSED. 2014-09-17 15:19:08 +02:00
The rugged tests are fragile
bbb988a519 path: Fix git_path_walk_up to work with non-rooted paths 2014-09-17 15:00:12 +02:00
Vicent Marti
1312f87b68 Merge pull request #2464 from libgit2/cmn/host-cert-info
Provide a callback for certificate validation
2014-09-17 14:56:39 +02:00
Carlos Martín Nieto
25abbc27a7 Clean up some leaks in the test suite 2014-09-17 03:19:40 +02:00
Carlos Martín Nieto
4fe5b771b5 winhttp: get rid of the cert ignore flag
This brings us back in line with the other transports.
2014-09-16 17:02:33 +02:00
Carlos Martín Nieto
1e0aa105fa ssh: expose both hashes
The user may have the data hashed as MD5 or SHA-1, so we should provide
both types for consumption.
2014-09-16 17:02:33 +02:00
Carlos Martín Nieto
286369a81f ssh: provide our own types for host key lengths
Instead of using the libssh2 defines, provide our own, which eases usage
as we do not need to check whether libgit2 was built with libssh2 or not.
2014-09-16 17:02:32 +02:00
Carlos Martín Nieto
0782fc43f8 net: use only structs to pass information about cert
Instead of spreading the data in function arguments, some of which
aren't used for ssh and having a struct only for ssh, use a struct for
both, using a common parent to pass to the callback.
2014-09-16 17:02:32 +02:00
Carlos Martín Nieto
0fef38999a Merge remote-tracking branch 'upstream/master' into cmn/host-cert-info 2014-09-16 17:02:28 +02:00
Carlos Martín Nieto
41698f22f6 net: remove support for outright ignoring certificates
This option make it easy to ignore anything about the server we're
connecting to, which is bad security practice. This was necessary as we
didn't use to expose detailed information about the certificate, but now
that we do, we should get rid of this.

If the user wants to ignore everything, they can still provide a
callback which ignores all the information passed.
2014-09-16 17:01:32 +02:00
Carlos Martín Nieto
7c8acc54be winhttp: set ignore security flags on user command
If the user returns 0 from the certificate check and we had certificate issues, set the options to ignore certificate errors and resend the request.
2014-09-16 17:01:32 +02:00
Carlos Martín Nieto
67c84e06f3 winhttp: bring together request sending
We need to call WinHttpSendRequest() in three different places. Unify all in a single function to have a single place for the certificate check.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
5f2cf732ab winhttp: only do certificate check for SSL
If we're not using SSL, don't call the user's certificate check callback.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
08545d366b winhttp: credential check on successful connect
On successful connection, still ask the user whether they accept the server's certificate, indicating that WinHTTP would let it though.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
23ca0ad5eb Bring certificate check back to the normal return code
Returning 0 lets the certificate check succeed. An error code is bubbled
up to the user.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
2f5864c50c ssh: do ssh cert info before asking for credentials
We know the host's key as soon as we connect, so we should perform the
check as soon as we can, before we bother with the user's credentials.
2014-09-16 17:01:31 +02:00
Carlos Martín Nieto
17491f6e56 transport: always call the certificate check callback
We should let the user decide whether to cancel the connection or not
regardless of whether our checks have decided that the certificate is
fine. We provide our own assessment to the callback to let the user fall
back to our checks if they so desire.
2014-09-16 17:01:30 +02:00
Carlos Martín Nieto
ec1ce4584a http: send the DER-encoded cert to the callback
Instead of the parsed data, we can ask OpenSSL to give us the
DER-encoded version of the certificate, which the user can then parse
and validate.
2014-09-16 17:01:30 +02:00
Carlos Martín Nieto
9b9405865e Provide a callback for certificate validation
If the certificate validation fails (or always in the case of ssh),
let the user decide whether to allow the connection.

The data structure passed to the user is the native certificate
information from the underlying implementation, namely OpenSSL or
WinHTTP.
2014-09-16 17:01:30 +02:00
Vicent Marti
903a76168e Merge pull request #2561 from jacquesg/merge-skip
No files merged may result in bogus merge conflict error
2014-09-16 13:22:40 +02:00
The rugged tests are fragile
52e9120c77 attr: Cleanup the containing dir logic 2014-09-16 13:20:58 +02:00
Ciro Santilli
3b2cb2c91e Factor 40 and 41 constants from source. 2014-09-16 13:07:04 +02:00
Russell Belfer
1fbeb2f04c Fix attribute lookup in index for bare repos
When using a bare repo with an index, libgit2 attempts to read
files from the index.  It caches those files based on the path
to the file, specifically the path to the directory that contains
the file.

If there is no working directory, we use `git_path_dirname_r` to
get the path to the containing directory.  However, for the
`.gitattributes` file in the root of the repository, this ends up
normalizing the containing path to `"."` instead of the empty
string and the lookup the `.gitattributes` data fails.

This adds a test of attribute lookups on bare repos and also
fixes the problem by simply rewriting `"."` to be `""`.
2014-09-15 21:59:23 -07:00
Vicent Marti
a7fcac13a5 Merge pull request #2554 from linquize/fetch-head-tag
When auto follow tags, FETCH_HEAD should list only newly followed tags
2014-09-15 20:26:12 +02:00
Carlos Martín Nieto
fdea219a86 global: free the error message when exiting a thread
When we free the global state at thread termination, we must also free
the error message in order not to leak the string once per thread.
2014-09-14 00:39:07 +02:00
Jacques Germishuys
dc68ee8d15 Remove local unused index_repo variable 2014-09-12 22:54:05 +02:00
Jacques Germishuys
a565f364ab Only check for workdir conflicts if the index has merged files
Passing 0 as the length of the paths to check to git_diff_index_to_workdir
results in all files being treated as conflicting, that is, all untracked or
modified files in the worktree is reported as conflicting
2014-09-12 22:53:56 +02:00
Carlos Martín Nieto
76e3c43fb9 signature: don't allow empty emails
A signature is made up of a non-empty name and a non-empty email so
let's validate that. This also brings us more in line with git, which
also rejects ident with an empty email.
2014-09-10 18:14:46 +02:00
Vicent Marti
31e752b654 Merge pull request #2511 from libgit2/cmn/remote-default-restrict
Restrict which refs can be the default branch
2014-09-09 12:52:36 +02:00
Sam Clegg
ccd8ba9bba Fix warnings in thread-utils.h when building without -DTHREADSAFE=ON
The compiler was generating a bunch of warnings for
git_mutex_init and git_mutex_lock when GIT_THREADS
was not defined (i.e. when not using -DTHREADSAFE=ON).

Also remove an unused variable from tests/path/core.c.
2014-09-08 16:48:04 -07:00
Linquize
d908351a6c When auto follow tags, FETCH_HEAD should list only newly followed tags 2014-09-06 00:26:56 +08:00
Vicent Marti
1e71354e34 reflog: Error handling on empty reflog 2014-09-05 03:25:53 +02:00
Carlos Martín Nieto
2dc399a81d ssh: store error message immediately after a failed agent call
When the call to the agent fails, we must retrieve the error message
just after the function call, as other calls may overwrite it.

As the agent authentication is the only one which has a teardown and
there does not seem to be a way to get the error message from a stored
error number, this tries to introduce some small changes to store the
error from the agent.

Clearing the error at the beginning of the loop lets us know whether the
agent has already set the libgit2 error message and we should skip it,
or if we should set it.
2014-09-04 16:46:14 +02:00
Vicent Marti
89e05e2ab1 Merge pull request #2543 from libgit2/cmn/known-transports
Clean up transport lookup
2014-09-03 12:50:44 +02:00
Vicent Marti
4c958046d3 Merge pull request #2530 from libgit2/jamill/relative_gitlink
Teach repository to use relative paths for git symbolic links
2014-09-03 12:19:48 +02:00
Jameson Miller
bc737620dd Introduce option to use relative paths for repository work directory
Teach git_repository_init_ext to use relative paths for the gitlink
to the work directory. This is used when creating a sub repository
where the sub repository resides in the parent repository's
.git directory.
2014-09-02 21:07:26 -04:00
Edward Thomson
0ee9f31c3b Introduce git_path_make_relative 2014-09-02 21:07:23 -04:00
Arkady Shapkin
5cd81bb3d8 Several CppCat warnings fixed 2014-09-03 01:01:25 +04:00
Linquize
f49819aa90 When updating FETCH_HEAD, do not treat it as error if the remote of current branch is from another remote 2014-09-02 21:28:13 +08:00
Carlos Martín Nieto
15c30b72e1 clone: handle overly restrictive refspecs
When the fetch refspec does not include the remote's default branch, it
indicates an error in user expectations or programmer error. Error out
in that case.

This lets us get rid of the dummy refspec which can never work as its
zeroed out. In the cases where we did not find a default branch, we set
HEAD detached immediately, which lets us refactor the "normal" path,
removing `found_branch`.
2014-09-02 13:23:54 +02:00
Carlos Martín Nieto
e128a1af6e clone: correct handling of an unborn HEAD
If the remote does not advertise HEAD, then it is unborn and we cannot
checkout that branch. Handle it the same way as an empty repo.
2014-09-02 13:10:19 +02:00
Carlos Martín Nieto
ba67c07522 remote: get rid of git_remote_valid_url()
It does the same as git_remote_supported_url() but has a name which
implies we'd check the URL for correctness while we're simply looking at
the scheme and looking it up in our lists.

While here, fix up the tests so we check all the combination of what's
supported.
2014-08-31 21:50:28 +02:00
Carlos Martín Nieto
bd3854a09c transport: return ENOTFOUND for HTTPS and SSH when they're not supported
The previous commit makes it harder to figure out if the library was
built with support for a particular transport. Roll back some of the
changes and remove ssh:// and https:// from the list if we're being
built without support for them.
2014-08-31 18:01:44 +02:00
Carlos Martín Nieto
dbc77850ff transport: distinguish between unknown and unsupported transports
Even when built without a SSH support, we know about this transport. It
is implemented, but the current code makes us return an error message
saying it's not.

This is a leftover from the initial implementation of the transports
when there were in fact transports we knew about but were not
implemented.

Instead, let the SSH transport itself say it cannot run, the same as we
do for HTTPS.
2014-08-31 18:01:35 +02:00
Vicent Marti
46a13f3247 Merge pull request #2481 from libgit2/cmn/oidarray
merge: expose multiple merge bases
2014-08-29 18:19:56 +02:00
Carlos Martín Nieto
46254467cf clone: support remotes with references but no branches
A repository can have any number of references which we're not
interested in such as notes or tags. For the default branch calculation
we only care about branches. Make the decision about the number of
branches rather than the number of refs in general.
2014-08-29 15:28:10 +02:00
Carlos Martín Nieto
0cdaa3766a remote: short-circuit the default branch check if there is none
If we do not have a HEAD ref in the heads, we already know there is no
default branch. Return immedately.
2014-08-29 15:28:10 +02:00
Carlos Martín Nieto
389526043a remote: restrict default branch to branches namespace 2014-08-29 15:27:36 +02:00
Vicent Marti
d99c8ca178 Merge pull request #2539 from libgit2/cmn/ahead-behind-order
Fix ahead-behind results
2014-08-28 16:33:53 +02:00
Carlos Martín Nieto
05f0d0c119 graph: fix ahead-behind logic
When we see PARENT1, it means there is a local commit and thus we are
ahead. Likewise, seeing PARENT2 means that the upstream branch has a
commit and we are one more behind.

The logic is currently reversed. Correct it.

This fixes #2501.
2014-08-28 13:36:58 +02:00
Vicent Marti
69db893427 Merge pull request #2538 from libgit2/ntk/propagate_url_parsing_error
winhttp: Prevent swallowing of url parsing error
2014-08-27 19:19:55 +02:00
Vicent Marti
893cfe0649 Merge pull request #2502 from rnowosielski/remote_set_timeout
Set timeout on remote (Add timeout for WinHttpReceiveResponse #2147)
2014-08-27 19:18:46 +02:00
Vicent Marti
1485c6833a Merge pull request #2490 from csware/ssh-wintunnel
Allow to override default ssh transport_cb - in order to allow third party ssh transports
2014-08-27 18:02:10 +02:00
nulltoken
f0c53d21a4 winhttp: Prevent swallowing of url parsing error 2014-08-27 17:37:29 +02:00
Carlos Martín Nieto
6a0d2b43ee Merge remote-tracking branch 'upstream/master' into cmn/ssh-retry 2014-08-27 15:09:07 +02:00
Rafal Nowosielski
86d0a53cd6 Set timeout on remote (WinHTTP) should return error in case of failure. Connection timeout set to 1 minute. Read/Write timeout remains set to infinite #2147 2014-08-27 15:07:04 +02:00
Justin Spahr-Summers
6a211d7c9a Refactor git_cache to use an rwlock
This significantly reduces contention when many threads are trying to
read from the cache simultaneously.
2014-08-26 15:12:43 -07:00
Vicent Marti
00e9ae5ab4 Merge pull request #2508 from libgit2/rb/fix-ignore-slash-star
Fix bugs with negative ignores inside an ignored parent directory
2014-08-26 17:48:20 +02:00
Sven Strickroth
34e510cedf Allow to override default ssh transport_cb
W/o this patch it is not possible to have a third party ssh transport_cb if GIT_SSH is disabled or a third party transport_cb which has a higher priority than the default one.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-08-26 17:18:52 +02:00
Carlos Martín Nieto
b3d3459f32 pack: return the correct final offset
The callers of git_packfile_unpack() expect the obj_offset argument to
be set to the beginning of the next object. We were mistakenly returning
the the offset of the object's data, which causes the CRC function to
try to use the wrong offset.

Set obj_offset to curpos instead of elem->offset to point to the next
element and bring back expected behaviour.
2014-08-26 15:09:47 +02:00
Vicent Marti
844d226c9d Merge pull request #2532 from arthurschreiber/arthur/fix-merge-base-commit-check
merge base: Correctly raise an error if a non-commit object is passed.
2014-08-25 23:06:34 +02:00
Arthur Schreiber
017c0eac2b merge base: Correctly raise an error if a non-commit object is passed. 2014-08-25 22:41:07 +02:00
Vicent Marti
5af52c628b Merge pull request #2531 from libgit2/rb/mkdir-allow-parent-failures
Allow mkdir helper to skip parent errors
2014-08-25 21:04:09 +02:00
Vicent Marti
2c1de697e0 Merge pull request #2527 from jacquesg/refspec-crash
Check if the refspec matches before transforming
2014-08-25 18:18:06 +02:00
Rafal Nowosielski
2db71194de Set timeout on remote (WinHTTP) to infinite #2147 2014-08-23 13:24:13 +02:00
Russell Belfer
668ae2ddf8 Allow mkdir helper to skip parent errors
Our mkdir helper was failing is a parent directory was not
accessible even if the child directory could be created.
This changes the helper to keep trying child directories
even when the parent is unwritable.
2014-08-22 10:05:09 -07:00
Jacques Germishuys
8f6073f63e Check that the refspec matches before modifying the out buffer 2014-08-21 18:53:43 +02:00
Vicent Marti
d28b2b7a5f Merge pull request #2528 from libgit2/vmg/tostr_s
Export `git_oid_tostr_s` instead of `_allocfmt`
2014-08-18 15:18:59 +02:00
Vicent Marti
4ca0b566ca oid: Export git_oid_tostr_s instead of _allocfmt
The old `allocfmt` is of no use to callers, as they are not able to free
the returned buffer. Export a new API that returns a static string that
doesn't need to be freed.
2014-08-18 12:41:06 +02:00
Jacques Germishuys
4e53c28096 Check if the refspec matches before transforming 2014-08-17 14:55:06 +02:00
Carlos Martín Nieto
294c6f2964 http: make sure we can consume the data we request
The recv buffer (parse_buffer) and the buffer have independent sizes and
offsets. We try to fill in parse_buffer as much as possible before
passing it to the http parser. This is fine most of the time, but fails
us when the buffer is almost full.

In those situations, parse_buffer can have more data than we would be
able to put into the buffer (which may be getting full if we're towards
the end of a data sideband packet).

To work around this, we check if the space we have left on our buffer is
smaller than what could come from the network. If this happens, we make
parse_buffer think that it has as much space left as our buffer, so it
won't try to retrieve more data than we can deal with.

As the start of the data may no longer be at the start of the buffer, we
need to keep track of where it really starts (data_offset) and use that
in our calculations for the real size of the data we received from the
network.

This fixes #2518.
2014-08-16 22:21:12 +02:00
Jacques Germishuys
dc8adda4f1 git_remote_ls() should return an error if the transport is not available 2014-08-15 22:56:15 +02:00
Edward Thomson
23135afa6f Introduce proper http authentication API 2014-08-15 14:11:56 -04:00
Edward Thomson
315cb38e1e Add GSSAPI support for SPNEGO/Kerberos auth over HTTP 2014-08-15 11:12:42 -04:00
Edward Thomson
e003f83a58 Introduce git_buf_decode_base64
Decode base64-encoded text into a git_buf
2014-08-15 11:12:42 -04:00
Edward Thomson
40867266bf Perform HTTP keep-alive 2014-08-15 11:12:42 -04:00
Edward Thomson
c180c06586 Custom transport: minor cleanups
* Move the transport registration mechanisms into a new header under
   'sys/' because this is advanced stuff.
 * Remove the 'priority' argument from the registration as it adds
   unnecessary complexity.  (Since transports cannot decline to operate,
   only the highest priority transport is ever executed.)  Users who
   require per-priority transports can implement that in their custom
   transport themselves.
 * Simplify registration further by taking a scheme (eg "http") instead
   of a prefix (eg "http://").
2014-08-14 08:52:20 -05:00
Edward Thomson
e62f96dea5 Allow NULL error message prefix when class=GITERR_OS 2014-08-13 14:55:24 -04:00
Linquize
c6ba8a3765 Can read large file larger than 2GB on Windows 2014-08-10 22:00:04 +08:00
Carlos Martín Nieto
9dac1f9579 config: a multiline var can start immediately
In the check for multiline, we traverse the backslashes from the end
backwards and int the end assert that we haven't gone past the beginning
of the line. We make sure of this in the loop condition, but we also
check in the return value.

However, for certain configurations, a line in a multiline variable
might be empty to aid formatting. In that case, 'end' == 'start', since
we ended up looking at the first char which made it a multiline.

There is no need for the (end > start) check in the return, since the
loop guarantees we won't go further back than the first char in the
line, and we do accept the first char to be the final backslash.

This fixes #2483.
2014-08-09 11:06:49 +02:00
Vicent Marti
bb9e6028b8 Merge pull request #2507 from libgit2/rb/timer-typo
Typo in timer constants
2014-08-09 00:35:08 +02:00
Russell Belfer
a0cacc82d5 For negative matches, always use leading dir match 2014-08-08 15:19:15 -07:00
Russell Belfer
f25bc0b2e6 Fix rejection of parent dir of negated ignores
While scanning through a directory hierarchy, this prevents a
positive ignore match on a parent directory from blocking the scan
of a directory when a negative match rule exists for files inside
the directory.
2014-08-08 14:51:36 -07:00
Russell Belfer
f18234fad6 Don't report status on named pipes
Git skips entries in directories that are not S_ISDIR, S_ISREG, or
S_ISLNK, so let's make libgit2 do the same thing.
2014-08-08 13:17:50 -07:00
Vicent Marti
8f759ac0b3 Merge pull request #2471 from jacquesg/compatibility-cleanup
Compatibility/Portability cleanup
2014-08-07 18:00:57 +02:00
Russell Belfer
3822d2cc4f Fix typo in timer normalization constants
The effect of this would be that various update callbacks would
not be made at the correct interval.
2014-08-05 15:06:45 -07:00
Jacques Germishuys
07d03d3145 Introduce some consistency in definition/declaration ordering 2014-08-05 20:52:00 +02:00
Jacques Germishuys
662f90e6ec Move p_realpath logic to realpath.c 2014-08-05 20:52:00 +02:00
Jacques Germishuys
c983604eb1 Consistently use p_snprintf 2014-08-05 20:51:59 +02:00
Jacques Germishuys
2f795d8fc5 Cleanup portability/compatibility layer
* Removes mingw-compat.h
* Cleans up separation of compiler/platform idiosyncrasies
* Unifies mingw/msvc stat structures and functions
* (Tries to) hide more compiler specific implementation details (even in our internal API)
2014-08-05 20:51:59 +02:00
Jacques Germishuys
d07fd4425f Define WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH if not defined 2014-08-05 20:51:59 +02:00
Jacques Germishuys
959a93e716 Silence unused variables warnings 2014-08-05 20:51:59 +02:00
Sven Strickroth
b8add6c42e Allow to propagate checkout callbacks to git HARD reset
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-08-03 16:29:51 +02:00
Carlos Martín Nieto
7db0e6ee48 merge: expose multiple merge bases
We always calculate multiple merge bases, but up to now we had only
exposed the "best" merge base.

Introduce git_oidarray which analogously to git_strarray lets us return
multiple ids.
2014-07-27 17:17:22 +02:00
Carlos Martín Nieto
b62a6a13b2 array: mark the array to grow as volatile
This works around strict aliasing rules letting some versions of
GCC (particularly on RHEL 6) thinking that they can skip updating the
size of the array when calculating the next element's offset.
2014-07-25 08:25:41 +02:00
Carlos Martín Nieto
9746b36cf9 revwalk: remove preallocation of the uninteresting commits
Preallocating two commits doesn't make much sense as leaving allocation
to the first array usage will allocate a sensible size with room for
growth.

This preallocation has also been hiding issues with strict aliasing in
the tests, as we have fairly simple histories and never trigger the
growth.
2014-07-24 17:52:28 +02:00
Vicent Marti
9de6ec5200 Merge pull request #2477 from ethomson/merge
Don't allow conflicts by default
2014-07-23 09:41:52 +02:00
Vicent Marti
243db06ce3 Merge pull request #2484 from libgit2/fix-git-status-list-new-unreadable-folder
Fix git status list new unreadable folder
2014-07-23 07:57:20 +02:00
Alan Rogers
85b7268e38 undo indentation change in diff_print.c 2014-07-23 12:17:02 +10:00
Edward Thomson
0ba4dca526 git_cherry_pick -> git_cherrypick 2014-07-22 10:40:23 -04:00
Alan Rogers
7d0ab0fae0 Merge remote-tracking branch 'origin/master' into fix-git-status-list-new-unreadable-folder 2014-07-22 15:08:24 +10:00
Alan Rogers
e824e63de6 Remove debug printfs. 2014-07-22 11:25:56 +10:00
Edward Thomson
994404b506 Don't allow conflicts by default 2014-07-17 01:25:31 -04:00
Vicent Marti
091165c53b Merge pull request #2475 from libgit2/expose-buffer-binary-detection
Export git_buf_text_is_binary and git_buf_text_contains_nul.
2014-07-16 14:21:53 -07:00
joshaber
b3af2d80d2 Just put it all in buffer. 2014-07-16 13:34:25 -07:00
Vicent Marti
ec813d83e7 Merge pull request #2476 from linquize/config-lf-eof
When adding new config section, handle config file not ending with LF
2014-07-16 13:07:17 -07:00
Vicent Marti
8baeb8a480 ssh: Fix unused warning 2014-07-16 13:03:34 -07:00
Vicent Marti
84a85d1bec clone: should_clone? Of course we should clone. That's not the question 2014-07-16 13:03:07 -07:00
Vicent Marti
ed99e0b54f Merge pull request #2467 from ethomson/win_local_clone
Handle local file:/// paths on Windows
2014-07-16 13:00:15 -07:00
Linquize
991dab2dd0 Make sure \n is at the end of config file before a new section is written 2014-07-16 21:09:53 +08:00
joshaber
df4cba0f28 Export git_buf_text_is_binary and git_buf_text_contains_nul.
So that users don’t need to implement binary detection themselves.
2014-07-15 17:38:39 -07:00
Jacques Germishuys
f59a34d2e6 Only create openssl_locks if thread support is enabled 2014-07-13 16:23:17 +02:00
Jacques Germishuys
529c37156d Fix unix/posix.h include guard 2014-07-13 16:23:16 +02:00
Edward Thomson
529fd30d1f Handle local file:/// paths on Windows
Windows can't handle a path like `/c:/foo`; when turning file:///
URIs into local paths, we must strip the leading slash.
2014-07-11 18:46:00 -04:00
Vicent Marti
a6d7e16634 Merge pull request #2466 from jacquesg/win2003-platform-sdk
Windows compatibility fixes
2014-07-11 16:51:43 +02:00
Vicent Marti
44cfb6f387 Merge pull request #2463 from libgit2/cmn/ssh-factory-for-paths
ssh: provide a factory function for setting ssh paths
2014-07-11 16:49:23 +02:00
Vicent Marti
863dabdaba Merge pull request #2465 from libgit2/cmn/refspec-start-middle
Support refspecs with the asterisk in the middle
2014-07-11 16:47:41 +02:00
Carlos Martín Nieto
356b891e3e Merge pull request #2468 from Airbitz/pack-error-reporting
Properly report failure when expanding a packfile
2014-07-11 14:19:35 +02:00
Alan Rogers
4edd1a036b Merge remote-tracking branch 'origin/development' into fix-git-status-list-new-unreadable-folder 2014-07-10 19:17:34 -07:00
William Swanson
01b432cf35 Properly report failure when expanding a packfile 2014-07-09 14:12:30 -07:00
Edward Thomson
02bf955f4a merge: don't open COMMIT_MSG unless we need to append conflicts 2014-07-08 14:14:23 -04:00
Carlos Martín Nieto
d4256ed554 ssh: provide a factory function for setting ssh paths
git allows you to set which paths to use for the git server programs
when connecting over ssh; and we want to provide something similar.

We do this by providing a factory function which can be set as the
remote's transport callback which will set the given paths upon
creation.
2014-07-07 14:51:51 +02:00
Jacques Germishuys
59ceb432f3 Define IO_REPARSE_TAG_SYMLINK if its not defined by WinNT.h 2014-07-06 09:22:25 +02:00
Jacques Germishuys
72090514b1 Secure CRT is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
Jacques Germishuys
491ad0de59 qsort_r is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
Jacques Germishuys
cde32d4d28 Variadic macros is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
Jacques Germishuys
ab864e9c71 _stat64 is a function, __stat64 is the structure 2014-07-06 09:22:24 +02:00
Jacques Germishuys
b8365f2168 strnlen() is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
Jacques Germishuys
90c2b37fd7 in_addr is defined in <Winsock2.h>, include before <ws2tcpip.h> 2014-07-06 09:22:24 +02:00
Carlos Martín Nieto
f5287fa6c3 refspec: support asterisks in the middle of a pattern
We used to assume a refspec would only have an asterisk in the middle of
their respective pattern. This has not been a valid assumption for some
time now with git.

Instead of assuming where the asterisk is going to be, change the logic
to treat each pattern as having two halves with a replacement bit in the
middle, where the asterisk is.
2014-07-04 18:00:20 +02:00
Carlos Martín Nieto
9ed104a8fa refspec: short-circuit non-pattern refspecs on transform
When transforming a non-pattern refspec, we simply need to copy over the
opposite string. Move that logic up to the wrapper so we can assume a
pattern refspec in the transformation function.
2014-07-04 17:41:40 +02:00
Jacques Germishuys
ae241ae129 Include libssh2.h before git2.h (transport.h) 2014-07-03 20:20:00 +02:00
Vicent Marti
b0ed61f822 Merge pull request #2460 from libgit2/cmn/sched-yield
Move yield to the tests and enable for FreeBSD
2014-07-03 15:30:38 +02:00
Carlos Martín Nieto
905fb5929b Move yield to the tests and enable for FreeBSD
Move the definition of git_thread_yield() to the test which needs it and
add the correct definition for it for FreeBSD and derivatives.

Original patch adding FreeBSD and derivatives by @jacquesg.
2014-07-03 05:55:02 +02:00
Vicent Marti
193fe9cbbf Merge pull request #2459 from libgit2/cmn/http-url-path
netops: error out on url without a path
2014-07-03 02:41:10 +02:00
Carlos Martín Nieto
1380e7c6b1 netops: error out on url without a path
In order to connect to a remote server, we need to provide a path to the
repository we're interested in. Consider the lack of path in the url an
error.
2014-07-03 02:34:32 +02:00
Vicent Marti
cb6e68c7e6 Merge pull request #2449 from libgit2/cmn/maint-21
Maint fixes for ssl initing and ssh exposure
2014-07-02 16:45:02 +02:00
Vicent Marti
4df4ebd7c7 Merge pull request #2453 from ethomson/checkout_index
git_checkout_index: checkout other indexes
2014-07-02 15:29:14 +02:00
Vicent Marti
b0ca1b18e2 Merge pull request #2452 from libgit2/cmn/clone-custom-repo
Provide a callback to customize the repository on clone
2014-07-02 15:29:05 +02:00
Vicent Marti
de3cf801ce Merge pull request #2456 from libgit2/cmn/ssh-send-everything
ssh: libssh2_channel_write() behaves like send()
2014-07-02 15:28:24 +02:00