1. 09 Jun, 2020 1 commit
    • tree-wide: do not compile deprecated functions with hard deprecation · c6184f0c
      When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor
      definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h"
      header to be empty. As a result, no function declarations are made
      available to callers, but the implementations are still available to
      link against. This has the problem that function declarations also
      aren't visible to the implementations, meaning that the symbol's
      visibility will not be set up correctly. As a result, the resulting
      library may not expose those deprecated symbols at all on some platforms
      and thus cause linking errors.
      
      Fix the issue by conditionally compiling deprecated functions, only.
      While it becomes impossible to link against such a library in case one
      uses deprecated functions, distributors of libgit2 aren't expected to
      pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually
      define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real"
      hard deprecation still makes sense in the context of CI to test we don't
      use deprecated symbols ourselves and in case a dependant uses libgit2 in
      a vendored way and knows it won't ever use any of the deprecated symbols
      anyway.
      Patrick Steinhardt committed
  2. 22 Nov, 2019 1 commit
  3. 11 Aug, 2019 4 commits
  4. 15 Jun, 2019 1 commit
  5. 25 Jan, 2019 1 commit
  6. 22 Jan, 2019 1 commit
  7. 01 Dec, 2018 1 commit
  8. 22 Jun, 2018 2 commits
    • blob: implement function to parse raw data · 9ac79ecc
      Currently, parsing objects is strictly tied to having an ODB object
      available. This makes it hard to parse an object when all that is
      available is its raw object and size. Furthermore, hacking around that
      limitation by directly creating an ODB structure either on stack or on
      heap does not really work that well due to ODB objects being reference
      counted and then automatically free'd when reaching a reference count of
      zero.
      
      In some occasions parsing raw objects without touching the ODB
      is actually recuired, though. One use case is for example object
      verification, where we want to assure that an object is valid before
      inserting it into the ODB or writing it into the git repository.
      
      Asa first step towards that, introduce a distinction between raw and ODB
      objects for blobs. Creation of ODB objects stays the same by simply
      using `git_blob__parse`, but a new function `git_blob__parse_raw` has
      been added that creates a blob from a pair of data and size. By setting
      a new flag inside of the blob, we can now distinguish whether it is a
      raw or ODB object now and treat it accordingly in several places.
      
      Note that the blob data passed in is not being copied. Because of that,
      callers need to make sure to keep it alive during the blob's life time.
      This is being used to avoid unnecessarily increasing the memory
      footprint when parsing largish blobs.
      Patrick Steinhardt committed
    • blob: use getters to get raw blob content and size · bbbe8441
      Going forward, we will have to change how blob sizes are calculated
      based on whether the blob is a cahed object part of the ODB or not. In
      order to not have to distinguish between those two object types
      repeatedly when accessing the blob's data or size, encapsulate all
      existing direct uses of those fields by instead using
      `git_blob_rawcontent` and `git_blob_rawsize`.
      Patrick Steinhardt committed
  9. 10 Jun, 2018 1 commit
  10. 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
  11. 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
  12. 29 Dec, 2016 1 commit
  13. 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
  14. 12 Jul, 2015 1 commit
  15. 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
  16. 11 May, 2015 1 commit
  17. 19 Feb, 2015 2 commits
  18. 16 May, 2014 1 commit
  19. 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
  20. 03 Apr, 2014 1 commit
  21. 30 Jan, 2014 1 commit
  22. 08 Jan, 2014 1 commit
  23. 11 Dec, 2013 1 commit
  24. 05 Nov, 2013 1 commit
  25. 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
  26. 15 Aug, 2013 1 commit
  27. 26 Jul, 2013 1 commit
  28. 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
  29. 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
  30. 30 Apr, 2013 1 commit