Commit Graph

447 Commits

Author SHA1 Message Date
Carlos Martín Nieto
20a7e8208e Remove extra git_index_read from the tests
When you open an index with git_index_open, the file is read before
the function returns. Thus, calling git_index_read after that is
useless.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-26 15:53:52 +02:00
Kirill A. Shutemov
84ef7f3636 tests: fix cast warnings
/home/kas/git/public/libgit2/tests/t00-core.c: In function ‘test_cmp’:
/home/kas/git/public/libgit2/tests/t00-core.c:78:10: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t00-core.c:78:22: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t07-hashtable.c: In function ‘hash_func’:
/home/kas/git/public/libgit2/tests/t07-hashtable.c:42:7: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write0’:
/home/kas/git/public/libgit2/tests/t08-tag.c:141:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write2’:
/home/kas/git/public/libgit2/tests/t08-tag.c:192:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t08-tag.c: In function ‘_gittest__write3’:
/home/kas/git/public/libgit2/tests/t08-tag.c:227:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c: In function ‘_gittest__write0’:
/home/kas/git/public/libgit2/tests/t04-commit.c:650:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c:651:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c: In function ‘_gittest__root0’:
/home/kas/git/public/libgit2/tests/t04-commit.c:723:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t04-commit.c:724:21: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
/home/kas/git/public/libgit2/tests/t12-repo.c: In function ‘write_file’:
/home/kas/git/public/libgit2/tests/t12-repo.c:360:24: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:47 +02:00
Vicent Martí
324f0eecb6 Merge pull request #325 from carlosmn/valgrind
More memory leaks
2011-07-13 18:03:12 -07:00
nulltoken
f4ad64c109 tree: fix insertion of entries with invalid filenames 2011-07-13 07:58:17 +02:00
Carlos Martín Nieto
cd0fe1ac27 Free sig in reflog test
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-07-13 00:23:15 +02:00
nulltoken
d4760a42f9 status: refactor the tests to remove some code duplication 2011-07-12 22:20:15 +02:00
Carlos Martín Nieto
55e1609b2f Don't leak the buf when testing it
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-12 18:19:56 +02:00
Vicent Marti
b08683ffb2 config: Rename del to `delete 2011-07-12 02:38:20 +02:00
nulltoken
bfbb55628b tag: Add creation of lightweight tag 2011-07-11 19:42:21 +02:00
Vicent Marti
eb1fd1d0cb What the fuck was this doing in src? 2011-07-11 19:42:21 +02:00
nulltoken
7757be33a2 reflog: Fix reflog writer/reader
- Use a space to separate oids and signature
 - Enforce test coverage
 - Make test run in a temporary folder in order not to alter the test repository
2011-07-10 19:17:07 +02:00
Vicent Marti
c52736fa52 status: Cleanup
The `hashfile` function has been moved to ODB, next to `git_odb_hash`.

Global state has been removed from the dirent call in `status.c`,
because global state is killing the rainforest and causing global
warming.
2011-07-09 15:05:14 +02:00
Jason Penny
3b2a423c3f status: nonexistent file with git_status_file()
Throws GIT_ENOTFOUND error if given a filename that is not in
HEAD, index, nor the work tree.
2011-07-09 13:49:50 +02:00
Jason Penny
2b90cc26de status: consolidate some test code
Refactored copy of test repo to a function.
2011-07-09 13:49:50 +02:00
Jason Penny
34dfea2774 status: handle subdirs for git_status_file 2011-07-09 13:49:50 +02:00
Jason Penny
6b251490a8 status: add subdir to test repo 2011-07-09 13:49:50 +02:00
Jason Penny
20361b2f69 status: get status for single file
Add git_status_file to be able to retrieve status of single file by
supplying a path.
2011-07-09 13:49:50 +02:00
Jason Penny
3af6b34a76 status: get file statuses and run callback
Add git_status_foreach() to run a callback on each file passing the path
and a status value.
2011-07-09 13:49:50 +02:00
Jason Penny
210940da84 status: new test repo 2011-07-09 13:49:50 +02:00
Jason Penny
205166d27c status: get blob object id of file on disk
Add git_status_hashfile() to get blob's object id for a file without adding
it to the object database or needing a repository at all.
This functionality is similar to `git hash-object` without '-w'.
2011-07-09 13:49:50 +02:00
Jason Penny
7361857c50 Update tests/NAMING 2011-07-09 13:49:49 +02:00
Vicent Marti
06c43821b9 Remove unused methods
The direct-writes commit left some (slow) internals methods that
were no longer needed. These have been removed.

Also, the Reflog code was using the old `git_signature__write`, so
it has been rewritten to use a normal buffer and the new `writebuf`
signature writer. It's now slightly simpler and faster.
2011-07-09 02:40:16 +02:00
Vicent Marti
afeecf4f26 odb: Direct writes are back
DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the
ODB was an overkill for the smaller objects like Commit and Tags; most
of the streaming logic was taking too long.

This commit makes Commits, Tags and Trees to be built-up in memory, and
then written to disk in 2 pushes (header + data), instead of streaming
everything.

This is *always* faster, even for big files (since the git_filebuf class
still does streaming writes when the memory cache overflows). This is
also a gazillion lines of code smaller, because we don't have to
precompute the final size of the object before starting the stream (this
was kind of defeating the point of streaming, anyway).

Blobs are still written with full streaming instead of loading them in
memory, since this is still the fastest way.

A new `git_buf` class has been added. It's missing some features, but
it'll get there.
2011-07-09 02:40:16 +02:00
schu
27df4275f2 reflog: add API to read or write a reference log
So far libgit2 didn't support reference logs (reflog). Add a new
git_reflog_* API for basic reading and writing of reflogs:

* git_reflog_read
* git_reflog_write
* git_reflog_free

Signed-off-by: schu <schu-github@schulog.org>
2011-07-09 02:40:16 +02:00
nulltoken
6d4f090df6 reference_renaming: add additional tests
Add some more test checking forced reference renaming.

Signed-off-by: nulltoken <emeric.fermas@gmail.com>
Acked-by: schu <schu-github@schulog.org>
2011-07-07 21:29:14 +02:00
nulltoken
2b5af615e1 tag: add pattern based retrieval of list of tag names 2011-07-07 15:37:07 +02:00
Vicent Marti
c1e857484e test-core: Fix warning in uniq test 2011-07-07 12:23:47 +02:00
nulltoken
bdcc46111c Fix MSVC compilation warnings 2011-07-07 12:12:34 +02:00
Vicent Marti
de18f27668 vector: Timsort all of the things
Drop the GLibc implementation of Merge Sort and replace it with Timsort.

The algorithm has been tuned to work on arrays of pointers (void **),
so there's no longer a need to abstract the byte-width of each element
in the array.

All the comparison callbacks now take pointers-to-elements, not
pointers-to-pointers, so there's now one less level of dereferencing.

E.g.

	 int index_cmp(const void *a, const void *b)
	 {
	-	const git_index_entry *entry_a = *(const git_index_entry **)(a);
	+	const git_index_entry *entry_a = (const git_index_entry *)(a);

The result is up to a 40% speed-up when sorting vectors. Memory usage
remains lineal.

A new `bsearch` implementation has been added, whose callback also
supplies pointer-to-elements, to uniform the Vector API again.
2011-07-07 02:54:07 +02:00
Vicent Marti
c63aa49459 test: Abort when the temp workdir cannot be created 2011-07-07 02:54:07 +02:00
nulltoken
26911cbd92 Fix MSVC compilation warnings 2011-07-06 12:27:51 -07:00
Vicent Martí
bf9a2e98b8 Merge pull request #296 from kiryl/index-optimization
Index optimization
2011-07-06 10:55:06 -07:00
Vicent Marti
858dba58bf refs: Cleanup reference renaming
`git_futils_rmdir_r`: rename, clean up.

`git_reference_rename`: cleanup. Do not use 3x4096 buffers on the stack
or things will get ugly very fast. We can reuse the same buffer.
2011-07-06 18:08:13 +02:00
nulltoken
1b938a5826 Remove duplicated recursive directory removal related code 2011-07-06 12:25:27 +02:00
nulltoken
1ee5fd903d Fix windows specific issues
- msvc compilation warnings
 - not released file handle that prevents file removal
2011-07-06 12:25:27 +02:00
schu
0ffcf78a30 reference_rename: git compliant reference renaming
So far libgit2 didn't handle the following scenarios:

* Rename of reference m   -> m/m
* Rename of reference n/n -> n

Fixed.

Since we don't write reflogs, we have to delete any old reflog for the
renamed reference. Otherwise git.git will possibly fail when it finds
invalid logs.

Reported-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
2011-07-06 12:25:27 +02:00
schu
7ea50f6077 Add tests for git_futils_rmdir_resurs()
Signed-off-by: schu <schu-github@schulog.org>
2011-07-06 12:25:27 +02:00
schu
a6e0f315f5 Add test case checking renaming of a branch to a new name prefixed with
the old name succeeds, e.g. refs/heads/foo -> refs/heads/foo/bar

Reported-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
2011-07-06 12:25:27 +02:00
Carlos Martín Nieto
7a7ef2dceb Restore config10 test file
Removing a section variable doesn't remove its section
header. Overwrite the config10 file so there are no changes after the
test is run.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 17:47:10 +02:00
Kirill A. Shutemov
476c42acc5 vector: implement git_vector_uniq()
The routine remove duplictes from the vector. Only the last added element
of elements with equal keys remains in the vector.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 17:52:39 +03:00
Vicent Martí
f12aa9dc5e Merge pull request #300 from carlosmn/gsoc2011/master
A bit of networking
2011-07-05 04:31:37 -07:00
Carlos Martín Nieto
7d69f78897 Add variable writing tests
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:18 +02:00
Carlos Martín Nieto
156af801e6 Add test for section header at end of file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:18 +02:00
Carlos Martín Nieto
2601fcfc1e Add tests for deleting a config var
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:17 +02:00
nulltoken
a01acc47bb signature: straighten the creation of a signature
- Fails on empty name and/or email
 - Trims leading and trailing spaces of name and email
2011-07-05 02:21:26 +02:00
nulltoken
42a1b5e1ad signature: enhance relaxed parsing of bogus signatures
Final fix for issue #278
2011-07-05 02:21:26 +02:00
schu
60caf02465 t04-commit: add tests for git_signature__parse
git_signature__parse used to be very strict about what's a well-formed
signature. Add tests checking git_signature__parse can stick with
"unexpected" signatures (IOW no author name and / or no email, etc).

Signed-off-by: schu <schu-github@schulog.org>
2011-07-05 02:21:26 +02:00
Vicent Marti
eec3fe394a fileutils: Finish dropping the old prettify_path 2011-07-05 02:09:05 +02:00
Vicent Marti
5ad739e832 fileops: Drop git_fileops_prettify_path
The old `git_fileops_prettify_path` has been replaced with
`git_path_prettify`. This is a much simpler method that uses the OS's
`realpath` call to obtain the full path for directories and resolve
symlinks.

The `realpath` syscall is the original POSIX call in Unix system and
an emulated version under Windows using the Windows API.
2011-07-05 02:06:26 +02:00
Vicent Marti
f79026b491 fileops: Cleanup
Cleaned up the structure of the whole OS-abstraction layer.

fileops.c now contains a set of utility methods for file management used
by the library. These are abstractions on top of the original POSIX
calls.

There's a new file called `posix.c` that contains
emulations/reimplementations of all the POSIX calls the library uses.
These are prefixed with `p_`. There's a specific posix file for each
platform (win32 and unix).

All the path-related methods have been moved from `utils.c` to `path.c`
and have their own prefix.
2011-07-05 02:04:03 +02:00
Kirill A. Shutemov
932d1baf29 cleanup: remove trailing spaces
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-01 18:02:56 +02:00
Kirill A. Shutemov
fe5babacd6 filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-06-30 16:19:19 +03:00
nulltoken
6ac91dfe52 Hide ".git" directory on Windows upon creation of a non bare repository
Directory which name starts with a dot are hidden on Linux platforms. This patch makes libgit2 behaves similarly on Windows.
2011-06-29 19:22:24 +02:00
Vicent Marti
7376ad9927 refs: Remove duplicate rename method
`git_reference_rename` now takes a `force` flag
2011-06-29 11:01:35 +02:00
Vicent Marti
ab7941b5d9 test: Properly show error messages 2011-06-28 21:10:51 +02:00
Vicent Marti
5cf1f909e4 test: Print last error message properly 2011-06-28 21:10:49 +02:00
Vicent Marti
c682886e8e repo: Rename HEAD-related methods 2011-06-28 21:10:44 +02:00
Vicent Martí
ccd59372d4 Merge pull request #279 from carlosmn/detached-orphan
Add detached and orphan convenience functions
2011-06-28 10:44:19 -07:00
Vicent Marti
d5afc0390c Remove redundant methods from the API
A bunch of redundant methods have been removed from the external API.

- All the reference/tag creation methods with `_f` are gone. The force
flag is now passed as an argument to the normal create methods.

- All the different commit creation methods are gone; commit creation
now always requires a `git_commit` pointer for parents and a `git_tree`
pointer for tree, to ensure that corrupted commits cannot be generated.

- All the different tag creation methods are gone; tag creation now
always requires a `git_object` pointer to ensure that tags are not
created to inexisting objects.
2011-06-28 19:36:27 +02:00
Carlos Martín Nieto
f5e09d6080 Add tests for detached and orphan
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-28 16:59:51 +02:00
Carlos Martín Nieto
c5b2622d68 Add git_refspec_transform test
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:11 +02:00
Carlos Martín Nieto
fa9dcb7ede Add refspec match test
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:11 +02:00
Carlos Martín Nieto
73fdf706cc Add refspec0 test
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:11 +02:00
Carlos Martín Nieto
a030ae5020 Add a test for remote parsing
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-26 18:18:10 +02:00
Vicent Marti
3101a3e5b8 refs: Do not overflow when normalizing refnames 2011-06-23 02:29:11 +02:00
schu
24bd5e556b Add test case checking GIT_FILEBUF_APPEND
Signed-off-by: schu <schu-github@schulog.org>
2011-06-20 15:58:56 +02:00
Vicent Marti
2a406ab51c config: Fix sorting of repository config files 2011-06-18 02:08:56 +02:00
Vicent Marti
dbe70bd5c3 config: Fix compilation in MSVC 2011-06-18 01:12:58 +02:00
Vicent Marti
07ff881750 config: Cleanup external API
Do not mess with environment variables anymore. The new external API has
more helper methods, and everything is explicit.
2011-06-18 00:39:39 +02:00
Carlos Martín Nieto
f3dad3acd7 Add fall-back support to the configuration
If a config has several files, we need to check all of them before we
can say that a variable doesn't exist.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-17 22:30:30 +02:00
Carlos Martín Nieto
3de5df7d8e Add a test for overriding config
The repo's configuration should take precedence over the global one.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-17 22:30:29 +02:00
Carlos Martín Nieto
3d5a02b653 Plug an index leak
The test wasn't updated when repos lost ownership of indices

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-16 20:30:40 +02:00
Carlos Martín Nieto
038d2fc343 Plug leaks in the repo discovery tests
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-16 20:24:51 +02:00
Vicent Marti
fa48608ec3 oid: Rename methods
Yeah. Finally. Fuck the old names, this ain't POSIX
and they don't make any sense at all.
2011-06-16 02:36:21 +02:00
Vicent Martí
607d164380 Merge pull request #248 from carlosmn/config
Implement config writing
2011-06-15 17:24:04 -07:00
Vicent Martí
ef9a6f4cbc Merge pull request #261 from Romain-Geissler/discovery-path-v2
Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
2011-06-15 13:47:41 -07:00
Romain Geissler
0657e46dee Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
GIT_PATH_LIST_SEPARATOR and GIT_PATH_MAX are made public so
that it's can be used by a client.
2011-06-15 22:11:18 +02:00
Vicent Martí
f2bb894e64 Merge pull request #251 from nulltoken/fix/msvc-warnings
Fix compilation warnings in MSVC
2011-06-15 12:15:11 -07:00
Vicent Martí
1aa1b09e73 Merge pull request #260 from nulltoken/fix/git_index_add
Fix git_index_add()
2011-06-15 12:11:59 -07:00
nulltoken
8e11e707f3 git_index_add: enforce test coverage 2011-06-15 21:10:16 +02:00
Vicent Marti
b023321669 Remove custom backends
All the custom backend code will be moved to a separate project,
	together with the new MySQL backend.
2011-06-14 17:40:17 +02:00
Carlos Martín Nieto
a98b0d80dc Test replacing a value
Add a test to check that value replacement works.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-14 14:26:08 +02:00
nulltoken
95818ff73a Fix filebuf0 test which was failing on Windows 2011-06-12 07:37:56 +02:00
nulltoken
9e3aa94764 Fix compilation warnings in MSVC 2011-06-12 07:37:50 +02:00
Brian Lopez
a51201cc73 use proper in-memory database for sqlite3 tests 2011-06-11 22:06:02 -07:00
Carlos Martín Nieto
8102a961b8 Add test for git_filebuf_open error code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-07 17:02:33 +02:00
Vicent Marti
9d77d83a81 Revert "threads: Fix TLS declarations"
This commit uploaded an old broken test. Oops!
2011-06-07 03:38:09 +02:00
Vicent Martí
2c9e7fa35e Merge pull request #232 from schu/ref-available-cb
reference_rename: respect all references v2
2011-06-06 18:24:37 -07:00
Vicent Marti
64fe8c62f9 threads: Fix TLS declarations
Cleanup the thread-utils file. Do not define TLS if libgit2 is not
threadsafe.
2011-06-07 03:22:32 +02:00
Vicent Martí
7d170a4b50 Merge pull request #231 from Romain-Geissler/discovery-path-v2
[Discovery path] Fix and tests
2011-06-06 18:11:15 -07:00
Romain Geissler
efcc87c9d9 Repository: A little fix in error code. GIT_ENOTFOUND is returned when a gitfile is malformed and GIT_ENOTAREPO when the pointed dir is not a repo.
Fixed tests so that it check the right error code.
2011-06-06 10:02:07 +02:00
schu
fd21c6f67f Add test case checking we do not corrupt the repository when renaming
Signed-off-by: schu <schu-github@schulog.org>
2011-06-05 19:20:57 +02:00
Romain Geissler
76e9e3b763 Tests: Added tests for git_repository_discover.
Unfortunately, the across_fs flag can't be tested automaticly, as we can't
create a temporary new filesystem.
2011-06-05 00:23:24 +02:00
Vicent Marti
602ee38b6e repository: Export all internal paths 2011-06-04 20:45:09 +02:00
unknown
26a98ec8a2 Fileops: Added a fourth argument to the path prettifying functions to use an alternate basepath.
Fixed a Windows TO-DO in the prettifying functions.
2011-06-03 21:04:02 +02:00
Vicent Martí
dd8a2070ce Merge pull request #215 from schu/typos
Fix typos
2011-06-01 12:54:15 -07:00
Vicent Martí
46d359d1c3 Merge pull request #218 from schu/tests-fflush
test_lib.c: flush stdout after every test-run
2011-06-01 12:53:46 -07:00
Vicent Martí
9db04160a5 Merge pull request #222 from carlosmn/config-bugfix
Config bugfix
2011-06-01 12:52:50 -07:00
Vicent Martí
50b7334e51 Merge pull request #206 from nulltoken/topic/is-bare
Add git_repository_is_bare() accessor
2011-06-01 09:58:21 -07:00
Vicent Marti
f7e59c4dcf index: Change the memory management for repo indexes
The `git_repository_index` call now returns a brand new index that must
be manually free'd.
2011-06-01 18:54:47 +02:00
Carlos Martín Nieto
fc0ee5bdd3 Add test for empty config file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:57:18 +02:00
Carlos Martín Nieto
30d0550da8 Add test for invalid ext header
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:57:17 +02:00
Carlos Martín Nieto
38d0bc1e81 Add config test for empty line
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-31 17:57:17 +02:00
schu
a7ed162538 test_lib.c: flush stdout after every test-run
Make sure the user immediately sees the feedback, '.' or 'F', for a
test. If it's only in the buffer, it may gets "lost" in case of error.

Signed-off-by: schu <schu-github@schulog.org>
2011-05-30 21:13:11 +02:00
schu
286349c6ec Fix tiny typo
Signed-off-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
2011-05-29 20:15:27 +02:00
nulltoken
fa9bcd81f5 Add git_repository_is_bare() accessor 2011-05-24 21:50:02 +02:00
Vicent Marti
b0b527e0ad config: Cleanup & renaming of the external API
"git_config_backend" have been renamed to "git_config_file", which
implements a generic interface to access a configuration file -- be it
either on disk, from a DB or whatever mumbojumbo.

I think this makes more sense.
2011-05-20 03:20:12 +03:00
schu
6628c2560c test_lib: add return value to git_test
Save the return value of functions not passing must_pass() and report
the returned error.

Signed-off-by: schu <schu-github@schulog.org>
2011-05-18 12:36:41 +02:00
Vicent Marti
c9662061f2 t15: Remove unused variable 2011-05-17 15:12:25 +03:00
Vicent Marti
124fbb3d74 tests: Update NAMING file 2011-05-17 15:11:43 +03:00
Vicent Martí
62845c903e Merge pull request #116 from carlosmn/test-naming
tests: update NAMING file
2011-05-17 05:11:06 -07:00
Carlos Martín Nieto
94711cad3b Merge upstream/development 2011-05-17 12:12:59 +02:00
Carlos Martín Nieto
c033500549 Move config to a backend structure
Configuration options can come from different sources. Currently,
there is only support for reading them from a flat file, but it might
make sense to read it from a database at some point.

Move the parsing code into src/config_file.c and create an include
file include/git2/config_backend.h to allow for other backends to be
developed.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-10 14:47:20 +02:00
Carlos Martín Nieto
ca8d2dfc0c Merge remote-tracking branch 'upstream/development' into config 2011-05-05 16:22:06 +02:00
Carlos Martín Nieto
bbd68c6768 ref test: update a forgotten repo -> repo2
Commit 34e5d87e05 left one of these unchanged we're trying
to read from a free'd repository.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-05-05 11:40:39 +02:00
Vicent Martí
cc3b82e376 Merge pull request #151 from carlosmn/root-commit.
Support root commits
2011-05-02 15:29:50 -07:00
Vicent Martí
fde97669ec Merge pull request #146 from nordsturm/fix_subtrees.
Fix tree-entry attribute convertion (fix corrupted trees)
2011-05-02 15:26:16 -07:00
Vicent Martí
d4ad0771e4 Merge pull request #145 from schu/fix-unused-warnings.
Fix -Wunused-but-set-variable warnings
2011-05-01 14:59:50 -07:00
nulltoken
34e5d87e05 Change implementation of refs tests that alter the current repository to make them run against a temporary clone of the test repository 2011-05-01 21:35:32 +02:00
Carlos Martín Nieto
79b6155736 Add root commit test
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-29 12:08:24 +02:00
Sergey Nikishin
555ce56819 Fix tree-entry attribute convertion (fix corrupted trees)
Magic constant replaced by direct to-string covertion because of:
1) with value length 6 (040000 - subtree) final tree will be corrupted;
2) for wrong values length <6 final tree will be corrupted too.
2011-04-26 15:32:11 +04:00
schu
402a47a7fa Fix -Wunused-but-set-variable warnings
As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Use GIT_UNUSED
or remove actually unused variables to prevent those warnings.
2011-04-26 11:29:05 +02:00
Vicent Martí
5a74d16048 Merged pull request #135 from carlosmn/valgrind.
Fix memory leaks in the tests
2011-04-23 14:37:56 -07:00
Carlos Martín Nieto
a99264bff6 config: allow uppercase number suffixes
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-19 16:34:22 +02:00
Carlos Martín Nieto
7c1c15a7fb tests: free the test suite name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-13 21:55:43 +02:00
Carlos Martín Nieto
2fe3692c23 tests: don't leak objects
If we don't create any leaks in the tests, we can use them to search
for leaks in the implementation.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-13 21:50:11 +02:00
Vicent Marti
def3fef197 Add git_tag_list
Lists all the tag references in a repository using a custom callback.
Includes unit tests courtesy of Emeric Fermas <3
2011-04-12 15:55:51 -07:00
Carlos Martín Nieto
53345e1f1f config: add tests for number suffix
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-11 18:01:01 +02:00
Carlos Martín Nieto
55c197cdd3 Merge upstream/development 2011-04-11 17:43:56 +02:00
Vicent Marti
fdd0cc9e89 Fix path normalization tests
They were backtracking too deep into the filesystem on Linux, where the
tests were running directly on `tmp/`.
2011-04-10 15:25:41 -07:00
Vicent Marti
a6359408a5 Use Z_BEST_SPEED for filebuf deflating
This is what Git uses by default for all deflating.
2011-04-10 12:23:55 -07:00
nulltoken
4a34b3a9ff Add two new accessors to the repository
git_repository_path() and git_repository_workdir() respectively return the path to the git repository and the working directory. Those paths are absolute and normalized.
2011-04-09 15:25:24 -07:00
Vicent Marti
b918ae40d1 Do not declare variables in the middle of a func 2011-04-08 15:35:25 -07:00
Vicent Marti
41233c40c0 Add new method git_repository_is_empty 2011-04-08 12:42:18 -07:00
Vicent Marti
cef75d7430 Remove unused variables from test files 2011-04-08 12:41:17 -07:00
Vicent Marti
d79f1da65a refs: Fix issue when packing weak tags
Weak tags (e.g. tags that point directly to a normal object instead of a
tag object) were failing to be packed.
2011-04-08 12:14:33 -07:00
Carlos Martín Nieto
7bc66a79fa tag: don't allow tags to non-existent objects
These indicate an inconsistency in the repository which we've created,
so don't allow them.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-08 03:36:53 +03:00
Shuhei Tanuma
98ac678085 fix git_treebuilder_insert probrem.
couldn't add new entry when inserting new one with `git_treebuilder_insert`.
2011-04-08 03:30:47 +03:00
Dmitry Kovega
8a64bc292c redis backend 2011-04-08 03:27:01 +03:00
Carlos Martín Nieto
8bd6c0ab83 Merge remote-tracking branch 'upstream/development' into config 2011-04-06 15:49:29 +02:00
Vicent Marti
0ad6efa110 Build & write custom trees in memory 2011-04-04 19:25:33 +03:00
Carlos Martín Nieto
511b2370d9 tests: update NAMING file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-04 17:24:37 +02:00
Carlos Martín Nieto
8cd767ef52 config: test for a variable on its own
If a variable is on its own, truth should be assumed. Check this is
true in our code.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-04 17:07:47 +02:00
Carlos Martín Nieto
0bf8ca8820 config: add tests
These tests are basic, but they should tell us when we've broken
something.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-04-04 16:44:23 +02:00
nulltoken
f3564e1e29 Fix tag reference name in testrepo.git
The git test repository was holding a wrongly named tag reference ("very-simple") pointing at a tag named "e90810b".
This mistake (mine :-/ ) originates back to https://github.com/libgit2/libgit2/commit/9282e92

Whole credit goes to @tclem for having spotted this.
2011-04-04 13:12:23 +03:00
Vicent Marti
3e3e4631a0 Merge branch 'tagging' of https://github.com/nulltoken/libgit2 into development
Conflicts:
	include/git2/tag.h
	src/tag.c
2011-04-02 12:50:25 +03:00
Vicent Marti
720d5472f8 Change parse methods to const buffer
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-04-02 12:42:04 +03:00
nulltoken
9e680bcc00 Add git_tag_delete() 2011-03-30 23:26:36 +02:00
nulltoken
a50c145855 Add git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag reference, if any 2011-03-30 23:16:30 +02:00
nulltoken
74e50a2d3e Fix memory leak in tag releated tests 2011-03-30 22:46:52 +02:00