1. 06 Mar, 2012 1 commit
    • error-handling: Repository · cb8a7961
      This also includes droping `git_buf_lasterror` because it makes no sense
      in the new system. Note that in most of the places were it has been
      dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so
      instead it should return a generic `-1` and obviously not throw
      anything.
      Vicent Martí committed
  2. 05 Mar, 2012 1 commit
  3. 02 Mar, 2012 8 commits
    • Revert GIT_STATUS constants to avoid issues · e1bcc191
      This reverts the changes to the GIT_STATUS constants and adds a
      new enumeration to describe the type of change in a git_diff_delta.
      I don't love this solution, but it should prevent strange errors
      from occurring for now.  Eventually, I would like to unify the
      various status constants, but it needs a larger plan and I just
      wanted to eliminate this breakage quickly.
      Russell Belfer committed
    • Clean up GIT_UNUSED macros on all platforms · 854eccbb
      It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5
      did not fix the GIT_USUSED behavior on all platforms.  This commit
      walks through and really cleans things up more thoroughly, getting
      rid of the unnecessary stuff.
      
      To remove the use of some GIT_UNUSED, I ended up adding a couple
      of new iterators for hashtables that allow you to iterator just
      over keys or just over values.
      
      In making this change, I found a bug in the clar tests (where we
      were doing *count++ but meant to do (*count)++ to increment the
      value).  I fixed that but then found the test failing because it
      was not really using an empty repo.  So, I took some of the code
      that I wrote for iterator testing and moved it to clar_helpers.c,
      then made use of that to make it easier to open fixtures on a
      per test basis even within a single test file.
      Russell Belfer committed
    • Update diff to use iterators · 74fa4bfa
      This is a major reorganization of the diff code.  This changes
      the diff functions to use the iterators for traversing the
      content.  This allowed a lot of code to be simplified.  Also,
      this moved the functions relating to outputting a diff into a
      new file (diff_output.c).
      
      This includes a number of other changes - adding utility
      functions, extending iterators, etc. plus more tests for the
      diff code.  This also takes the example diff.c program much
      further in terms of emulating git-diff command line options.
      Russell Belfer committed
    • Add tests and fix bugs for diff whitespace options · caf71ec0
      Once I added tests for the whitespace handling options of
      diff, I realized that there were some bugs.  This fixes
      those and adds the new tests into the test suite.
      Russell Belfer committed
    • Clean up diff implementation for review · 3a437590
      This fixes several bugs, updates tests and docs, eliminates the
      FILE* assumption in favor of printing callbacks for the diff patch
      formatter helpers, and adds a "diff" example function that can
      perform a diff from the command line.
      Russell Belfer committed
    • Initial implementation of git_diff_blob · cd33323b
      This gets the basic plumbing in place for git_diff_blob.
      There is a known issue where additional parameters like
      the number of lines of context to display on the diff
      are not working correctly (which leads one of the new
      unit tests to fail).
      Russell Belfer committed
    • Simplify GIT_UNUSED macros · 2705576b
      Since casting to void works to eliminate errors with unused
      parameters on all platforms, avoid the various special cases.
      Over time, it will make sense to eliminate the GIT_UNUSED
      macro completely and just have GIT_UNUSED_ARG.
      Russell Belfer committed
    • Add test for possible attr bug · 7e3fc623
      This is a test that should replicate an issue that Peff
      is setting with git attributes.  But the test doesn't fail.
      Russell Belfer committed
  4. 27 Feb, 2012 1 commit
    • buffer: Unify `git_fbuffer` and `git_buf` · 13224ea4
      This makes so much sense that I can't believe it hasn't been done
      before. Kill the old `git_fbuffer` and read files straight into
      `git_buf` objects.
      
      Also: In order to fully support 4GB files in 32-bit systems, the
      `git_buf` implementation has been changed from using `ssize_t` for
      storage and storing negative values on allocation failure, to using
      `size_t` and changing the buffer pointer to a magical pointer on
      allocation failure.
      
      Hopefully this won't break anything.
      Vicent Martí committed
  5. 17 Feb, 2012 2 commits
  6. 01 Feb, 2012 1 commit
  7. 29 Jan, 2012 1 commit
  8. 17 Jan, 2012 2 commits
    • Move path related functions from fileops to path · 1744fafe
      This takes all of the functions that look up simple data about
      paths (such as `git_futils_isdir`) and moves them over to path.h
      (becoming `git_path_isdir`).  This leaves fileops.h just with
      functions that actually manipulate the filesystem or look at
      the file contents in some way.
      
      As part of this, the dir.h header which is really just for win32
      support was moved into win32 (with some minor changes).
      Russell Belfer committed
    • Fix handling of relative paths for attrs · a51cd8e6
      Per issue #533, the handling of relative paths in attribute
      and ignore files was not right.  Fixed this by pre-joining
      the relative path of the attribute/ignore file onto the match
      string when a full path match is required.
      
      Unfortunately, fixing this required a bit more code than I
      would have liked because I had to juggle things around so that
      the fnmatch parser would have sufficient information to prepend
      the relative path when it was needed.
      Russell Belfer committed
  9. 12 Jan, 2012 1 commit
  10. 11 Jan, 2012 2 commits
  11. 30 Dec, 2011 1 commit
    • Improved gitattributes macro implementation · bd370b14
      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.
      Russell Belfer committed
  12. 29 Dec, 2011 1 commit
    • Add support for macros and cache flush API. · 73b51450
      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.
      Russell Belfer committed
  13. 28 Dec, 2011 1 commit
  14. 21 Dec, 2011 1 commit
    • Add APIs for git attributes · ee1f0b1a
      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.
      Russell Belfer committed
  15. 14 Dec, 2011 1 commit
    • Allow git_buf_joinpath to accept self-joins · b5daae68
      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 committed
  16. 08 Dec, 2011 1 commit
    • Use git_buf for path storage instead of stack-based buffers · 97769280
      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.
      Russell Belfer committed
  17. 28 Nov, 2011 1 commit
  18. 26 Nov, 2011 3 commits
    • Rename all `_close` methods · 45e79e37
      There's no difference between `_free` and `_close` semantics: keep
      everything with the same name to avoid confusions.
      Vicent Marti committed
    • repository: Change ownership semantics · 9462c471
      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 Marti committed
  19. 22 Nov, 2011 1 commit
  20. 07 Nov, 2011 1 commit
  21. 06 Nov, 2011 4 commits
    • refs: Partial rewrite for read-only refs · d4a0b124
      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.
      Vicent Marti committed
    • Free all used references in the source tree · 75abd2b9
      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 committed
    • refs: add test case checking "immutable" references · 4fd89fa0
      Signed-off-by: schu <schu-github@schulog.org>
      schu committed
    • refs: split internal and external references · a46ec457
      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>
      schu committed
  22. 30 Oct, 2011 1 commit
    • test_helpers: do not rely on assert · ec907944
      The functions loose_object_mode and loose_object_dir_mode call stat
      inside an assert statement which isn't evaluated when compiling in
      Release mode (NDEBUG) and leads to failing tests. Replace it.
      
      Signed-off-by: schu <schu-github@schulog.org>
      schu committed
  23. 29 Oct, 2011 2 commits
  24. 14 Oct, 2011 1 commit