1. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  2. 13 Feb, 2017 1 commit
    • repository: use `git_repository_item_path` · c5f3da96
      The recent introduction of the commondir variable of a repository
      requires callers to distinguish whether their files are part of
      the dot-git directory or the common directory shared between
      multpile worktrees. In order to take the burden from callers and
      unify knowledge on which files reside where, the
      `git_repository_item_path` function has been introduced which
      encapsulate this knowledge.
      
      Modify most existing callers of `git_repository_path` to use
      `git_repository_item_path` instead, thus making them implicitly
      aware of the common directory.
      Patrick Steinhardt committed
  3. 29 Dec, 2016 1 commit
  4. 22 Mar, 2016 2 commits
    • blob: remove _fromchunks() · 6669e3e8
      The callback mechanism makes it awkward to write data from an IO
      source; move to `_fromstream()` which lets the caller remain in control,
      in the same vein as we prefer iterators over foreach callbacks.
      Carlos Martín Nieto committed
    • blob: introduce creating a blob by writing into a stream · 0a5c6028
      The pair of `git_blob_create_frombuffer()` and
      `git_blob_create_frombuffer_commit()` is meant to replace
      `git_blob_create_fromchunks()` by providing a way for a user to write a
      new blob when they want filtering or they do not know the size.
      
      This approach allows the caller to retain control over when to add data
      to this buffer and a more natural fit into higher-level language's own
      stream abstractions instead of having to handle IO wait in the callback.
      
      The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a
      round multiple of usual page sizes and a value where most blobs seem
      likely to be either going to be way below or way over that size. It's
      also a round number of pages.
      
      This implementation re-uses the helper we have from `_fromchunks()` so
      we end up writing everything to disk, but hopefully more efficiently
      than with a default filebuf. A later optimisation can be to avoid
      writing the in-memory contents to disk, with some extra complexity.
      Carlos Martín Nieto committed
  5. 12 Jul, 2015 1 commit
  6. 13 May, 2015 1 commit
    • odb: make the writestream's size a git_off_t · 77b339f7
      Restricting files to size_t is a silly limitation. The loose backend
      writes to a file directly, so there is no issue in using 63 bits for the
      size.
      
      We still assume that the header is going to fit in 64 bytes, which does
      mean quite a bit smaller files due to the run-length encoding, but it's
      still a much larger size than you would want Git to handle.
      Carlos Martín Nieto committed
  7. 11 May, 2015 1 commit
  8. 19 Feb, 2015 2 commits
  9. 16 May, 2014 1 commit
  10. 06 May, 2014 1 commit
    • Add filter options and ALLOW_UNSAFE · 5269008c
      Diff and status do not want core.safecrlf to actually raise an
      error regardless of the setting, so this extends the filter API
      with an additional options flags parameter and adds a flag so that
      filters can be applied with GIT_FILTER_OPT_ALLOW_UNSAFE, indicating
      that unsafe filter application should be downgraded from a failure
      to a warning.
      Russell Belfer committed
  11. 03 Apr, 2014 1 commit
  12. 30 Jan, 2014 1 commit
  13. 08 Jan, 2014 1 commit
  14. 11 Dec, 2013 1 commit
  15. 05 Nov, 2013 1 commit
  16. 17 Sep, 2013 5 commits
    • Merge git_buf and git_buffer · a9f51e43
      This makes the git_buf struct that was used internally into an
      externally available structure and eliminates the git_buffer.
      
      As part of that, some of the special cases that arose with the
      externally used git_buffer were blended into the git_buf, such as
      being careful about git_buf objects that may have a NULL ptr and
      allowing for bufs with a valid ptr and size but zero asize as a
      way of referring to externally owned data.
      Russell Belfer committed
    • Add ident filter · 4b11f25a
      This adds the ident filter (that knows how to replace $Id$) and
      tweaks the filter APIs and code so that git_filter_source objects
      actually have the updated OID of the object being filtered when
      it is a known value.
      Russell Belfer committed
    • Extend public filter api with filter lists · 2a7d224f
      This moves the git_filter_list into the public API so that users
      can create, apply, and dispose of filter lists.  This allows more
      granular application of filters to user data outside of libgit2
      internals.
      
      This also converts all the internal usage of filters to the public
      APIs along with a few small tweaks to make it easier to use the
      public git_buffer stuff alongside the internal git_buf.
      Russell Belfer committed
    • Create public filter object and use it · 85d54812
      This creates include/sys/filter.h with a basic definition of a
      git_filter and then converts the internal code to use it.  There
      are related internal objects (git_filter_list) that we will want
      to publish at some point, but this is a first step.
      Russell Belfer committed
    • Start of filter API + git_blob_filtered_content · 0cf77103
      This begins the process of exposing git_filter objects to the
      public API.  This includes:
      
      * new public type and API for `git_buffer` through which an
        allocated buffer can be passed to the user
      * new API `git_blob_filtered_content`
      * make the git_filter type and GIT_FILTER_TO_... constants public
      Russell Belfer committed
  17. 15 Aug, 2013 1 commit
  18. 26 Jul, 2013 1 commit
  19. 25 Jul, 2013 1 commit
    • Fix rename detection to use actual blob size · a16e4172
      The size data in the index may not reflect the actual size of the
      blob data from the ODB when content filtering comes into play.
      This commit fixes rename detection to use the actual blob size when
      calculating data signatures instead of the value from the index.
      
      Because of a misunderstanding on my part, I first converted the
      git_index_add_bypath API to use the post-filtered blob data size
      in creating the index entry.  I backed that change out, but I
      kept the overall refactoring of that routine and the new internal
      git_blob__create_from_paths API because it eliminates an extra
      stat() call from the code that adds a file to the index.
      
      The existing tests actually cover this code path, at least when
      running on Windows, so at this point I'm not adding new tests to
      cover the changes.
      Russell Belfer committed
  20. 10 Jun, 2013 1 commit
    • Reorganize diff and add basic diff driver · 114f5a6c
      This is a significant reorganization of the diff code to break it
      into a set of more clearly distinct files and to document the new
      organization.  Hopefully this will make the diff code easier to
      understand and to extend.
      
      This adds a new `git_diff_driver` object that looks of diff driver
      information from the attributes and the config so that things like
      function content in diff headers can be provided.  The full driver
      spec is not implemented in the commit - this is focused on the
      reorganization of the code and putting the driver hooks in place.
      
      This also removes a few #includes from src/repository.h that were
      overbroad, but as a result required extra #includes in a variety
      of places since including src/repository.h no longer results in
      pulling in the whole world.
      Russell Belfer committed
  21. 30 Apr, 2013 2 commits
  22. 29 Apr, 2013 1 commit
  23. 22 Apr, 2013 4 commits
  24. 21 Apr, 2013 1 commit
    • Move odb_backend implementors stuff into git2/sys · 83cc70d9
      This moves some of the odb_backend stuff that is related to the
      internals of an odb_backend implementation into include/git2/sys.
      
      Some of the stuff related to streaming I left in include/git2
      because it seemed like it would be reasonably needed by a normal
      user who wanted to stream objects into and out of the ODB.
      
      Also, I added APIs for traversing the list of backends so that
      some of the tests would not need to access ODB internals.
      Russell Belfer committed
  25. 25 Mar, 2013 2 commits
    • Move crlf conversion into buf_text · 3658e81e
      This adds crlf/lf conversion functions into buf_text with more
      efficient implementations that bypass the high level buffer
      functions.  They attempt to minimize the number of reallocations
      done and they directly write the buffer data as needed if they
      know that there is enough memory allocated to memcpy data.
      
      Tests are added for these new functions.  The crlf.c code is
      updated to use the new functions.
      
      Removed the include of buf_text.h from filter.h and just include
      it more narrowly in the places that need it.
      Russell Belfer committed
    • Add has_cr_in_index check to CRLF filter · 9733e80c
      This adds a check to the drop_crlf filter path to check it the
      file in the index already has a CR in it, in which case this will
      not drop the CRs from the workdir file contents.
      
      This uncovered a "bug" in `git_blob_create_fromworkdir` where the
      full path to the file was passed to look up the attributes instead
      of the relative path from the working directory root.  This meant
      that the check in the index for a pre-existing entry of the same
      name was failing.
      Russell Belfer committed
  26. 08 Jan, 2013 1 commit
  27. 07 Jan, 2013 1 commit
  28. 17 Dec, 2012 1 commit
  29. 27 Nov, 2012 1 commit