Commit Graph

1139 Commits

Author SHA1 Message Date
Sebastian Bauer
c253056d24 Added git_branch_name().
This is a convenience function to get the branch name of a given
ref. The returned branch name is compatible with the name that can
be supplied e.g. to git_branch_lookup(). That is, the prefixes
"refs/heads" or "refs/remotes" are omitted.

Also added a new test for testing the new function.
2013-01-25 05:24:21 +01:00
Philip Kelley
2ff4469afc Leak cleanup in push tests 2013-01-24 14:04:35 -05:00
Philip Kelley
3fbd7485d8 Merge pull request #1250 from jamill/push_update_tips
Update remote tips on push
2013-01-24 11:03:11 -08:00
Vicent Marti
0d52cb4aea opts: Some basic tests 2013-01-24 00:09:55 +01:00
Russell Belfer
8958fad770 Merge pull request #1270 from libgit2/packed-peeled-objects-fix
Allow peeled references without trailing newline at end of file
2013-01-22 16:02:43 -08:00
Scott J. Goldman
5c7b77c4f8 Seperate out a new test that verifies packed-refs with no trailing newline
as per @vmg's request
2013-01-22 16:01:03 -08:00
Scott J. Goldman
cb35094be3 Allow peeled references without trailing newline at end of file
Also ammends one of the tag tests to make sure it's working.
2013-01-22 15:49:51 -08:00
Russell Belfer
cce548e3e0 Fix case sensitivity bug with tree iterators
With the new code to make tree iterators support ignore_case,
there is a bug in setting the start entry for range bounded
iterators where memcmp was being used instead of strncasecmp.
This fixes that and expands the tree iterator test to cover
the cases that were broken.
2013-01-22 15:28:25 -08:00
Jameson Miller
1d645aabef Update remote tips on push 2013-01-22 10:01:43 -05:00
Russell Belfer
e8a92fe107 Update clar to a80e7f30 2013-01-21 13:39:53 -08:00
Russell Belfer
965e4e2d31 Parse commit time as uint64_t to avoid overflow
The commit time is already stored as a git_time_t, but we were
parsing is as a uint32_t.  This just switches the parser to use
uint64_t which will handle dates further in the future (and adds
some tests of those future dates).
2013-01-21 13:19:41 -08:00
Zhao Cheng
c55c624441 Fix linking error caused by ddcb28a41f. 2013-01-18 13:22:55 +08:00
Vicent Martí
ddcb28a41f Merge pull request #1239 from ethomson/index_remove
add an index_remove_bypath that removes conflicts
2013-01-17 16:56:57 -08:00
Vicent Martí
3a93ab9065 Merge pull request #1256 from arrbee/asciify-test-data
Move all non-ascii test data to raw hex
2013-01-17 16:33:40 -08:00
Edward Thomson
271680d7f4 add a git config, don't run crlf tests on non-win32 2013-01-17 18:18:44 -06:00
Russell Belfer
f63d0ee9fc Move all non-ascii test data to raw hex
This takes all of the characters in core::env and makes them use
hex sequences instead of keeping tricky character data inline in
the test.
2013-01-17 15:47:10 -08:00
Ben Straub
c49fa037cc Merge pull request #1247 from sba1/dont-segfault-if-transport-doesnt-support-push
Don't segfault if transport doesn't support push.
2013-01-17 13:37:32 -08:00
Vicent Martí
5c8901ab80 Merge pull request #1255 from arrbee/fix-signed-commit-header-parsing
Add skipping of unknown commit headers
2013-01-17 13:36:33 -08:00
Sebastian Bauer
b90eb84ff9 Test that pushs properly fail for transports that don't provide a push implementation. 2013-01-17 22:32:37 +01:00
Russell Belfer
291090a076 Add skipping of unknown commit headers
This moves the check for the "encoding" header into a loop which
is just scanning for non-required headers at the end of a commit
header.  That loop will skip unrecognized lines (including header
continuation lines) until a terminating completely blank line is
found, and only then does it move to reading the commit message.
2013-01-17 13:19:09 -08:00
Edward Thomson
6e959708e5 cache should contain on-disk (filtered) file size 2013-01-17 15:17:32 -06:00
Vicent Martí
34a4ad46e8 Merge pull request #1211 from arrbee/fix-icase-status-file
Fix case insensitivity issues in git_status_file
2013-01-16 15:52:58 -08:00
nulltoken
bf031581d3 branch: Introduce git_branch_tracking_name() 2013-01-16 22:56:13 +01:00
Russell Belfer
25423d03b8 Support case insensitive tree iterators and status
This makes tree iterators directly support case insensitivity by
using a secondary index that can be sorted by icase.  Also, this
fixes the ambiguity check in the git_status_file API to also be
case insensitive.  Lastly, this adds new test cases for case
insensitive range boundary checking for all types of iterators.

With this change, it should be possible to deprecate the spool
and sort iterator, but I haven't done that yet.
2013-01-15 09:51:35 -08:00
Russell Belfer
a49340c3e5 Test for ignore_case ranges on workdir iterator
This adds a test that confirms that the working directory iterator
can actually correctly process ranges of files case insensitively
with proper sorting and proper boundaries.
2013-01-15 09:51:34 -08:00
Russell Belfer
134d8c918c Update iterator API with flags for ignore_case
This changes the iterator API so that flags can be passed in to
the constructor functions to control the ignore_case behavior.
At this point, the flags are not supported on tree iterators (i.e.
there is no functional change over the old API), but the API
changes are all made to accomodate this.

By the way, I went with a flags parameter because in the future
I have a couple of other ideas for iterator flags that will make
it easier to fix some diff/status/checkout bugs.
2013-01-15 09:51:34 -08:00
Russell Belfer
4b18103755 Minor iterator API cleanups
In preparation for further iterator changes, this cleans up a few
small things in the iterator API:

* removed the git_iterator_for_repo_index_range API
* made git_iterator_free not be inlined
* minor param name and test function name tweaks
2013-01-15 09:49:32 -08:00
nulltoken
bcbb1e201b status: Enhance git_status_file() test coverage 2013-01-15 09:49:32 -08:00
Russell Belfer
230010d19b Merge pull request #1238 from nulltoken/fix/checkout-index
checkout: Teach checkout to cope with orphaned Head
2013-01-15 09:46:50 -08:00
Russell Belfer
848d77dc83 Merge pull request #1242 from sba1/init-with-template-fix
Some fixes for external template support
2013-01-14 10:05:35 -08:00
Sebastian Bauer
72719e7333 Altered the description of the template.
Before, it was identical to the default template making it difficult
to check, if the proper template was copied an external template
test.
2013-01-13 12:26:52 +01:00
Sebastian Bauer
5885ba112d Now checks in the template test whether the description file has
been properly copied.

This is a minimal effort to test whether the template really has
been used when creating an repo with external templates.
2013-01-13 12:26:52 +01:00
nulltoken
5b524d6902 Fix Travis compilation warnings 2013-01-13 10:25:55 +01:00
nulltoken
2a3b3e0324 checkout: Teach checkout to cope with orphaned Head
Fix #1236
2013-01-13 10:25:54 +01:00
Edward Thomson
25743bd7c5 add an index_remove_bypath that removes conflicts, renamed add_from_workdir to match 2013-01-12 13:47:56 -06:00
Carlos Martín Nieto
0b3aa7bede tests: plug leaks 2013-01-12 19:01:45 +01:00
Sebastian Bauer
4a4aee1112 Added flag GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE to test_repo_init__extended_with_template().
Otherwise the template functionallity is not tested (as a TODO we
also shall test that the specified template really got copied).
2013-01-12 18:44:50 +01:00
Vicent Martí
e2d2c6e57d Merge pull request #1222 from scunz/clone_branch
Switch to specified branch during clone
2013-01-12 02:14:14 -08:00
Philip Kelley
359316b5d3 Merge pull request #1215 from phkelley/binaryunicode
Add a failing test for CRLF filters
2013-01-11 17:16:55 -08:00
Philip Kelley
dd6367e37e Fix up binaryunicode test repo 2013-01-11 20:07:52 -05:00
Sascha Cunz
f1d4a35e94 Tests: Add test for check out of given branch during clone 2013-01-12 00:08:48 +01:00
Sascha Cunz
b5b2812097 Test: Cleanup some cleaning code 2013-01-12 00:07:44 +01:00
Vicent Martí
160e4fb792 Merge pull request #1230 from arrbee/match-core-git-diff-binary-detection
Match binary file check of core git in diff
2013-01-11 11:35:09 -08:00
Vicent Martí
6e19edaa40 Merge pull request #1229 from arrbee/fix-diff-patch-line-numbers
Fix diff patch line number calculation
2013-01-11 11:34:13 -08:00
Russell Belfer
0d65acade8 Match binary file check of core git in diff
Core git just looks for NUL bytes in files when deciding about
is-binary inside diff (although it uses a better algorithm in
checkout, when deciding if CRLF conversion should be done).
Libgit2 was using the better algorithm in both places, but that
is causing some confusion.  For now, this makes diff just look
for NUL bytes to decide if a file is binary by content in diff.
2013-01-11 11:24:26 -08:00
Russell Belfer
805c476c83 Fix diff patch line number calculation
This was just wrong.  Added a test that verifying patch line
numbers even for hunks further into a file and then fixed the
algorithm.  I needed to add a little extra state into the patch
so that I could track old and new file numbers independently,
but it should be okay.
2013-01-11 11:20:44 -08:00
nulltoken
f3738eba56 Fix MSVC Clar compilation warnings 2013-01-11 19:31:00 +01:00
nulltoken
090d5e1fda Fix MSVC compilation warnings 2013-01-11 19:30:59 +01:00
nulltoken
4a0ac175ca checkout: Deploy EMERGECONFLICT usage 2013-01-11 19:30:58 +01:00
nulltoken
cce2f16b9d Fix indentations 2013-01-11 19:30:56 +01:00
Carlos Martín Nieto
2086e1baef tests: plug a couple of leaks 2013-01-11 16:54:57 +01:00
Russell Belfer
40342bd2b6 Add GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH
This adds an option to checkout a la the diff option to turn off
fnmatch evaluation for pathspec entries.  This can be useful to
make sure your "pattern" in really interpretted as an exact file
match only.
2013-01-10 15:15:37 -08:00
Vicent Martí
404880b1ba Merge pull request #1206 from ben/stock-auth
Expose stock user/pass credential utility
2013-01-10 11:24:09 -08:00
Edward Thomson
eb3c247a78 REUC needs to handle empty sides 2013-01-10 11:56:02 -06:00
Ben Straub
520dcc1c00 Move credential helpers to their own (optional) header 2013-01-09 13:31:17 -08:00
Ben Straub
ffb02b1630 Expose stock user/pass credential utility 2013-01-09 13:31:17 -08:00
Philip Kelley
fcc48d1fce Add a failing test for autocrlf filters 2013-01-09 12:37:22 -05:00
Michael Schubert
abeefbbe18 push: properly handle tags
Currently, push doesn't really handle tags when queueing objects. Fix
it.
2013-01-09 17:05:21 +01:00
Michael Schubert
f85b62840a tests-clar/network: remove unused CREATE_BLOB 2013-01-09 16:44:12 +01:00
Jameson Miller
087f64d3e3 Relax refspecs accepted by push 2013-01-09 16:15:58 +01:00
Russell Belfer
de59055017 Resolve crash with diff against empty file
It is not legal inside our `p_mmap` function to mmap a zero length
file.  This adds a test that exercises that case inside diff and
fixes the code path where we would try to do that.

The fix turns out not to be a lot of code since our default file
content is already initialized to "" which works in this case.

Fixes #1210
2013-01-08 17:11:11 -08:00
Russell Belfer
f2b7f7a6cb Share git_diff_blobs/git_diff_blob_to_buffer code
This moves the implementation of these two APIs into common code
that will be shared between the two.  Also, this adds tests for
the `git_diff_blob_to_buffer` API.  Lastly, this adds some extra
`const` to a few places that can use it.
2013-01-07 15:44:22 -08:00
Edward Thomson
c31ae146b4 merge cleanup should actually cleanup and the test should actually test 2013-01-06 18:38:29 -06:00
Vicent Martí
74f880a639 Merge pull request #1197 from nulltoken/travis/run-online-tests
travis: Include the online suite when running against Travis
2013-01-06 07:56:08 -08:00
nulltoken
b97fabfad5 tests: Fix some memory leaks 2013-01-06 16:22:24 +01:00
Vicent Martí
d74b1bc529 Merge pull request #1131 from libgit2/correct-ahead-behind
Fix an issue with ahead-behind for lopsided traversal
2013-01-05 15:44:19 -08:00
Russell Belfer
2f0895393d Actually fix win32 checkout test
It turns out that using REMOVE_UNTRACKED with checkout for this
particular test was causing the .gitattributes file to be removed
and so we do have to allow for the CRs in the created file...
2013-01-04 17:17:37 -08:00
Russell Belfer
bebdbcd442 Fix crlf issue with checkout tests
Move some checkout utility functions into a shared file and fix
some crlf filtering issues when verifying file contents.
2013-01-04 16:56:21 -08:00
Russell Belfer
817d625161 Fix checkout of index-only dirs and prefixed paths
There are a couple of checkout bugs fixed here.  One is with
untracked working directory entries that are prefixes of tree
entries but not in a meaningful way (i.e. "read" is a prefix of
"readme.txt" but doesn't interfere in any way).  The second bug
is actually a redo of 07edfa0fc640f85f95507c3101e77accd7d2bf0d
where directory entries in the index that are not in the diff
were not being removed correctly.  That fix remedied one case
but broke another.
2013-01-04 15:47:44 -08:00
Russell Belfer
7fc0043582 Add index API to remove all files in a directory
This adds the git_index_remove_directory API plus tests.
2013-01-04 15:47:44 -08:00
Russell Belfer
d8889d2b64 Fix checkout bug rmv untracked trees from index
When checking out with the GIT_CHECKOUT_REMOVE_UNTRACKED option
and there was an entire tree in the working directory and in the
index that is not in the baseline nor target commit, the tree was
correctly(?) removed from the working directory but was not
successfully removed from the index.  This fixes that and adds a
test of the functionality.
2013-01-04 15:47:44 -08:00
Russell Belfer
0d70f65051 Fixing checkout UPDATE_ONLY and adding tests
This adds a bunch of new checkout tests and in the process I found
a bug in the GIT_CHECKOUT_UPDATE_ONLY flag which I fixed.
2013-01-04 15:47:44 -08:00
Russell Belfer
b3fb9237c2 Clone should use GIT_CHECKOUT_SAFE_CREATE
For clone to work as expected, it should be using a SAFE_CREATE
checkout (i.e. create files that are missing, even if the target
tree matches the current HEAD).
2013-01-04 15:47:43 -08:00
Russell Belfer
c50c58decd Extend tests for checkout with typechanges
Test a number of other cases, including intentionally forced
conflicts and deeper inspection that trees get created properly.

There is a still a bug in checkout because the first test here
(i.e. test_checkout_typechange__checkout_typechanges_safe) should
be able to pass with GIT_CHECKOUT_SAFE as a strategy, but it will
not because of some lingering submodule checkout issues.
2013-01-04 15:47:43 -08:00
Russell Belfer
a6a82e1a59 Improve error propagation in stash
Stash was sometimes obscuring the actual error code, replacing it
with a -1 when there was more descriptive value.  This updates
stash to preserve the original error code more reliably along
with a variety of other error handling tweaks.

I believe this is an improvement, but arguably, preserving the
underlying error code may result in values that are harder to
interpret by the caller who does not understand the internals.
Discussion is welcome!
2013-01-04 15:47:42 -08:00
Russell Belfer
8fe713ccf7 Make git_oid_tostr use out buffer for NULL oid
Previously a NULL oid was handled like an empty buffer and
returned a status empty string.  This makes git_oid_tostr()
set the output buffer to the empty string instead.
2013-01-04 15:47:42 -08:00
Russell Belfer
5cf9875a4f Add index updating to checkout
Make checkout update entries in the index for all files that are
updated and/or removed, unless flag GIT_CHECKOUT_DONT_UPDATE_INDEX
is given.  To do this, iterators were extended to allow a little
more introspection into the index being iterated over, etc.
2013-01-04 15:47:42 -08:00
Russell Belfer
7e5c8a5b41 More checkout improvements
This flips checkout back to be driven off the changes between
the baseline and the target trees.  This reinstates the complex
code for tracking the contents of the working directory, but
overall, I think the resulting logic is easier to follow.
2013-01-04 15:47:42 -08:00
Russell Belfer
cf20803170 Rework checkout internals (again)
I've tried to map out the detailed behaviors of checkout and make
sure that we're handling the various cases correctly, along with
providing options to allow us to emulate "git checkout" and "git
checkout-index" with the various flags.  I've thrown away flags
in the checkout API that seemed like clutter and added some new
ones.  Also, I've converted the conflict callback to a general
notification callback so we can emulate "git checkout" output and
display "dirty" files.

As of this commit, the new behavior is not working 100% but some
of that is probably baked into tests that are not testing the
right thing.  This is a decent snapshot point, I think, along the
way to getting the update done.
2013-01-04 15:47:42 -08:00
Jameson Miller
c5df10f4aa Failing test on git_checkout_tree when removing directories 2013-01-04 15:23:47 -08:00
Marvin Gülker
d0951175d4 Add failing test to demonstrate wrong checkout behaviour 2013-01-04 15:23:47 -08:00
Russell Belfer
e9e20c8474 Update cl_git_pass to return more info
This adds a failure reporting function that is called by
cl_git_pass which captures the actual error return code and
the error message if available in the failure report.
2013-01-04 15:23:47 -08:00
Vicent Marti
6040616214 clar: lolpython 2013-01-04 20:28:33 +01:00
Vicent Marti
3a4a961da5 clar: Corrupted pickles 2013-01-04 20:25:57 +01:00
Vicent Martí
c18a5ec58c Merge pull request #1174 from nulltoken/topic/soft_reset_with_index_conflicts
Prevent soft reset when index contains conflicts
2013-01-04 11:10:39 -08:00
Carlos Martín Nieto
702c3bf70e clar: make it compatible with python3 2013-01-04 19:03:02 +00:00
Vicent Marti
1d5d418671 clar: haha 2013-01-04 20:02:01 +01:00
Vicent Marti
73b58c9159 clar: fix warning on Windows 2013-01-04 20:00:09 +01:00
nulltoken
9a0d590412 reset: Cannot soft reset with a conflicted index 2013-01-04 18:43:34 +01:00
Vicent Martí
52ee071b35 Merge pull request #1189 from martinwoodward/tests-compliance
Add jGit license block to derrived tests
2013-01-04 09:33:54 -08:00
Martin Woodward
ba1a430a8b Add jGit license block to derrived tests
Add the jGit license block to tests derrived from jGit as per the
terms of the BSD license.
2013-01-04 17:29:45 +00:00
Vicent Marti
a7ffd936bf clar: fix merge/setup.c 2013-01-04 17:47:52 +01:00
Edward Thomson
5a62d659bc MERGE_HEAD contents iterator 2013-01-04 17:47:51 +01:00
Congyi Wu
d73d52dfcb Fix bug in gen_pktline() for deletes of missing remote refs
* gen_pktline() in smart_protocol.c was skipping refspecs that deleted
  refs that were not advertised by the server.  The new behavior is to
  send a delete command with an old-id of zero, which matches the behavior
  of the official git client.
* Update test_network_push__delete() in reaction to above fix.
* Obviate messy logic that handles missing push_spec rrefs by canonicalizing
  push_spec.  After calculate_work(), loid, roid, and rref, are filled in with
  exactly what is sent to the server
2013-01-04 17:47:51 +01:00
Nikolai Vladimirov
b60b4562fe add option to allow git note overwrite 2013-01-04 17:47:51 +01:00
Russell Belfer
b8a1ea7cf9 Fix core::env cleanup code
Mark fake home directories that failed to be created, so we won't
try to remove them and have cleanup just use p_rmdir.
2013-01-03 11:04:03 -08:00
Vicent Marti
54254a0fe2 Status tests... 2013-01-03 19:38:29 +01:00
Vicent Marti
7b51d675e8 Even more cleanups 2013-01-03 19:17:07 +01:00
Vicent Marti
f6fded8f91 Proper cleanup jeez 2013-01-03 19:07:41 +01:00
Ben Straub
600d8dbf6d Move test cleanup into cleanup functions 2013-01-03 09:10:38 -08:00
Ben Straub
bffbeebbec Cleanup after tests 2013-01-03 08:38:00 -08:00
Ben Straub
6fef1ab344 Tests should clean up after themselves 2013-01-03 07:47:51 -08:00
Nikolai Vladimirov
8716b499e2 add option to allow git note overwrite 2013-01-03 16:31:36 +02:00
Vicent Marti
7761ce2162 Merge branch 'development' into clar2
Conflicts:
	tests-clar/clone/nonetwork.c
	tests-clar/online/clone.c
	tests-clar/online/fetchhead.c
2013-01-03 04:24:12 +01:00
Vicent Marti
2e6f06a8d4 ...and add Clar raw 2013-01-03 02:34:45 +01:00
Vicent Marti
8ee7174be9 Remove the clar submodule 2013-01-03 02:22:42 +01:00
Vicent Marti
f46769e52a Fix network suite 2013-01-03 02:13:37 +01:00
Vicent Marti
6443eaf22f Disable Network suite by default 2013-01-03 00:50:29 +01:00
Ben Straub
922dd9788c Move some clone tests to the nonetwork suite 2013-01-02 13:54:37 -08:00
Vicent Martí
cd5ca5b97f Merge pull request #1152 from ben/clone-api-structification
Segregate in-memory and persisted remotes
2013-01-02 13:50:41 -08:00
Ben Straub
730df6d0f7 Include checkout options inline 2013-01-02 13:43:54 -08:00
Vicent Marti
39cd01779c This is a better name 2013-01-02 22:38:10 +01:00
Ben Straub
0642c1431e Move url to last place in parameter list 2013-01-02 12:44:47 -08:00
Vicent Marti
5c2d3f6d5d Add build dependency for clar. Also, fuck you CMake. Fuck you. 2013-01-02 04:19:13 +01:00
Vicent Marti
b0a4582975 Bump the Clar submodule 2013-01-02 02:05:11 +01:00
Vicent Marti
156cfec096 Cleanup Clar to make it SIMPLER 2013-01-02 02:05:11 +01:00
nulltoken
50a762a563 path: Teach UNC paths to git_path_dirname_r()
Fix libgit2/libgit2sharp#256
2012-12-26 23:07:25 +01:00
nulltoken
34b6f05f39 path: enhance git_path_dirname_r() test coverage 2012-12-26 11:59:07 +01:00
nulltoken
19c3c99ca8 remote: remove duplicated test 2012-12-24 18:18:40 +01:00
nulltoken
f19304d265 remote: Prevent create() from blindly overwriting 2012-12-24 18:18:31 +01:00
nulltoken
b0aa14aa3c remote: Enhance in-memory remote test coverage 2012-12-24 16:54:27 +01:00
nulltoken
6bd09ecc14 Fix MSSVC compilation issue 2012-12-24 16:54:26 +01:00
Ben Straub
2808ec9ab4 Rename test to make @nulltoken happy 2012-12-21 13:15:37 -08:00
Ben Straub
79000951ec In-memory remotes don't have names 2012-12-21 08:05:59 -08:00
Ben Straub
874dcb25eb Remote: deprecate dangling, prevent saving in-memory 2012-12-20 12:01:13 -08:00
Ben Straub
29f27599ea Rename remote creation APIs
git_remote_add -> git_remote_create
git_remote_new -> git_remote_create_inmemory
2012-12-20 10:52:57 -08:00
Ben Straub
621b50e4d5 Clone: trust but verify 2012-12-19 17:02:06 -08:00
Ben Straub
b412d56389 Add more clone options. Push test suite segfaults. 2012-12-19 17:02:06 -08:00
Edward Thomson
7fcec83428 fetchhead reading/iterating 2012-12-19 16:57:30 -06:00
Sascha Cunz
d5cf4665a9 Fix some leaks and (possibly) dangling pointers in tests
Also adds some asserts.
2012-12-19 08:04:31 +01:00
Sascha Cunz
96a289f5f3 clone-empty-test: Don't use one pointer for two things
... so we can clean up correctly.
2012-12-19 05:24:23 +01:00
Sascha Cunz
3dc0207bc0 revwalk-test: Don't leak the second repository 2012-12-19 05:22:46 +01:00
Sascha Cunz
26290cd13b Reset global variable to NULL after free'ing resource 2012-12-18 19:52:37 +01:00
Vicent Martí
e62171e2fc Merge pull request #1151 from arrbee/fix-diff-constructor-names
Fix diff constructor names
2012-12-17 11:10:25 -08:00
Russell Belfer
56c72b759c Fix diff constructor name order confusion
The diff constructor functions had some confusing names, where the
"old" side of the diff was coming after the "new" side.  This
reverses the order in the function name to make it less confusing.

Specifically...

* git_diff_index_to_tree becomes git_diff_tree_to_index
* git_diff_workdir_to_index becomes git_diff_index_to_workdir
* git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
2012-12-17 11:00:53 -08:00
Vicent Martí
0d10e79dd9 Merge pull request #1149 from nulltoken/topic/blob_isbinary
Introduce git_blob_is_binary()
2012-12-17 10:13:36 -08:00
nulltoken
a3337f10bb blob: introduce git_blob_is_binary() 2012-12-17 17:20:31 +01:00
Sascha Cunz
22d23c61ed Cleanup the test correctly 2012-12-17 17:15:58 +01:00
Ben Straub
c4e3e797d1 Ensure static variables are nulled after every test 2012-12-16 12:27:11 -08:00
Ben Straub
a7f125cdba Fix fetchhead tests 2012-12-15 14:56:20 -08:00
Ben Straub
57f5d8dca5 Remove placeholder files during tests 2012-12-14 14:15:42 -08:00
Ben Straub
1164acde96 Rebase fixup 2012-12-14 14:00:35 -08:00
Ben Straub
850b1edfe8 Allow clone to handle empty repos 2012-12-14 13:58:44 -08:00
Ben Straub
b9e7e2b4e1 Move non-options back out of options struct 2012-12-14 13:46:45 -08:00
Ben Straub
18b2d560d3 Deploy git_clone_options; remove git_clone_bare 2012-12-14 13:03:59 -08:00
Vicent Marti
2d466b7dcb tests: Fix unused temp repo 2012-12-14 02:49:11 +01:00
Vicent Marti
509216a5b2 test: Fix clone tests 2012-12-14 02:49:01 +01:00
Vicent Marti
b0b9fd3245 Merge remote-tracking branch 'origin/clone-auth' into development 2012-12-14 02:41:53 +01:00
Jameson Miller
8a8820d89f Add test to clone with absolute path 2012-12-13 17:58:12 -05:00
Ben Straub
24393ea6d3 Stop premature remote freeing when cloning 2012-12-13 09:14:56 -08:00
Ben Straub
7c353afd0e Define constant for default fetch spec 2012-12-13 08:47:29 -08:00
Ben Straub
44f36f6e3b Convert clone to use dangling remotes 2012-12-12 19:48:44 -08:00
Ben Straub
b914e17d82 API to set a dangling remote's repository 2012-12-12 12:23:24 -08:00
Ben Straub
a71c27ccda Allow creation of dangling remotes 2012-12-12 12:15:25 -08:00
Russell Belfer
91e7d26303 Fix iterator reset and add reset ranges
The `git_iterator_reset` command has not been working in all cases
particularly when there is a start and end range.  This fixes it
and adds tests for it, and also extends it with the ability to
update the start/end range strings when an iterator is reset.
2012-12-10 15:38:41 -08:00
Russell Belfer
9950d27ab6 Clean up iterator APIs
This removes the need to explicitly pass the repo into iterators
where the repo is implied by the other parameters.  This moves
the repo to be owned by the parent struct.  Also, this has some
iterator related updates to the internal diff API to lay the
groundwork for checkout improvements.
2012-12-10 15:38:28 -08:00
Ben Straub
59bccf33c4 Add a payload param to git_cred_acquire_cb
Fixes #1128.
2012-12-10 11:11:01 -08:00
Ben Straub
72629a10e3 Clean up GCC build warnings 2012-12-10 10:05:31 -08:00
Scott J. Goldman
b337814e70 Fix no_common_ancestor test for ahead_behind count
Ahead-behind count is still a valid operation, even if the two
commits don't have a common merge-base. The old implementation was
buggy, so it returned ENOTFOUND. Fixed now.
2012-12-09 21:04:32 -08:00
Carlos Martín Nieto
f1c75b94a1 tree: relax the filemode parser
There are many different broken filemodes in the wild so we need to
protect against them and give something useful up the chain. Don't
fail when reading a tree from the ODB but normalize the mode as best
we can.

As 664 is no longer a mode that we consider to be valid and gets
normalized to 644, we can stop accepting it in the treebuilder. The
library won't expose it to the user, so any invalid modes are a bug.
2012-12-07 16:59:18 +01:00
Vicent Marti
a9c07c47ea tests: MSVC fix 2012-12-05 21:06:54 +01:00
Vicent Marti
bf192cdb43 versions: MSVC build fixes 2012-12-05 20:56:27 +01:00
Vicent Martí
e05ca13f1f Merge pull request #1115 from ben/struct-versions
Version info for public structs
2012-12-05 11:47:19 -08:00
Edward Thomson
b241466133 status should ignore conflicts entries in the index 2012-12-03 14:51:39 -06:00
Ben Straub
de70aea6b1 Remove GIT_SIGNATURE_VERSION and friends 2012-12-03 12:41:50 -08:00
nulltoken
cc1466264a revparse: Deploy EINVALIDSPEC usage 2012-12-01 08:34:31 +01:00
nulltoken
84166facc9 revparse: remove timezone setup in tests 2012-12-01 08:34:30 +01:00
nulltoken
bc05f30c47 object: refine git_object_peel() error report 2012-12-01 08:34:29 +01:00
nulltoken
621730383a branch: Deploy EINVALIDSPEC usage 2012-12-01 08:34:28 +01:00
nulltoken
18d6f12040 tag: Deploy EINVALIDSPEC usage 2012-12-01 08:34:28 +01:00
nulltoken
80212ecb1c reflog: Deploy EINVALIDSPEC usage 2012-12-01 08:34:27 +01:00
nulltoken
e4aa7f58fe refs: cover git_reference_name_to_oid() unfound behavior 2012-12-01 08:34:26 +01:00
nulltoken
80d9d1df14 refs: Deploy EINVALIDSPEC usage 2012-12-01 08:34:26 +01:00
nulltoken
47261d9c8a tests: drop unused variables 2012-12-01 08:34:25 +01:00
nulltoken
032ba9e4ad remote: deploy EINVALIDSPEC usage 2012-12-01 08:34:23 +01:00
nulltoken
3da73c40fc Fix compilation warnings 2012-12-01 08:34:21 +01:00
Ben Straub
0ab3a2ab2c Deploy GIT_INIT_STRUCTURE 2012-11-30 20:34:50 -08:00
Ben Straub
1071176900 Deploy versioned git_transport structure 2012-11-30 13:12:15 -08:00
Ben Straub
79cfa20d60 Deploy GIT_STATUS_OPTIONS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
b4d136527c Deploy GIT_REPOSITORY_INIT_OPTIONS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
9267ff586f Deploy GIT_REMOTE_CALLBACKS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
55f6f21b7d Deploy versioned git_odb_backend structure 2012-11-30 13:12:15 -08:00
Ben Straub
ca901e7b0f Deploy GIT_DIFF_FIND_OPTIONS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
2f8d30becb Deploy GIT_DIFF_OPTIONS_INIT 2012-11-30 13:12:14 -08:00
Ben Straub
6917762139 Deploy git_config_backend version 2012-11-30 13:12:14 -08:00
Ben Straub
b81aa2f1de Deploy GIT_CHECKOUT_OPTS_INIT 2012-11-30 13:12:14 -08:00
Ben Straub
f4fc9fdba0 Cleanup nitpicky things 2012-11-30 13:12:10 -08:00
Ben Straub
bde336ea51 Add version fields and init macros for public input structs. 2012-11-30 12:55:45 -08:00
Russell Belfer
f684970a10 Merge pull request #1108 from libgit2/ahead-behind-count
Add API to calculate ahead/behind count
2012-11-29 22:53:34 -08:00
Scott J. Goldman
1a0c5a34e0 Fixup ahead/behind tests
Fix a typo that caused a failing test, and use cl_assert_equal
instead of cl_assert.
2012-11-29 18:11:30 -08:00
Russell Belfer
d5e44d8498 Fix function name and add real error check
`revwalk.h:commit_lookup()` -> `git_revwalk__commit_lookup()`
and make `git_commit_list_parse()` do real error checking that
the item in the list is an actual commit object.  Also fixed an
apparent typo in a test name.
2012-11-29 17:02:27 -08:00
Vicent Martí
f1e5c506b2 Merge pull request #1110 from libgit2/features/push_rebased
Push! By schu, phkelley, and congyiwu
2012-11-29 12:18:05 -08:00
Philip Kelley
36c730daa0 Remove more sample hooks from test repo for push 2012-11-29 10:34:16 -05:00
Philip Kelley
3238ee3e07 Remove sample hooks from test repo for push 2012-11-29 08:37:32 -05:00
Philip Kelley
ac22d08f2f Remove git_object_oid2type 2012-11-29 08:22:15 -05:00
Vicent Martí
e2934db2c7 Merge pull request #1090 from arrbee/ignore-invalid-by-default
Ignore invalid entries by default
2012-11-29 02:05:46 -08:00
Vicent Martí
ee06fec507 Merge pull request #1083 from nulltoken/fix/tracking
Fix git_branch_tracking() for branches with empty merge and/or remote config entries
2012-11-29 01:29:50 -08:00
Vicent Martí
2775d1cb8f Merge pull request #1102 from nulltoken/topic/fetch-test-coverage
fetch: enhance test coverage
2012-11-29 01:02:08 -08:00
Vicent Martí
3ae550e36c Merge pull request #1107 from nulltoken/fix/diff-null-tree-against-workdir
Enhance diff test coverage between a null Tree and the Workdir
2012-11-29 01:01:44 -08:00
Scott J. Goldman
0984c8768d Rename git_count_ahead_behind -> git_graph_ahead_behind
Moved it into graph.{c,h} which i created for the new "graph"
functions namespace. Also adjusted the function prototype
to use `size_t` and `const git_oid *`.
2012-11-28 18:54:57 -08:00
Scott J. Goldman
0d9e0323a5 Add the ahead/behind test that Carlos suggested
Adds a repo with a more complex topology to test the ahead-behind
count.
2012-11-28 18:54:57 -08:00
Scott J. Goldman
eddde61846 Add tests for ahead-behind count 2012-11-28 18:54:57 -08:00
nulltoken
046a1573ff fetch: enhance test coverage 2012-11-29 00:05:16 +01:00
nulltoken
59a0d772f8 diff: enhance test coverage against the workdir 2012-11-28 20:04:34 +01:00
nulltoken
37849a8ec3 tracking: fix retrieval of the tracking ref of branch with empty merge and/or remote entry 2012-11-28 20:00:07 +01:00
nulltoken
f1bd50d61d tracking: remove code duplication in test 2012-11-28 20:00:06 +01:00
nulltoken
35108a216e Fix MSVC compilation warning 2012-11-28 19:37:31 +01:00
Russell Belfer
7bf87ab698 Consolidate text buffer functions
There are many scattered functions that look into the contents of
buffers to do various text manipulations (such as escaping or
unescaping data, calculating text stats, guessing if content is
binary, etc).  This groups all those functions together into a
new file and converts the code to use that.

This has two enhancements to existing functionality.  The old
text stats function is significantly rewritten and the BOM
detection code was extended (although largely we can't deal with
anything other than a UTF8 BOM).
2012-11-28 09:58:48 -08:00
Philip Kelley
613d5eb939 Push! By schu, phkelley, and congyiwu, et al 2012-11-28 11:42:37 -05:00
Russell Belfer
c3fb7d04ed Make git_odb_foreach_cb take const param
This makes the first OID param of the ODB callback a const pointer
and also propogates that change all the way to the backends.
2012-11-27 15:00:49 -08:00
Russell Belfer
2bd5998c9c Remove git_note_data structure 2012-11-27 14:47:39 -08:00
Ben Straub
cb7ac81c4d Fix warning 2012-11-27 13:30:04 -08:00
Ben Straub
df705148ec API updates for remote.h
Includes typedef for git_direction, and renames for
GIT_DIR_[FETCH|PUSH] to GIT_DIRECTION_(\1).
2012-11-27 13:19:49 -08:00
Russell Belfer
a8122b5d4a Fix warnings on Win64 build 2012-11-27 13:18:29 -08:00
Russell Belfer
16248ee2d1 Fix up some missing consts in tree & index
This fixes some missed places where we can apply const-ness to
various public APIs.

There are still some index and tree APIs that cannot take const
pointers because we sort our `git_vectors` lazily and so we can't
reliably bsearch the index and tree content without applying a
`git_vector_sort()` first.

This also fixes some missed places where size_t can be used and
where const can be applied to a couple internal functions.
2012-11-27 13:18:29 -08:00
Ben Straub
f45d51ff8e API updates for index.h 2012-11-27 13:18:28 -08:00
Russell Belfer
d9023dbe0c API updates for tag.h 2012-11-27 13:18:28 -08:00
Russell Belfer
9cd423583f API updates for submodule.h 2012-11-27 13:18:28 -08:00
Russell Belfer
793c438559 Update diff callback param order
This makes the diff functions that take callbacks both take
the payload parameter after the callback function pointers and
pass the payload as the last argument to the callback function
instead of the first.  This should make them consistent with
other callbacks across the API.
2012-11-27 13:18:28 -08:00
Ben Straub
54b2a37ac7 Clean up config.h 2012-11-27 13:18:28 -08:00
Russell Belfer
e120123e36 API review / update for tree.h 2012-11-27 13:18:28 -08:00
Vicent Marti
cfbe4be3fb More external API cleanup
Conflicts:
	src/branch.c
	tests-clar/refs/branches/create.c
2012-11-27 13:18:27 -08:00
Ben Straub
2508cc66eb Rename ref and reflog apis for consistency 2012-11-27 13:17:45 -08:00
Vicent Martí
c4d8df27bc Merge pull request #1097 from nulltoken/topic/head_tree_error
Make `git_repository_head_tree()` return error codes
2012-11-23 15:19:47 -08:00
Sascha Cunz
9094d30b93 Reset all static variables to NULL in clar's __cleanup
Without this change, any failed assertion in the second (or a later) test
inside a test suite has a chance of double deleting memory, resulting in
a heap corruption. See #1096 for details.

This leaves alone the test cases where we "just" use cl_git_sandbox_init()
and cl_git_sandbox_cleanup(). These methods already take good care to not
double delete a repository.

Fixes #1096
2012-11-23 11:41:56 +01:00
nulltoken
5cec896a3b repo: Make git_repository_head_tree() return error codes 2012-11-22 18:51:06 +01:00
nulltoken
a94002a983 test: Minor fixes 2012-11-22 18:50:50 +01:00
Philip Kelley
5cf1b4f094 Call git_remote_update_tips before git_remote_disconnect 2012-11-22 11:16:35 -05:00
Eduardo Bart
e566b609df Update clar tests p_lstat_posixly and p_lstat 2012-11-20 00:57:56 -02:00
Russell Belfer
d46b0a04c7 Improve iterator ignoring .git file
The workdir iterator has always tried to ignore .git files, but
it turns out there were some bugs.  This makes it more robust at
ignoring .git files.

This also makes iterators always check ".git" case insensitively
regardless of the properties of the system.  This will make libgit2
skip ".GIT" and the like.  This is different from core git, but on
systems with case insensitive but case preserving file systems,
allowing ".GIT" to be added is problematic.
2012-11-19 16:34:44 -08:00
Russell Belfer
02df42ddbf Set up default internal ignores
This adds "." ".." and ".git" to the internal ignores list by
default - asking about paths with these files will always say
that they are ignored.
2012-11-19 16:33:30 -08:00
Scott J. Goldman
1876360f81 Add a test for invalid filenames while writing tree from index 2012-11-18 16:59:42 -08:00
Scott J. Goldman
19af78bb36 Prevent creating .., ., and .git with tree builder
As per core git.
2012-11-18 15:15:24 -08:00
Michael Schubert
0066955d97 Fix a couple of warnings 2012-11-18 04:27:49 +01:00
nulltoken
b15df1d937 reflog: make entry_byindex() and drop() git compliant
Passing 0 as the index now retrieves the most recent entry instead
of the oldest one.
2012-11-17 18:30:35 -08:00
nulltoken
270160b91a config: Opening a nonexistent file returns ENOTFOUND 2012-11-17 18:30:34 -08:00
nulltoken
6091457e76 repo: ensure is_empty() checks there are no refs 2012-11-17 07:20:08 -08:00
nulltoken
f5a0e734bc tests: introduce cl_git_remove_placeholders() 2012-11-17 07:20:07 -08:00
nulltoken
5df7207a67 repo: readonly tests don't need a sandboxed repo 2012-11-17 07:20:04 -08:00
nulltoken
0e95e70a55 env: ensure git_futils_find_xxx() returns ENOTFOUND 2012-11-17 05:41:22 -08:00
nulltoken
aa8a76eff9 tag: rename git_tag_type to git_tag_target_type 2012-11-17 05:41:20 -08:00
nulltoken
86b9dbc12f Fix MSVC compilation warnings 2012-11-17 05:13:13 -08:00
Vicent Martí
e087973ec7 Merge pull request #1075 from carlosmn/alternates-recurse
odb: recursively load alternates
2012-11-16 10:27:46 -08:00
Carlos Martín Nieto
85e7efa163 odb: recursively load alternates
The maximum depth is 5, like in git
2012-11-16 08:46:02 -08:00
Scott J. Goldman
0cd063fd87 Merge pull request #1071 from arrbee/alternate-fix-strcmp
Win32 fixes for diff/checkout/reset
2012-11-15 23:28:52 -08:00
Russell Belfer
bbe6dbec81 Add explicit git_index ptr to diff and checkout
A number of diff APIs and the `git_checkout_index` API take a
`git_repository` object an operate on the index.  This updates
them to take a `git_index` pointer explicitly and only fall back
on the `git_repository` index if the index input is NULL.  This
makes it easier to operate on a temporary index.
2012-11-14 23:29:48 -08:00
Russell Belfer
bad68c0a99 Add iterator for git_index object
The index iterator could previously only be created from a repo
object, but this allows creating an iterator from a `git_index`
object instead (while keeping, though renaming, the old function).
2012-11-14 22:55:40 -08:00
Russell Belfer
5735bf5e6a Fix diff API to better parameter order
The diff API is not in the parameter order one would expect from
other libgit2 APIs.  This fixes that.
2012-11-14 22:54:31 -08:00
Russell Belfer
402b92cfe9 Fix reset hard tests on platforms with CRLF
The reset hard tests had hardcoded expected file content and was
not correctly compensating for CRLF filtering when a file needed
to be reverted by the reset hard.  This fixes that.
2012-11-14 22:44:17 -08:00
Russell Belfer
cccacac555 Add POSIX compat lstat() variant for win32
The existing p_lstat implementation on win32 is not quite POSIX
compliant when setting errno to ENOTDIR.  This adds an option to
make is be compliant so that code (such as checkout) that cares
to have separate behavior for ENOTDIR can use it portably.

This also contains a couple of other minor cleanups in the
posix_w32.c implementations to avoid unnecessary work.
2012-11-14 22:41:51 -08:00