]> git.proxmox.com Git - libgit2.git/log
libgit2.git
13 years agostatus: get blob object id of file on disk
Jason Penny [Wed, 22 Jun 2011 22:19:46 +0000 (18:19 -0400)]
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'.

13 years agoUpdate tests/NAMING
Jason Penny [Sat, 9 Jul 2011 02:44:15 +0000 (22:44 -0400)]
Update tests/NAMING

13 years agotsort: Remove unused CLZ methods
Vicent Marti [Sat, 9 Jul 2011 11:27:08 +0000 (13:27 +0200)]
tsort: Remove unused CLZ methods

13 years agoMerge pull request #311 from nulltoken/ntk/fix-win32-specs
Vicent Martí [Sat, 9 Jul 2011 11:24:23 +0000 (04:24 -0700)]
Merge pull request #311 from nulltoken/ntk/fix-win32-specs

Ntk/fix win32 specs

13 years agowin32: replace usage of _MSV_VER with _MSC_VER
nulltoken [Sat, 9 Jul 2011 06:41:02 +0000 (08:41 +0200)]
win32: replace usage of _MSV_VER with _MSC_VER

13 years agoFix MSVC compilation warning
nulltoken [Sat, 9 Jul 2011 06:36:37 +0000 (08:36 +0200)]
Fix MSVC compilation warning

13 years agoRemove unused methods
Vicent Marti [Sat, 9 Jul 2011 00:37:16 +0000 (02:37 +0200)]
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.

13 years agoodb: Direct writes are back
Vicent Marti [Sat, 9 Jul 2011 00:10:46 +0000 (02:10 +0200)]
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.

13 years agoposix: Portable `vsnprintf`
Vicent Marti [Fri, 8 Jul 2011 21:01:37 +0000 (23:01 +0200)]
posix: Portable `vsnprintf`

Our good, lovely folks at Microsoft decided that there was no good
reason to make `vsnprintf` compilant with the C standard, so that
function in Windows returns -1 on overflow, instead of returning the
actual byte count needed to write the full string.

We now handle this situation more gracefully with the POSIX
compatibility layer, by returning the needed byte size using an
auxiliary method instead of blindly resizing the target buffer until it
fits.

This means we can now support `printf`s of any size by allocating a
temporary buffer. That's good.

13 years agosignature: Fix optional header
Vicent Marti [Fri, 8 Jul 2011 16:31:05 +0000 (18:31 +0200)]
signature: Fix optional header

13 years agoreflog: add API to read or write a reference log
schu [Tue, 28 Jun 2011 12:13:12 +0000 (14:13 +0200)]
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>
13 years agogit_signature__write: make header optionally
schu [Sun, 19 Jun 2011 21:06:53 +0000 (23:06 +0200)]
git_signature__write: make header optionally

Signed-off-by: schu <schu-github@schulog.org>
13 years agoindex: Return `GIT_ENOTFOUND` when an entry cannot be opened
Vicent Marti [Fri, 8 Jul 2011 16:22:44 +0000 (18:22 +0200)]
index: Return `GIT_ENOTFOUND` when an entry cannot be opened

13 years agoMerge pull request #309 from schu/rr-flaw
Vicent Martí [Fri, 8 Jul 2011 16:21:30 +0000 (09:21 -0700)]
Merge pull request #309 from schu/rr-flaw

reference_rename: fix flaw in force-renaming

13 years agoMerge pull request #308 from schu/unused-but-set-var
Vicent Martí [Fri, 8 Jul 2011 16:21:13 +0000 (09:21 -0700)]
Merge pull request #308 from schu/unused-but-set-var

tsort: remove unused but set variable

13 years agoreference_rename: fix flaw in force-renaming
schu [Thu, 7 Jul 2011 19:24:12 +0000 (21:24 +0200)]
reference_rename: fix flaw in force-renaming

reference_rename didn't respect the force flag. Fixed.

Reported-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
13 years agoreference_renaming: add additional tests
nulltoken [Thu, 7 Jul 2011 15:49:55 +0000 (17:49 +0200)]
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>
13 years agotsort: remove unused but set variable
schu [Thu, 7 Jul 2011 16:14:53 +0000 (18:14 +0200)]
tsort: remove unused but set variable

Signed-off-by: schu <schu-github@schulog.org>
13 years agoindex: Fix memory leak on OOM
Vicent Marti [Thu, 7 Jul 2011 15:56:10 +0000 (17:56 +0200)]
index: Fix memory leak on OOM

13 years agotag: add pattern based retrieval of list of tag names
nulltoken [Thu, 7 Jul 2011 11:47:45 +0000 (13:47 +0200)]
tag: add pattern based retrieval of list of tag names

13 years agotsort: fix wrong header inclusion
nulltoken [Thu, 7 Jul 2011 11:38:47 +0000 (13:38 +0200)]
tsort: fix wrong header inclusion

13 years agotest-core: Fix warning in uniq test
Vicent Marti [Thu, 7 Jul 2011 10:23:47 +0000 (12:23 +0200)]
test-core: Fix warning in uniq test

13 years agoFix MSVC compilation warnings
nulltoken [Thu, 7 Jul 2011 08:11:00 +0000 (10:11 +0200)]
Fix MSVC compilation warnings

13 years agovector: Timsort all of the things
Vicent Marti [Wed, 6 Jul 2011 23:46:20 +0000 (01:46 +0200)]
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.

13 years agotest: Abort when the temp workdir cannot be created
Vicent Marti [Wed, 6 Jul 2011 23:04:14 +0000 (01:04 +0200)]
test: Abort when the temp workdir cannot be created

13 years agoMerge pull request #306 from carlosmn/development
Vicent Martí [Wed, 6 Jul 2011 23:58:06 +0000 (16:58 -0700)]
Merge pull request #306 from carlosmn/development

Fix network MSYS compilation

13 years agoMerge pull request #307 from nulltoken/patch-1
Vicent Martí [Wed, 6 Jul 2011 19:29:22 +0000 (12:29 -0700)]
Merge pull request #307 from nulltoken/patch-1

Fix MSVC compilation warnings

13 years agoFix MSVC compilation warnings
nulltoken [Wed, 6 Jul 2011 19:27:51 +0000 (12:27 -0700)]
Fix MSVC compilation warnings

13 years agoMerge pull request #296 from kiryl/index-optimization
Vicent Martí [Wed, 6 Jul 2011 17:55:06 +0000 (10:55 -0700)]
Merge pull request #296 from kiryl/index-optimization

Index optimization

13 years agorevwalk: Properly mark uninteresting commits
Vicent Marti [Wed, 6 Jul 2011 17:46:41 +0000 (19:46 +0200)]
revwalk: Properly mark uninteresting commits

13 years agorefs: Cleanup reference renaming
Vicent Marti [Wed, 6 Jul 2011 16:08:13 +0000 (18:08 +0200)]
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.

13 years agoMerge pull request #303 from schu/ref-rename
Vicent Martí [Wed, 6 Jul 2011 13:54:11 +0000 (06:54 -0700)]
Merge pull request #303 from schu/ref-rename

reference_rename: git compliant reference renaming v2

13 years agoFix network MSYS compilation
Carlos Martín Nieto [Wed, 6 Jul 2011 07:11:03 +0000 (09:11 +0200)]
Fix network MSYS compilation

MSYS/MinGW uses winsock but obviously doesn't set _MSC_VER. Use _WIN32
to decide whether to use winsock or BSD headers. Also remove these
headers from src/transport_git.c altogether, as they are not needed.

MSYS is very conservative, so we have to tell it that we don't care
about versions of Windows lower than WindowsXP. We also need to tell
CMake to add ws2_32 to the libraries list and we shouldn't add the
-fPIC option, to MSYS because it complains that it does it anyway.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
13 years agoRemove duplicated recursive directory removal related code
nulltoken [Sun, 3 Jul 2011 20:27:05 +0000 (22:27 +0200)]
Remove duplicated recursive directory removal related code

13 years agoFix windows specific issues
nulltoken [Sun, 3 Jul 2011 12:42:32 +0000 (14:42 +0200)]
Fix windows specific issues

 - msvc compilation warnings
 - not released file handle that prevents file removal

13 years agoreference_rename: git compliant reference renaming
schu [Tue, 14 Jun 2011 13:16:43 +0000 (15:16 +0200)]
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>
13 years agoAdd tests for git_futils_rmdir_resurs()
schu [Thu, 9 Jun 2011 17:56:42 +0000 (19:56 +0200)]
Add tests for git_futils_rmdir_resurs()

Signed-off-by: schu <schu-github@schulog.org>
13 years agofileops: add git_futils_rmdir_recurs()
schu [Thu, 9 Jun 2011 17:51:33 +0000 (19:51 +0200)]
fileops: add git_futils_rmdir_recurs()

git_futils_rmdir_recurs() shall remove the given directory and all
subdirectories. This happens only if the directories are empty.

Signed-off-by: schu <schu-github@schulog.org>
13 years agofileops: add convenience function is_dot_or_dotdot()
schu [Thu, 9 Jun 2011 16:11:11 +0000 (18:11 +0200)]
fileops: add convenience function is_dot_or_dotdot()

Signed-off-by: schu <schu-github@schulog.org>
13 years agoAdd test case checking renaming of a branch to a new name prefixed with
schu [Sun, 29 May 2011 14:46:24 +0000 (16:46 +0200)]
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>
13 years agobuild: Add simple Makefile for embedding the library
Vicent Marti [Wed, 6 Jul 2011 00:14:30 +0000 (02:14 +0200)]
build: Add simple Makefile for embedding the library

Run `make -f Makefile.embed` to get a `libgit2.a` with no dependencies
and no configuration on any Unix-like system.

The generated library can be linked with any piece of software without
licensing issues.

Have fun.

13 years agofnmatch: Fix compilation under Windows
Vicent Marti [Tue, 5 Jul 2011 23:44:15 +0000 (01:44 +0200)]
fnmatch: Fix compilation under Windows

13 years agofnmatch: Use native on Unix, emulate on Win32
Vicent Marti [Tue, 5 Jul 2011 23:04:04 +0000 (01:04 +0200)]
fnmatch: Use native on Unix, emulate on Win32

13 years agoAlso update local_connect's unused var name for MSVC
Carlos Martín Nieto [Tue, 5 Jul 2011 19:15:03 +0000 (21:15 +0200)]
Also update local_connect's unused var name for MSVC

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMerge pull request #305 from nulltoken/patch-6
Vicent Martí [Tue, 5 Jul 2011 19:32:20 +0000 (12:32 -0700)]
Merge pull request #305 from nulltoken/patch-6

repository: fix typo'ed assert

13 years agorepository: fix typo'ed assert
nulltoken [Tue, 5 Jul 2011 18:00:32 +0000 (11:00 -0700)]
repository: fix typo'ed assert

13 years agoMerge pull request #304 from carlosmn/config
Vicent Martí [Tue, 5 Jul 2011 17:50:13 +0000 (10:50 -0700)]
Merge pull request #304 from carlosmn/config

Restore config10 test file

13 years agoRestore config10 test file
Carlos Martín Nieto [Tue, 5 Jul 2011 15:44:51 +0000 (17:44 +0200)]
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>
13 years agoindex: introduce git_index_uniq() function
Kirill A. Shutemov [Fri, 1 Jul 2011 22:08:42 +0000 (01:08 +0300)]
index: introduce git_index_uniq() function

It removes all entries with equal path except last added.

On large indexes git_index_append() + git_index_uniq() before writing is
*much* faster, than git_index_add().

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agovector: implement git_vector_uniq()
Kirill A. Shutemov [Fri, 1 Jul 2011 21:41:49 +0000 (00:41 +0300)]
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>
13 years agovector, index: use git__msort() for vector sorting
Kirill A. Shutemov [Thu, 30 Jun 2011 21:48:37 +0000 (00:48 +0300)]
vector, index: use git__msort() for vector sorting

Index operation use git_vector_sort() to sort index entries. Since index
support adding duplicates (two or more entries with the same path), it's
important to preserve order of elements. Preserving order of elements
allows to make decisions based on order. For example it's possible to
implement function witch removes all duplicates except last added.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoutil: introduce merge sort routine
Kirill A. Shutemov [Thu, 30 Jun 2011 21:34:23 +0000 (00:34 +0300)]
util: introduce merge sort routine

In some cases it's important to preserve order of elements with equal
keys (stable sort). qsort(3) doesn't define order of elements with
equal keys.

git__msort() implements merge sort which is stable sort.

Implementation taken from git. Function renamed git_qsort() -> git__msort().

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoindex: speedup git_index_append()/git_index_append2()
Kirill A. Shutemov [Thu, 30 Jun 2011 20:22:42 +0000 (23:22 +0300)]
index: speedup git_index_append()/git_index_append2()

git_index_find() in index_insert() is useless if replace is not
requested (append). Do not call it in this case.
It speedup git_index_append() *dramatically* on large indexes.

$ cat index_test.c

int main(int argc, char **argv)
{
        git_index *index;
        git_repository *repo;
        git_odb *odb;
        struct git_index_entry entry;
        git_oid tree_oid;
        char tree_hex[41];
        int i;

        git_repository_init(&repo, "/tmp/myrepo", 0);
        odb = git_repository_database(repo);
        git_repository_index(&index, repo);

        memset(&entry, 0, sizeof(entry));
        git_odb_write(&entry.oid, odb, "", 0, GIT_OBJ_BLOB);
        entry.path = "test.file";

        for (i = 0; i < 50000; i++)
                git_index_append2(index, &entry);

        git_tree_create_fromindex(&tree_oid, index);
        git_oid_fmt(tree_hex, &tree_oid);
        tree_hex[40] = '\0';
        printf("tree: %s\n", tree_hex);

        git_index_free(index);
        git_repository_free(repo);

        return 0;
}

Before:
$ time ./index_test
tree: 43f73659c43b651588cc81459d9e25b08721b95d
./index_test  151.19s user 0.05s system 99% cpu 2:31.78 total

After:
$ time ./index_test
tree: 43f73659c43b651588cc81459d9e25b08721b95d
./index_test  0.05s user 0.00s system 94% cpu 0.059 total

About 2573 times speedup on this test :)

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agorepository: Fix unused parameter in Unix systems
Vicent Marti [Tue, 5 Jul 2011 13:38:26 +0000 (15:38 +0200)]
repository: Fix unused parameter in Unix systems

13 years agoMerge pull request #302 from carlosmn/development
Vicent Martí [Tue, 5 Jul 2011 13:35:45 +0000 (06:35 -0700)]
Merge pull request #302 from carlosmn/development

Small fixes in pack_window_open

13 years agoMerge pull request #299 from kiryl/examples-general-warnings
Vicent Martí [Tue, 5 Jul 2011 13:33:28 +0000 (06:33 -0700)]
Merge pull request #299 from kiryl/examples-general-warnings

Fix warning in examples/general.c

13 years agoMerge pull request #297 from nulltoken/patch-5
Vicent Martí [Tue, 5 Jul 2011 13:32:58 +0000 (06:32 -0700)]
Merge pull request #297 from nulltoken/patch-5

Fix MSVC compilation issue

13 years agoSmall fixes in pack_window_open
Carlos Martín Nieto [Tue, 5 Jul 2011 13:09:17 +0000 (15:09 +0200)]
Small fixes in pack_window_open

Check if the window structure has actually been allocated before
trying to access it, and don't leak said structure if the map fails.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMerge pull request #301 from carlosmn/hashtable-include-fix
Vicent Martí [Tue, 5 Jul 2011 13:27:56 +0000 (06:27 -0700)]
Merge pull request #301 from carlosmn/hashtable-include-fix

Include common.h in hashtable.h

13 years agoInclude common.h in hashtable.h
Carlos Martín Nieto [Tue, 5 Jul 2011 12:36:22 +0000 (14:36 +0200)]
Include common.h in hashtable.h

Without this, hashtable.h doesn't know what uint32_t is and the
compiler thinks that it's a function type.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoMerge pull request #300 from carlosmn/gsoc2011/master
Vicent Martí [Tue, 5 Jul 2011 11:31:37 +0000 (04:31 -0700)]
Merge pull request #300 from carlosmn/gsoc2011/master

A bit of networking

13 years agoexamples/general: fix misc warnings
Kirill A. Shutemov [Tue, 5 Jul 2011 09:00:18 +0000 (12:00 +0300)]
examples/general: fix misc warnings

examples/general.c:393:25: warning: unused variable ‘reftarget’ [-Wunused-variable]
examples/general.c:357:19: warning: unused variable ‘e’ [-Wunused-variable]
examples/general.c:444:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoexamples/general: fix warnings on not handled reference type in switch
Kirill A. Shutemov [Tue, 5 Jul 2011 08:54:16 +0000 (11:54 +0300)]
examples/general: fix warnings on not handled reference type in switch

examples/general.c:402:5: warning: enumeration value ‘GIT_REF_INVALID’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_PACKED’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_HAS_PEEL’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_LISTALL’ not handled in switch [-Wswitch]

Signe-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoexamples/general: fix git_commit_create_v() arguments type
Kirill A. Shutemov [Tue, 5 Jul 2011 08:43:21 +0000 (11:43 +0300)]
examples/general: fix git_commit_create_v() arguments type

general.c:208: warning: passing argument 7 of 'git_commit_create_v' from incompatible pointer type

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoFix MSVC compilation issue
nulltoken [Tue, 5 Jul 2011 08:09:37 +0000 (01:09 -0700)]
Fix MSVC compilation issue

13 years agoAdd variable writing tests
Carlos Martín Nieto [Tue, 28 Jun 2011 14:48:04 +0000 (16:48 +0200)]
Add variable writing tests

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoAdd test for section header at end of file
Carlos Martín Nieto [Tue, 28 Jun 2011 14:27:16 +0000 (16:27 +0200)]
Add test for section header at end of file

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoCorrectly detect truncated input in header parsing
Carlos Martín Nieto [Tue, 28 Jun 2011 14:24:51 +0000 (16:24 +0200)]
Correctly detect truncated input in header parsing

If the section header is the last line in the file,
parse_section_header would incorrectly decide that the input had been
truncated.

Fix this by checking whether the actual input line is correctly
formatted.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agogit_config_add_file should rethrow
Carlos Martín Nieto [Tue, 28 Jun 2011 14:08:46 +0000 (16:08 +0200)]
git_config_add_file should rethrow

Otherwise, the information about why there was an error gets lost.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoAdd tests for deleting a config var
Carlos Martín Nieto [Tue, 28 Jun 2011 13:21:44 +0000 (15:21 +0200)]
Add tests for deleting a config var

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agoAdd git_config_del to delete a variable
Carlos Martín Nieto [Tue, 28 Jun 2011 13:20:42 +0000 (15:20 +0200)]
Add git_config_del to delete a variable

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
13 years agosignature: Fix warnings
Vicent Marti [Tue, 5 Jul 2011 00:28:18 +0000 (02:28 +0200)]
signature: Fix warnings

Add extra braces to avoid ambiguous if-else.

Also, free() doesn't need a check.

13 years agosignature: straighten the creation of a signature
nulltoken [Sun, 3 Jul 2011 12:03:43 +0000 (14:03 +0200)]
signature: straighten the creation of a signature

 - Fails on empty name and/or email
 - Trims leading and trailing spaces of name and email

13 years agosignature: enhance relaxed parsing of bogus signatures
nulltoken [Fri, 1 Jul 2011 15:59:10 +0000 (17:59 +0200)]
signature: enhance relaxed parsing of bogus signatures

Final fix for issue #278

13 years agot04-commit: add tests for git_signature__parse
schu [Tue, 28 Jun 2011 15:06:06 +0000 (17:06 +0200)]
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>
13 years agogit_signature__parse: make parsing less strict
schu [Wed, 29 Jun 2011 12:48:09 +0000 (14:48 +0200)]
git_signature__parse: make parsing less strict

git_signature__parse used to be very strict about what's a well-formed
signature. Since git_signature__parse is used only when reading already
existing signatures, we should not care about if it's a valid signature
too much but rather show what we got.

Reported-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
13 years agorepository: Cleanup initialization
Vicent Marti [Mon, 4 Jul 2011 23:33:39 +0000 (01:33 +0200)]
repository: Cleanup initialization

13 years agofileutils: Finish dropping the old `prettify_path`
Vicent Marti [Mon, 4 Jul 2011 23:11:33 +0000 (01:11 +0200)]
fileutils: Finish dropping the old `prettify_path`

13 years agofileops: Fix stat() on directories for W32
Vicent Marti [Mon, 4 Jul 2011 19:33:26 +0000 (21:33 +0200)]
fileops: Fix stat() on directories for W32

The `stat` methods were having issues when called with a trailing slash
in Windows platforms.

We now use GetFileAttributes() where possible, which doesn't have this
restriction.

13 years agofileops: Drop `git_fileops_prettify_path`
Vicent Marti [Mon, 4 Jul 2011 18:05:11 +0000 (20:05 +0200)]
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.

13 years agofileops: Cleanup
Vicent Marti [Mon, 4 Jul 2011 09:43:34 +0000 (11:43 +0200)]
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.

13 years agobuild: Move OS-specific compat to their own folders
Vicent Marti [Sun, 3 Jul 2011 11:33:43 +0000 (13:33 +0200)]
build: Move OS-specific compat to their own folders

13 years agocleanup: remove trailing spaces
Kirill A. Shutemov [Thu, 30 Jun 2011 16:52:34 +0000 (19:52 +0300)]
cleanup: remove trailing spaces

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agocmake: Use system zlib if found on non-Windows systems
Tim Harder [Fri, 1 Jul 2011 15:39:03 +0000 (17:39 +0200)]
cmake: Use system zlib if found on non-Windows systems

13 years agozlib: Declare preprocessor directives at build time
Vicent Marti [Fri, 1 Jul 2011 15:34:27 +0000 (17:34 +0200)]
zlib: Declare preprocessor directives at build time

13 years agobuild: Simplify build structure
Vicent Marti [Fri, 1 Jul 2011 15:26:23 +0000 (17:26 +0200)]
build: Simplify build structure

This will make libgit2 more suitable for embedding.

13 years agocommon: Force 64 bit fileops at compile time
Vicent Marti [Thu, 30 Jun 2011 19:29:42 +0000 (21:29 +0200)]
common: Force 64 bit fileops at compile time

13 years agozlib: No visualization attributes.
Vicent Marti [Thu, 30 Jun 2011 19:10:16 +0000 (21:10 +0200)]
zlib: No visualization attributes.

The visibility attribute is a headache on many platforms like Solaris,
and not even supported on Windows.

13 years agorefs: Remove bogus assertion
Vicent Marti [Thu, 30 Jun 2011 18:53:59 +0000 (20:53 +0200)]
refs: Remove bogus assertion

The assertion in line 360 was there to check that only loose refs were
being written as loose, but there are times when we need to re-write a
packed reference as loose.

13 years agoconfig: Fix unmatched parameters in docs
Vicent Marti [Wed, 29 Jun 2011 13:11:34 +0000 (15:11 +0200)]
config: Fix unmatched parameters in docs

13 years agoMerge pull request #287 from kiryl/development
Vicent Martí [Thu, 30 Jun 2011 14:12:42 +0000 (07:12 -0700)]
Merge pull request #287 from kiryl/development

filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE

13 years agoMerge pull request #288 from nulltoken/patch-4
Vicent Martí [Thu, 30 Jun 2011 14:11:04 +0000 (07:11 -0700)]
Merge pull request #288 from nulltoken/patch-4

GIT_EXTERN'd  head_detached() and head_orphan()

13 years agorepository: Make head_detached() and head_orphan() convenience methods accessible...
nulltoken [Thu, 30 Jun 2011 13:56:58 +0000 (06:56 -0700)]
repository: Make head_detached() and head_orphan() convenience methods accessible to bindings

13 years agofilebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE
Kirill A. Shutemov [Wed, 29 Jun 2011 21:16:23 +0000 (00:16 +0300)]
filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
13 years agoMerge pull request #284 from nulltoken/topic/hide-git-dir
Vicent Martí [Wed, 29 Jun 2011 19:14:29 +0000 (12:14 -0700)]
Merge pull request #284 from nulltoken/topic/hide-git-dir

Hide ".git" directory on Windows upon creation of a non bare repository

13 years agoHide ".git" directory on Windows upon creation of a non bare repository
nulltoken [Wed, 29 Jun 2011 12:06:18 +0000 (14:06 +0200)]
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.

13 years agoconfig: `foreach` now returns variable values too
Vicent Marti [Wed, 29 Jun 2011 13:09:21 +0000 (15:09 +0200)]
config: `foreach` now returns variable values too

13 years agorefs: Remove duplicate rename method
Vicent Marti [Wed, 29 Jun 2011 09:01:35 +0000 (11:01 +0200)]
refs: Remove duplicate rename method

`git_reference_rename` now takes a `force` flag

13 years agosig: allow empty names
Carlos Martín Nieto [Tue, 28 Jun 2011 20:04:27 +0000 (22:04 +0200)]
sig: allow empty names

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
13 years agorepo: Fix git_repository_is_empty
Vicent Marti [Tue, 28 Jun 2011 19:30:15 +0000 (21:30 +0200)]
repo: Fix git_repository_is_empty