src


Log

Author Commit Date CI Message
Russell Belfer 1dbcc9fc 2012-01-11T21:07:16 Fix several memory issues This contains fixes for several issues discovered by MSVC and by valgrind, including some bad data access, some memory leakage (in where certain files were not being successfully added to the cache), and some code simplification.
Russell Belfer 0cfcff5d 2012-01-11T20:41:55 Convert git_path_walk_up to regular function This gets rid of the crazy macro version of git_path_walk_up and makes it into a normal function that takes a callback parameter. This turned out not to be too messy.
Russell Belfer 15debaf5 2012-01-11T17:28:25 Fix bug in dir_for_path The last checkin accidentally broke dir_for_path by propogating the dirname return code even when there was no error.
Russell Belfer 6a67a812 2012-01-11T16:01:48 Allow ignores (and attribs) for nonexistent files This fixes issue 532 that attributes (and gitignores) could not be checked for files that don't exist. It should be possible to query such things regardless of the existence of the file.
Russell Belfer df743c7d 2012-01-09T15:37:19 Initial implementation of gitignore support Adds support for .gitignore files to git_status_foreach() and git_status_file(). This includes refactoring the gitattributes code to share logic where possible. The GIT_STATUS_IGNORED flag will now be passed in for files that are ignored (provided they are not already in the index or the head of repo).
Russell Belfer 7e443f69 2012-01-09T15:46:06 Restore portability to git_path_prettify. It turns out that passing NULL for the second parameter of realpath(3) is not as portable as one might like. Notably, Mac OS 10.5 and earlier does not support it. So this moves us back to a large buffer to get the realpath info.
Vicent Martí 1d175074 2012-01-05T17:46:06 Merge pull request #528 from arrbee/valgrind-fixes-2 Valgrind fixes in smaller pieces
Russell Belfer fa3cb0da 2012-01-05T15:15:43 Fix memory leak in git_index_remove. Missed freeing the entry.
Russell Belfer 2d840502 2012-01-05T15:03:42 Throw first error in chain, not rethrow. This is the first time this error is throw, so use git__throw instead of git__rethrow.
Jeff King 671bbdd3 2012-01-05T17:31:13 reflog_write: don't access free()'d memory We get the oid of a reference, free the reference, then convert the oid to a string. We need to convert the oid before freeing the memory.
Vicent Martí f2114d0a 2012-01-04T22:40:59 Merge remote-tracking branch 'nulltoken/topix/path_fromurl' into development Conflicts: tests-clay/clay.h tests-clay/clay_main.c
nulltoken f46e6226 2012-01-04T21:15:12 Fix Windows specific off-by-one error The value returned by MultiByteToWideChar includes the NULL termination character.
nulltoken acb159e1 2012-01-04T17:59:48 Fix MSVC compilation warnings
Vincent Lee c6a437ea 2012-01-03T19:44:13 Add missing semicolon
Vicent Martí 7a704309 2012-01-02T09:58:39 Merge remote-tracking branch 'drizzd/diff-index-tests' into development Conflicts: tests-clay/clay.h tests-clay/clay_main.c
Vicent Martí 9191a6d2 2012-01-02T09:56:48 Merge remote-tracking branch 'arrbee/git-attributes' into development Conflicts: tests-clay/clay_main.c
Vicent Martí 9dd4c3e8 2011-12-31T05:56:39 config: Rename the `delete` callback name `delete` is a reserved keyword in C++.
Russell Belfer bd370b14 2011-12-30T15:00:14 Improved gitattributes macro implementation This updates to implementation of gitattribute macros to be much more similar to core git (albeit not 100%) and to handle expansion of macros within macros, etc. It also cleans up the refcounting usage with macros to be much cleaner. Also, this adds a new vector function `git_vector_insert_sorted()` which allows you to maintain a sorted list as you go. In order to write that function, this changes the function `git__bsearch()` to take a somewhat different set of parameters, although the core functionality is still the same.
Clemens Buchacher 1f783edf 2011-12-29T15:03:38 do not use full path in diff-index Currently, diff_index passes the full relative path from the repository root to the callback. In case of an addition, it passes the tree entry instead of the index entry. This change fixes the path used for addition, and it passes only the basename of the path. This mimics the current behavior of git_tree_diff.
Clemens Buchacher e4592538 2011-12-29T13:12:51 allow opening index in bare repo The git.git implementation allows this, and there is no reason not to.
Clemens Buchacher 599f2849 2011-12-26T18:37:31 add git_index_read_tree
Clemens Buchacher a26a1563 2011-12-30T19:03:55 move entry_is_tree to tree.h
Russell Belfer c6d2a2c0 2011-12-29T21:31:30 Fixed up memory leaks
Russell Belfer 73b51450 2011-12-28T23:28:50 Add support for macros and cache flush API. Add support for git attribute macro definitions. Also, add support for cache flush API to clear the attribute file content cache when needed. Additionally, improved the handling of global and system files, making common utility functions in fileops and converting config and attr to both use the common functions. Adds a bunch more tests and fixed some memory leaks. Note that adding macros required me to use refcounted attribute assignment definitions, which complicated, but probably improved memory usage.
nulltoken e2580375 2011-12-28T11:36:18 transport: make local transport accept a file Uri containing percent-encoded characters This makes libgit2 compliant with the following scenario $ git ls-remote file:///d:/temp/dwm%20tinou 732d790b702db4b8985f5104fc44642654f6a6b6 HEAD 732d790b702db4b8985f5104fc44642654f6a6b6 refs/heads/master 732d790b702db4b8985f5104fc44642654f6a6b6 refs/remotes/origin/HEAD 732d790b702db4b8985f5104fc44642654f6a6b6 refs/remotes/origin/master $ mv "/d/temp/dwm tinou" /d/temp/dwm+tinou $ git ls-remote file:///d:/temp/dwm%20tinou fatal: 'd:/temp/dwm tinou' does not appear to be a git repository fatal: The remote end hung up unexpectedly $ git ls-remote file:///d:/temp/dwm+tinou 732d790b702db4b8985f5104fc44642654f6a6b6 HEAD 732d790b702db4b8985f5104fc44642654f6a6b6 refs/heads/master 732d790b702db4b8985f5104fc44642654f6a6b6 refs/remotes/origin/HEAD 732d790b702db4b8985f5104fc44642654f6a6b6 refs/remotes/origin/master
nulltoken 2017a15d 2011-12-27T16:03:28 path: add git_path_fromurl()
nulltoken 459e2dcd 2011-12-27T11:18:57 path: add git__percent_decode()
nulltoken eb8de747 2011-12-28T20:24:58 util: add git__fromhex()
Vicent Martí d16e4b2b 2011-12-25T00:25:04 remotes: Remove unused variables
Vicent Martí fa515656 2011-12-25T00:22:20 refs: Fix double free Includes relevant Clay test
nulltoken db1f7e59 2011-12-21T16:36:34 remote: add test to retrieve the advertised references from a local repository and fix related implementation
Russell Belfer ee1f0b1a 2011-12-16T10:56:43 Add APIs for git attributes This adds APIs for querying git attributes. In addition to the new API in include/git2/attr.h, most of the action is in src/attr_file.[hc] which contains utilities for dealing with a single attributes file, and src/attr.[hc] which contains the implementation of the APIs that merge all applicable attributes files.
schu e95849c1 2011-12-16T11:39:21 config_file: honor error Return an error if we can't write an updated version of the config file after config_delete. Along with that, fix an uninitialized warning. Signed-off-by: schu <schu-github@schulog.org>
Russell Belfer 86e356ee 2011-12-18T12:08:50 Restore missing lstat in index_entry_init In an effort to remove duplicate code, I accidentally left the stat structure uninitialized in this function. This patch restores that data gathering.
Carlos Martín Nieto 80a665aa 2011-12-16T02:28:39 config: really delete variables Instead of just setting the value to NULL, which gives unwanted results when asking for that variable after deleting it, delete the variable from the list and re-write the file.
Carlos Martín Nieto 7b2b4adf 2011-12-16T01:39:28 Revert "config: Return ENOTFOUND when a variable was deleted" This would make us think that config variables like [core] something is missing.
Vicent Marti 2ea14da6 2011-12-15T18:14:41 config: Return ENOTFOUND when a variable was deleted
Russell Belfer b5daae68 2011-12-14T12:34:43 Allow git_buf_joinpath to accept self-joins It was not safe for git_buf_joinpath to be used with a pointer into the buf itself because a reallocation could invalidate the input parameter that pointed into the buffer. This patch makes it safe to self join, at least for the leading input to the join, which is the common "append" case for self joins. Also added unit tests to explicitly cover this case. This should actually fix #511
Russell Belfer d6cceddd 2011-12-14T10:52:28 Check error on path manipulations. This commit fixes #511.
nulltoken 489c3666 2011-12-14T20:00:34 posix_w32: prevent segfaulting on Windows when building a temporary filename
Vicent Marti bf6d2717 2011-12-14T03:27:53 buffer: inline `git_buf_cstr`
Vicent Marti 7af26f8f 2011-12-14T03:24:16 Fix tree-diff with the new path API
Vicent Marti 40e73d6f 2011-12-09T01:38:46 Merge remote-tracking branch 'arrbee/git-buf-for-paths' into development Conflicts: tests-clay/clay_main.c
Russell Belfer 97769280 2011-11-30T11:27:15 Use git_buf for path storage instead of stack-based buffers This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
Vicent Marti e9238687 2011-12-03T18:05:44 tree: recursive diff-index Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk> Signed-off-by: Vicent Marti <tanoku@gmail.com> # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Carlos Martín Nieto <carlos@cmartin.tk> # # On branch development # Your branch is ahead of 'origin/development' by 11 commits. # # Changes to be committed: # (use "git reset HEAD^1 <file>..." to unstage) # # modified: include/git2/tree.h # modified: src/tree.c # modified: tests-clay/clay_main.c # modified: tests-clay/object/tree/diff.c # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # 0001-remote-Cleanup-the-remotes-code.patch # 466.patch # 466.patch.1 # 488.patch # Makefile # libgit2.0.15.0.dylib # libgit2.0.dylib # libgit2.dylib # libgit2_clay # libgit2_test # tests-clay/object/tree/
Carlos Martín Nieto a1fdea28 2011-10-24T16:48:12 tree: implement tree diffing For each difference in the trees, the callback gets called with the relevant information so the user can fill in their own data structures. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Russell Belfer 969d588d 2011-11-30T13:10:47 Optimized of git_buf_join. This streamlines git_buf_join and removes the join-append behavior, opting instead for a very compact join-replace of the git_buf contents. The unit tests had to be updated to remove the join-append tests and have a bunch more exhaustive tests added.
Russell Belfer 309113c9 2011-11-29T23:45:17 Make initial value of git_buf ptr always be a valid empty string. Taking a page from core git's strbuf, this introduces git_buf_initbuf which is an empty string that is used to initialize the git_buf ptr value even for new buffers. Now the git_buf ptr will always point to a valid NUL-terminated string. This change required jumping through a few hoops for git_buf_grow and git_buf_free to distinguish between a actual allocated buffer and the global initial value. Also, this moves the allocation related functions to be next to each other near the top of buffer.c.
Russell Belfer c63728cd 2011-11-29T16:39:49 Make git_buf functions always maintain a valid cstr. At a tiny cost of 1 extra byte per allocation, this makes git_buf_cstr into basically a noop, which simplifies error checking when trying to convert things to use dynamic allocation. This patch also adds a new function (git_buf_copy_cstr) for copying the cstr data directly into an external buffer.
schu fe9a0e09 2011-11-29T11:02:42 transports: fix -Wunused-but-set-variable warning Signed-off-by: schu <schu-github@schulog.org>
Vicent Martí 798dd36c 2011-11-29T01:39:52 Merge pull request #499 from arrbee/extend-git-buf Extend git_buf with new utility functions and unit tests.
Russell Belfer 679b69c4 2011-11-28T13:05:25 Resolve remaining feedback * replace some ints with size_ts * update NULL checks in various places
Carlos Martín Nieto 89886d0b 2011-11-28T21:08:29 Plug a bunch of leaks
Vicent Marti a5123ea8 2011-11-28T20:00:42 repository: Do not double-increment refcounts
Russell Belfer 3aa294fd 2011-11-28T10:42:57 Add two string git_buf_join and tweak input error checking. This commit addresses two of the comments: * renamed existing n-input git_buf_join to git_buf_join_n * added new git_buf_join that always takes two inputs * moved some parameter error checking to asserts * extended unit tests to cover new version of git_buf_join
Vicent Marti b2337143 2011-11-28T18:46:25 remote: Fix connected test
Vicent Marti d88d4311 2011-11-28T08:40:40 remote: Cleanup the remotes code - Hide the remaining transports code - Drop `git_headarray`, switch to using a callback to list refs. Makes the code cleaner.
Russell Belfer 8c74d22e 2011-11-27T21:47:58 Extend git_buf with new utility functions and unit tests. Add new functions to git_buf for: * initializing a buffer from a string * joining one or more strings onto a buffer with separators * swapping two buffers in place * extracting data from a git_buf (leaving it empty) Also, make git_buf_free leave a git_buf back in its initted state, and slightly tweak buffer allocation sizes and thresholds. Finally, port unit tests to clay and extend with lots of new tests for the various git_buf functions.
Vicent Marti c94785a9 2011-11-26T08:35:56 repository: Use `git_config` when initializing Thanks @carlosmn!
Vicent Marti b028a898 2011-11-26T08:31:57 util: Remove unused macro
Vicent Marti 03da4480 2011-11-26T08:31:15 refcount: Fix off-by one error
Vicent Marti 45e79e37 2011-11-26T04:59:21 Rename all `_close` methods There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
Vicent Marti 9462c471 2011-11-25T08:16:26 repository: Change ownership semantics The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
Vicent Martí 880b6f0c 2011-11-25T21:31:35 Merge pull request #497 from carlosmn/config Don't fail when opening a new config file
Vicent Martí e42ea1f4 2011-11-25T21:30:08 Merge pull request #491 from schu/refs-cleanup reference_rename() cleanup
Carlos Martín Nieto 4e90a0a4 2011-11-26T01:54:12 config: allow to open and write to a new file
Vicent Marti 2869f404 2011-11-22T15:48:37 transport: Add `git_transport_valid_url`
Carlos Martín Nieto 39157563 2011-11-22T11:16:44 Free the created refs in git_remote_update_tips
Carlos Martín Nieto a3147114 2011-11-22T10:30:30 Set transport to NULL after freeing it
Vicent Marti 4bef3565 2011-11-22T02:16:20 remote: Assert things that should be asserted
Vicent Martí bec92f78 2011-11-21T17:12:23 Merge pull request #492 from carlosmn/networking Networking improvements
Russell Belfer b762e576 2011-11-17T15:10:27 filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanups Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT and make git_filebuf_open and git_filebuf_cleanup safe to be called multiple times on the same buffer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Carlos Martín Nieto 6ac3b707 2011-11-21T20:48:59 Add git_remote_connected Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 4cf01e9a 2011-11-21T20:44:03 Add git_remote_disconnect It can be useful to separate disconnecting from actually destroying the object. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
schu a5cd086d 2011-11-21T11:56:00 reference_rename: don't delete the reflog reference_rename used to delete an old reflog file when renaming a reference to not confuse git.git. Don't do this anymore but let the user take care of writing a reflog entry. Signed-off-by: schu <schu-github@schulog.org>
schu b7c93a66 2011-11-21T13:01:40 Add git_reflog_rename() and git_reflog_delete() Signed-off-by: schu <schu-github@schulog.org>
schu 64093ce5 2011-11-21T11:30:14 reference_rename: make sure to rollback Actually rollback when we can't create the new reference. Mark the rolled back reference as loose. Signed-off-by: schu <schu-github@schulog.org>
schu bdbdefac 2011-11-21T13:06:07 fileops.h: remove git_futils_mv_atomic prototype 0c49ec2 replaced git_futils_mv_atomic with p_rename without removing its prototype. Signed-off-by: schu <schu-github@schulog.org>
Carlos Martín Nieto 0ca7ca3e 2011-10-09T03:07:53 refspec: allow a simple branchname A simple branchname as refspec is valid and we shouldn't throw an error when encountering one. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto dc9e960f 2011-10-09T02:59:01 refspec: make the structure more complete Add a next pointer to make it a linked list and add the 'pattern' and 'matching' flags. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 617bfdf4 2011-11-18T21:28:07 Add a name to a remote created from the API Make it a bit more resilient. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 95057b85 2011-11-18T21:18:39 remote: get rid of git_remote_negotiate There is no good reason to expose the negotiation as a different step to downloading the packfile. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 40a40e8e 2011-10-26T18:06:36 net: move the reference storage to common code
Carlos Martín Nieto 472d4d85 2011-11-17T20:32:04 Don't overwrite existing objects It's redundant to do this (git doesn't) and Windows doesn't allow us to overwrite a read-only file (which objects are). Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Marti 2ba14f23 2011-11-17T02:13:46 tree: Add payload to `git_tree_walk`
Vicent Marti 9432af36 2011-11-17T01:23:19 Rename `git_tree_frompath` to `git_tree_get_subtree` That makes more sense to me.
Brodie Rao 9788e72a 2011-11-16T11:39:03 refs: move GIT_PACKED_REFS_FILE_MODE to refs.h as GIT_PACKEDREFS_FILE_MODE This groups the #define with the other ref-related file modes, and it makes the name consistent with the other packed-refs definitions.
Brodie Rao 7096d0f9 2011-11-16T11:36:13 refs: use 0666 permissions when writing packed-refs, not 0644 This matches stock Git's behavior.
Vicent Marti a15c550d 2011-11-16T14:09:44 threads: Fix the shared global state with TLS See `global.c` for a description of what we're doing. When libgit2 is built with GIT_THREADS support, the threading system must be explicitly initialized with `git_threads_init()`.
Carlos Martín Nieto 657a3951 2011-11-07T20:32:03 Write packed-refs with 0644 permissions Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 718eb4b8 2011-11-07T20:06:01 Reword packed-refs error messages so they're easier to track down Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Carlos Martín Nieto 0c49ec2d 2011-11-07T19:34:24 Implement p_rename Move the callers of git_futils_mv_atomic to use p_rename. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Marti 62dd6d16 2011-11-06T02:52:43 reflog: Do not free references before time
Vicent Marti d4a0b124 2011-10-30T21:58:33 refs: Partial rewrite for read-only refs This new version of the references code is significantly faster and hopefully easier to read. External API stays the same. A new method `git_reference_reload()` has been added to force updating a memory reference from disk. In-memory references are no longer updated automagically -- this was killing us. If a reference is deleted externally and the user doesn't reload the memory object, nothing critical happens: any functions using that reference should fail gracefully (e.g. deletion, renaming, and so on). All generated references from the API are read only and must be free'd by the user. There is no reference counting and no traces of generated references are kept in the library. There is no longer an internal representation for references. There is only one reference struct `git_reference`, and symbolic/oid targets are stored inside an union. Packfile references are stored using an optimized struct with flex array for reference names. This should significantly reduce the memory cost of loading the packfile from disk.
schu 549bbd13 2011-08-13T18:14:39 git_reference_rename: cleanup reference renaming git_reference_rename() didn't properly cleanup old references given by the user to not break some ugly old tests. Since references don't point to libgit's internal cache anymore we can cleanup git_reference_rename() to be somewhat less messy. Signed-off-by: schu <schu-github@schulog.org>
schu 75abd2b9 2011-08-11T19:38:13 Free all used references in the source tree Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
schu a46ec457 2011-08-10T16:19:42 refs: split internal and external references Currently libgit2 shares pointers to its internal reference cache with the user. This leads to several problems like invalidation of reference pointers when reordering the cache or manipulation of the cache from user side. Give each user its own git_reference instead of leaking the internal representation (struct reference). Add the following new API functions: * git_reference_free * git_reference_is_packed Signed-off-by: schu <schu-github@schulog.org>
Vicent Martí d3104fa0 2011-10-29T14:06:36 Merge pull request #468 from nulltoken/ntk/fix/issue-465 Status: fix segfault (#465) and order issues
nulltoken e3baa3cc 2011-10-29T17:45:01 status: Fix a sorting issue in the treewalker This ensures that entries from the working directory are retrieved according to the following rules: - The file "subdir" should appear before the file "subdir.txt" - The folder "subdir" should appear after the file "subdir.txt"
nulltoken d1db74bf 2011-10-29T17:40:04 status: Prevent segfaulting when determining the status of a repository Fixes #465