Commit Graph

99 Commits

Author SHA1 Message Date
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
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
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
Vicent Marti
2d466b7dcb tests: Fix unused temp repo 2012-12-14 02:49:11 +01:00
Ben Straub
72629a10e3 Clean up GCC build warnings 2012-12-10 10:05:31 -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
nulltoken
bc05f30c47 object: refine git_object_peel() error report 2012-12-01 08:34:29 +01:00
nulltoken
18d6f12040 tag: Deploy EINVALIDSPEC usage 2012-12-01 08:34:28 +01: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
ac22d08f2f Remove git_object_oid2type 2012-11-29 08:22:15 -05: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
a8122b5d4a Fix warnings on Win64 build 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
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
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
Scott J. Goldman
19af78bb36 Prevent creating .., ., and .git with tree builder
As per core git.
2012-11-18 15:15:24 -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í
aa1c3b588e Merge pull request #1016 from arrbee/fix-checkout-dir-removal
Update checkout with new strategies & behavior
2012-11-13 14:13:47 -08:00
Edward Thomson
603bee0791 Remove git_hash_ctx_new - callers now _ctx_init() 2012-11-13 10:23:05 -06:00
Edward Thomson
d6fb092409 Win32 CryptoAPI and CNG support for SHA1 2012-11-13 10:23:05 -06:00
nulltoken
ef8871515b Fix compilation warning 2012-11-12 00:13:02 +01:00
Russell Belfer
331e7de900 Extensions to rmdir and mkdir utilities
* Rework GIT_DIRREMOVAL values to GIT_RMDIR flags, allowing
  combinations of flags
* Add GIT_RMDIR_EMPTY_PARENTS flag to remove parent dirs that
  are left empty after removal
* Add GIT_MKDIR_VERIFY_DIR to give an error if item is a file,
  not a dir (previously an EEXISTS error was ignored, even for
  files) and enable this flag for git_futils_mkpath2file call
* Improve accuracy of error messages from git_futils_mkdir
2012-11-09 13:52:06 -08:00
nulltoken
f92bcaea49 index: prevent tree creation from a non merged state
Fix libgit2/libgit2sharp#243
2012-11-09 16:45:47 +01:00
nulltoken
29cc374d2e tree: enforce coverage of silent entry replacement 2012-11-08 21:16:45 +01:00
Erik van Zijst
6bb9fea13e tags: Fixed the tag parser to correctly treat the message field as optional.
This fix makes libgit2 capable of parsing annotated tag objects that lack
the optional message/description field.
Previously, libgit2 treated this field as mandatory and raised a tag_error on
such tags. However, the message field is optional.

An example of such a tag is refs/tags/v2.6.16.31-rc1 in Linux:

$ git cat-file tag refs/tags/v2.6.16.31-rc1
object afaa018cefb6af63befef1df7d8febaae904434f
type commit
tag v2.6.16.31-rc1
tagger Adrian Bunk <bunk@stusta.de> 1162716505 +0100
$
2012-11-02 10:28:17 -07:00
Vicent Marti
43eeca04a7 index: Fix tests 2012-11-01 20:24:43 +01:00
Edward Thomson
f45ec1a076 index refactoring 2012-10-29 20:04:21 -05:00
nulltoken
65d12df525 message: reorganize tests 2012-10-26 21:01:58 +02:00
Russell Belfer
4c47a8bcfe Merge pull request #968 from arrbee/diff-support-typechange
Support TYPECHANGE records in status and adjust checkout accordingly
2012-10-17 14:14:51 -07:00
nulltoken
b73200c1ed tags: cover EEXISTS propagation upon creation 2012-10-11 14:15:40 +02:00
Russell Belfer
0d64bef941 Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the
"typechanges" test repository, but that revealed numerous issues
with checkout, including:

* complete failure with submodules
* failure to create blobs with exec bits
* problems when replacing a tree with a blob because the tree
  "example/" sorts after the blob "example" so the delete was
  being processed after the single file blob was created

This fixes most of those problems and includes a number of other
minor changes that made it easier to do that, including improving
the TYPECHANGE support in diff/status, etc.
2012-10-09 11:59:34 -07:00
Sascha Cunz
8469219e37 Tests: Add test for git_tag_list to check for 'git tag -l "*bar"' 2012-09-23 01:02:07 +02:00
Sascha Cunz
daa70138fc Tests: reindent object/tag/list.c to use tabs 2012-09-23 01:02:07 +02:00
Sascha Cunz
45949b378b Tests::object::tag: also test for a 'foo/*/bar'. 2012-09-23 01:02:07 +02:00
Sascha Cunz
7604ddbf70 Tests: Add 3 tags to resources/testrepo.
Adjusts refs::list test (including the comments)
Adjusts objects::tags::list test
2012-09-23 01:02:07 +02:00
Sascha Cunz
e800bbe80a Tests::Object::Tag: Add a mechanism to test which tags were returned
This patch changes the tag listing test helper to use a struct as input
parameter, which tells what we exactly expect.

As I don't think, we can rely on the fact that every os and every
filesystem will report the tags in the same order, I made this code
independent of the order that the tags are retrieved.
2012-09-23 00:00:55 +02:00
Sascha Cunz
f73f760e66 Tests::Object::Tag: move listing tags tests to an own file 2012-09-22 23:12:03 +02:00
nulltoken
cf4c43abaa object: make git_object_peel() test more readable 2012-09-06 18:40:09 +02:00
Russell Belfer
d8057a5b0e Make git_object_peel a bit smarter
This expands the types of peeling that `git_object_peel` knows
how to do to include TAG -> BLOB peeling, and makes the errors
slightly more consistent depending on the situation.  It also
adds a new special behavior where peeling to ANY will peel until
the object type changes (e.g. chases TAGs to a non-TAG).

Using this expanded peeling, this replaces peeling code that was
embedded in `git_tag_peel` and `git_reset`.
2012-08-27 11:53:59 -07:00
nulltoken
9d7ac675d0 tree entry: rename git_tree_entry_attributes() into git_tree_entry_filemode() 2012-08-21 23:15:13 +02:00
nulltoken
a7dbac0b23 filemode: deploy enum usage 2012-08-21 23:15:10 +02:00
nulltoken
66439b0b1a treebuilder: enhance attributes handling on insertion 2012-08-19 14:11:59 +02:00
Carlos Martín Nieto
fc1826d149 tests: fix tree walking test
Return -1 to stop the iteration instead of not-0
2012-08-14 20:54:13 +02:00
Russell Belfer
85a0e28b80 Make git_message_prettify return bytes written
If you want to be absolutely safe with git_message_prettify, you
can now pass a NULL pointer for the buffer and get back the number
of bytes that would be copied into the buffer.

This means that an error is a non-negative return code and a
success will be greater than zero from this function.
2012-08-14 10:50:58 -07:00