1. 22 Jan, 2019 1 commit
  2. 07 Jan, 2019 1 commit
  3. 04 Dec, 2018 1 commit
    • crlf: update to match git's logic · ef8f8ec6
      Examine the recent CRLF changes to git by Torsten Bögershausen and
      include similar changes to update our CRLF logic to match.
      
      Note: Torsten Bögershausen has previously agreed to allow his changes to
      be included in libgit2.
      Edward Thomson committed
  4. 17 Apr, 2018 2 commits
  5. 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
  6. 29 Dec, 2016 1 commit
  7. 24 Jul, 2016 1 commit
  8. 23 Feb, 2016 1 commit
    • crlf: do not ignore GIT_PASSTHROUGH error · 2129d6df
      When no payload is set for `crlf_apply` we try to compute the
      crlf attributes ourselves with `crlf_check`. When the function
      determines that the current file does not require any treatment
      we return the GIT_PASSTHROUGH error code without actually
      allocating the out-pointer, which indicates the file should not
      be passed through the filter.
      
      The `crlf_apply` function explicitly checks for the
      GIT_PASSTHROUGH return code and ignores it. This means we will
      try to apply the crlf-filter to the current file, leading us to
      dereference the unallocated payload-pointer.
      
      Fix this obviously incorrect behavior by not treating
      GIT_PASSTHROUGH in any special way. This is the correct thing to
      do anyway, as the code indicates that the file should not be
      passed through the filter.
      Patrick Steinhardt committed
  9. 22 Jun, 2015 2 commits
  10. 19 Feb, 2015 1 commit
  11. 30 Dec, 2014 1 commit
  12. 24 Jun, 2014 1 commit
  13. 19 May, 2014 2 commits
  14. 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
  15. 08 Apr, 2014 2 commits
  16. 12 Feb, 2014 1 commit
  17. 09 Feb, 2014 1 commit
  18. 25 Jan, 2014 1 commit
  19. 24 Sep, 2013 1 commit
  20. 17 Sep, 2013 11 commits
    • Bug fixes and cleanups · eefc32d5
      This contains a few bug fixes and some header and API cleanups.
      
      The main API change is that filters should now use GIT_PASSTHROUGH
      to indicate that they wish to skip processing a file instead of
      GIT_ENOTFOUND.
      
      The bug fixes include a possible out-of-range buffer access in
      the ident filter, a filter ordering problem I introduced into the
      custom filter tests on Windows, and a filter buf NUL termination
      issue that was coming up on Linux.
      Russell Belfer committed
    • Move binary check to CRLF filter itself · 0e32635f
      Checkout should not reject binary files from filters, as a filter
      may actually wish to operate on binary files.  The CRLF filter should
      reject binary files itself if it wishes to.  Moreover, the CRLF
      filter requires this logic so that users can emulate the checkout
      data in their odb -> workdir filtering.
      
      Conflicts:
      	src/checkout.c
      	src/crlf.c
      Russell Belfer committed
    • 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
    • Add functions to manipulate filter lists · 40cb40fa
      Extend the git2/sys/filter API with functions to look up a filter
      and add it manually to a filter list.  This requires some trickery
      because the regular attribute lookups and checks are bypassed when
      this happens, but in the right hands, it will allow a user to have
      granular control over applying filters.
      Russell Belfer committed
    • Update filter registry code · 0646634e
      This updates the git filter registry to be a little cleaner and
      plugs some memory leaks.
      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
    • Add attributes to filters and fix registry · 974774c7
      The filter registry as implemented was too primitive to actually
      work once multiple filters were coming into play.  This expands
      the implementation of the registry to handle multiple prioritized
      filters correctly.
      
      Additionally, this adds an "attributes" field to a filter that
      makes it really really easy to implement filters that are based
      on one or more attribute values.  The lookup and even simple value
      checking can all happen automatically without custom filter code.
      
      Lastly, with the registry improvements, this fills out the filter
      lifecycle callbacks, with initialize and shutdown callbacks that
      will be called before the filter is first used and after it is
      last invoked.  This allows for system-wide initialization and
      cleanup by the filter.
      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
  21. 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
  22. 25 Mar, 2013 3 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
  23. 08 Jan, 2013 1 commit
  24. 28 Nov, 2012 1 commit
    • Consolidate text buffer functions · 7bf87ab6
      There are many scattered functions that look into the contents of
      buffers to do various text manipulations (such as escaping or
      unescaping data, calculating text stats, guessing if content is
      binary, etc).  This groups all those functions together into a
      new file and converts the code to use that.
      
      This has two enhancements to existing functionality.  The old
      text stats function is significantly rewritten and the BOM
      detection code was extended (although largely we can't deal with
      anything other than a UTF8 BOM).
      Russell Belfer committed