Commit Graph

1291 Commits

Author SHA1 Message Date
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
7b6e1e4cc6 fetch: add test for the other order of overlapping specs 2014-12-14 21:25:08 +01:00
Carlos Martín Nieto
4aa2336966 fetch: assert we don't call update tips when there are no upates
This is hiding a bug in the prune code, whereby we prune references we
shouldn't but don't notice it in the code afterwards because
update_tips() recreates them.

This means that we do perform changes to the references (and get rid of
the reflogs) when we shouldn't.
2014-12-14 17:04:02 +01:00
Carlos Martín Nieto
020aab9308 fetch: do set prune when testing
We load the remote again, so we need to ask the new remote to prune the
refs, or we're not exercising the code in our tests.
2014-12-14 17:04:02 +01:00
David Calavera
5e0c3d2d1a Make sure that fetch --prune --tags doesn't remove tags. 2014-12-14 17:04:02 +01:00
David Calavera
b91194e842 Cleanup repository after prune tests. 2014-12-14 17:04:02 +01:00
David Calavera
93d968fa07 Cleanup after testing remote prune. 2014-12-14 17:04:02 +01:00
David Calavera
82eeba8142 Fix references to git_remote_lookup. 2014-12-14 17:04:01 +01:00
David Calavera
439e19f632 Test that prune overlapping works as expected. 2014-12-14 17:04:01 +01:00
David Calavera
ce4b57c6bc Fix calls to git_remote_download and git_remote_fetch. 2014-12-14 17:04:01 +01:00
Linquize
b8fefcb9ca Add test for prune refs 2014-12-14 17:04:01 +01:00
Edward Thomson
09debe1213 clar: wide character comparisons 2014-12-10 18:11:50 -05:00
Edward Thomson
3410084675 tests: use p_ instead of posix func directly 2014-12-10 18:11:50 -05: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
6b11eb51ee core::link test: clean up junction point name 2014-12-09 12:04:53 -05:00
Edward Thomson
80b01c8f26 win32: remember to free wide env name/value 2014-12-09 12:04:50 -05:00
Edward Thomson
d5087689b5 Merge pull request #2750 from linquize/generate.py
Update clar to e3985dd
2014-12-08 23:03:30 -05:00
Linquize
8e0aa2ebce Fix broken merge tests due to autocrlf was not false 2014-12-07 23:41:30 +08:00
Linquize
d226fbf1aa Fix broken test suite on Windows 2014-12-07 22:42:06 +08:00
Linquize
3a1eb9e5ff Update clar to e3985dd 2014-12-07 22:09:00 +08: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
e0a97416d4 ignore: adjust test for negating inside a dir
Given

    top
    !top/foo

in an ignore file, we should not unignore top/foo. This is an
implementation detail of the git code leaking, but that's the behaviour
we should show.

A negation rule can only negate an exact rule it has seen before.
2014-12-05 19:43:36 +01:00
nulltoken
30ec05260d Merge pull request #2744 from epmatsw/spelling
Spelling fixes
2014-12-05 07:44:09 +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
Jeff Hostetler
93aef71e90 fix cl_git_mkfile() to test for -1 rather than 0 for errors from p_creat() 2014-11-26 14:12:11 -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
3fade40e39 remote: add test for pushing and deleting with the local transport 2014-11-23 21:29:35 +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
Vicent Marti
92e0b67930 buffer: Do not put anything if len is 0 2014-11-21 17:21:33 +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
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
Edward Thomson
93b982b1c8 Merge pull request #2654 from linquize/missing-obj
Fix missing object in tests/resources/crlf by changing the tail commit
2014-11-18 12:12:19 -05: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
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
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
6eb9e39ce0 push: move main test function to git_remote_push()
We have the step-by-step method in the initialization function as we
want to remove references based on the list of references which are
already there, and we can use the convenience function for testing the
main 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
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
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
Carlos Martín Nieto
f1a7906fdf submodules: add failing test for stale module entries
We consider an entry in .gitmodules to mean that we have a submodule at
a particular path, even if HEAD^{tree} and the index do not contain any
reference to it.

We should ignore that submodule entry and simply consider that path to
be a regular directory.
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
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
0798b01400 ignore: add failing test for a file mentioning the parent
When we mention "src" in src/.gitignore, we wrongly consider src/ itself
to be ignored.
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
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
ea8dedc953 remote: fix tagopt test
An anonymous remote wouldn't create remote-tracking branches, so testing
we don't create them for TAGS_ALL is nonsensical. Furthermore, the name
of the supposed remote-tracking branch was also not one which would have
been created had it had a name.

Give the remote a name and test that we only create the tags when we
pass TAGS_ALL and that we do create the remote-branch branch when given
TAGS_AUTO.
2014-11-02 20:39:29 +01:00
Carlos Martín Nieto
0f838d27f1 remote: add a failing test for checking the current branch's upstream
When we update FETCH_HEAD we check whether the remote is the current
branch's upstream remote. The code does not check whether the current
refspec is relevant for this reference but always tries to perform the
reverse transformation, which causes it to error out if the refspec
doesn't match the reference.

Thanks to Pierre-Olivier Latour for the reproduction recipe.
2014-11-02 20:03:23 +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
Edward Thomson
53ca45ee25 revert tests: always use core.autocrlf=false in tests 2014-10-27 17:27:25 -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
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
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
14864fbfeb git_rebase_next: test that we return GIT_ITEROVER 2014-10-26 22:59:23 -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
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
4b1b2bd9eb revwalk::mergebase test: free memory 2014-10-26 22:27:58 -04:00
Edward Thomson
e4985fe3a9 submodule test: free submodule 2014-10-26 22:27:54 -04:00
Edward Thomson
16288d2db3 clone::local test: isalpha -> git__isalpha 2014-10-26 22:27:50 -04:00
Edward Thomson
90aa2bf39b config test: clean up memory leak 2014-10-26 22:27:48 -04:00
Edward Thomson
cdd71711ce Clean up some memory leaks 2014-10-26 22:27:44 -04:00
Carlos Martín Nieto
fad0aea9fe tests: fix leak 2014-10-27 01:47:40 +01:00
Linquize
9223f2884c Fix test repo dir not deleted after running 2014-10-27 01:06:28 +08:00
Linquize
81f1fc7142 Fix missing object in tests/resources/crlf by changing the tail commit 2014-10-26 11:41:01 +08: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
a747ea49c9 Merge pull request #2647 from ethomson/clar_tmpname
clar: use a custom temp directory name
2014-10-24 14:01:13 -07:00
Edward Thomson
29eed1c74d clar: use a custom temp directory name 2014-10-24 10:50:57 -04: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
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
Alan Rogers
1e2fe921a5 Change the length of the file so that the change is picked up. 2014-10-23 15:21:29 +11:00
Alan Rogers
5490c9d470 Add a test to make sure a new snapshot has the new value. 2014-10-23 15:21:04 +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
8d3b2ee3d7 Introduce failing test for conflict filtering in index 2014-10-13 13:36:16 -04: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
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
ee4db1c16e index: add tests for the tree cache
These test that we invalidate at the right levels and that we remove the
tree cache when clearing the index.
2014-10-10 19:35:19 +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
942a7b39ed Fix test build
Some PRs have fallen out of sync with the changes in signatures, so we
need to take a few extra parameters into account.
2014-10-10 18:03:09 +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
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
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
Arthur Schreiber
19fa9c0ca0 New test files for the javascript diff driver. 2014-10-09 22:14:55 +02: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
Sven Strickroth
db3d169c33 Add tests for host names
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-10-09 17:32:38 +02:00
Edward Thomson
8371457ce2 Merge pull request #2597 from ethomson/fixup
Trivial fixups
2014-10-09 11:32:26 -04: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
eca07bcd83 Add git_merge_bases_many. 2014-10-09 14:19:00 +02:00
Linquize
a447a7e40b config: Add test cases that have trailing spaces before comment chars 2014-10-04 23:28:40 +08:00
Edward Thomson
ca7cd1734d p_mkdir != mkdir on win32 2014-10-03 19:30:48 -04:00
Vicent Marti
737b505116 hashsig: Export as a sys header 2014-10-01 12:03: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
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
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
9c206a2248 remote: use active refspec override in the tests
This lets us test this bit as well as getting closer to what they were
trying to do.
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
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
5431c46a96 describe: use globs in the tests
This makes us be closer to git's tests, and lets us better describe what
we expect from the output.
2014-09-30 09:05:55 +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
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
0478b7f472 Silence unused return value warning 2014-09-26 12:12:09 +02:00
Jakub Čajka
7629ea5d8d Fixed odb foreach test failure for big-endian 64-bit 2014-09-26 12:12:08 +02:00
Jakub Čajka
d99e547173 Fixed merge REUC test for big-endian 64-bit 2014-09-26 12:12:08 +02:00
Jacques Germishuys
940da54861 Added test for stashing files in ignored directories 2014-09-24 13:24:06 +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
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
Ciro Santilli
c5cf8cade3 Replace void casts with GIT_UNUSED. 2014-09-17 15:19:08 +02:00
The rugged tests are fragile
4cb7c4a4c7 attr: Add an extra test for files under a subfolder 2014-09-17 15:08:16 +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
52e09724fd ssh: skip the localhost cert check earlier
Skip it before we attempt to clone, as we would exit with -1 on systems
which do not have sshd running.
2014-09-16 17:13:58 +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
bf8756d6a2 ssh: add test for host key
Test that the certificate check callback gets the right fingerprint from
the host we're connecting to.
2014-09-16 17:01:32 +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
85acc56262 remote: add tests for the certificate callback 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
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
493c340cef Added test case to illustrate bogus conflicts detected if no files were merged, and untracked files exist in the workdir. 2014-09-12 22:01:22 +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
Linquize
d908351a6c When auto follow tags, FETCH_HEAD should list only newly followed tags 2014-09-06 00:26:56 +08: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
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
Vicent Marti
0ac9f9a0c7 Merge pull request #2545 from linquize/no-ssh
Skip SSH clone tests if libgit2 not built with GIT_SSH defined
2014-09-03 00:13:23 +02:00
Linquize
8deea5899d Add network::fetchlocal multi remotes test 2014-09-02 21:28:21 +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
538f908175 remote: add test for single-branch clone
When cloning, we may be asking for a particular branch or subset of
branches. Make sure we test for that.
2014-09-02 12:47:12 +02:00
Carlos Martín Nieto
f2ffab618a remote: add tests for remote-branch edge cases
Add tests for the case when there are no branches on the remote and when
HEAD is detached but has the id of a non-branch. In both of these cases,
we should return ENOTFOUND.
2014-09-02 12:47:12 +02:00
Linquize
fe3b67891b Skip SSH clone tests if libgit2 not built with GIT_SSH defined 2014-09-01 19:18:20 +08:00
Carlos Martín Nieto
05ac70514f remote: test for supported URLs in a single place
Instead of using ifdefs to run the tests, use them to set when we expect
to support a particular scheme and always have the tests in the code.
2014-08-31 21:53:42 +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
Linquize
aff7001825 MSVC does not support zero size array 2014-08-31 22:43:53 +08: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
94412b009e remote: assert what we want to happen when ther is no default branch
Assert what we already do, so as to notice changes.
2014-08-29 15:28:10 +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
e07aebb4e2 Fix ahead-behind tests
The logic was reversed. I have checked manually each pair with git and
adjusted the expectation to what git status prints.
2014-08-28 13:34:42 +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
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