1. 20 Jun, 2022 1 commit
  2. 23 Feb, 2022 1 commit
  3. 12 Feb, 2022 1 commit
    • diff: indicate when the file size is "valid" · 359240b6
      When we know the file size (because we're producing it from a working
      directory iterator, or an index with an up-to-date cache) then set a
      flag indicating as such.  This removes the ambiguity about a 0 file
      size, which could indicate that a file exists and is 0 bytes, or that we
      haven't read it yet.
      Edward Thomson committed
  4. 01 Jan, 2022 1 commit
  5. 09 Nov, 2021 1 commit
  6. 17 Oct, 2021 1 commit
    • str: introduce `git_str` for internal, `git_buf` is external · f0e693b1
      libgit2 has two distinct requirements that were previously solved by
      `git_buf`.  We require:
      
      1. A general purpose string class that provides a number of utility APIs
         for manipulating data (eg, concatenating, truncating, etc).
      2. A structure that we can use to return strings to callers that they
         can take ownership of.
      
      By using a single class (`git_buf`) for both of these purposes, we have
      confused the API to the point that refactorings are difficult and
      reasoning about correctness is also difficult.
      
      Move the utility class `git_buf` to be called `git_str`: this represents
      its general purpose, as an internal string buffer class.  The name also
      is an homage to Junio Hamano ("gitstr").
      
      The public API remains `git_buf`, and has a much smaller footprint.  It
      is generally only used as an "out" param with strict requirements that
      follow the documentation.  (Exceptions exist for some legacy APIs to
      avoid breaking callers unnecessarily.)
      
      Utility functions exist to convert a user-specified `git_buf` to a
      `git_str` so that we can call internal functions, then converting it
      back again.
      Edward Thomson committed
  7. 13 Oct, 2021 1 commit
  8. 13 May, 2021 1 commit
  9. 28 Apr, 2021 1 commit
  10. 27 Nov, 2020 1 commit
  11. 01 Jun, 2020 1 commit
  12. 18 Jan, 2020 1 commit
  13. 22 Nov, 2019 1 commit
  14. 20 Jul, 2019 1 commit
  15. 15 Jun, 2019 1 commit
  16. 22 Jan, 2019 1 commit
  17. 04 Jan, 2019 1 commit
  18. 01 Dec, 2018 1 commit
  19. 09 Aug, 2018 1 commit
    • diff: fix OOM on AIX when finding similar deltas in empty diff · c65568d8
      The function `git_diff_find_similar` keeps a function of cache
      similarity metrics signatures, whose size depends on the number of
      deltas passed in via the `diff` parameter. In case where the diff is
      empty and thus doesn't have any deltas at all, we may end up allocating
      this cache via a call to `git__calloc(0, sizeof(void *))`. At least on
      AIX, allocating 0 bytes will result in a `NULL` pointer being returned,
      which causes us to erroneously return an OOM error.
      
      Fix this situation by simply returning early in case where we are being
      passed an empty diff, as we cannot find any similarities in that case
      anyway.
      Patrick Steinhardt committed
  20. 10 Jun, 2018 1 commit
  21. 20 Feb, 2018 1 commit
    • diff_tform: fix rename detection with rewrite/delete pair · ce7080a0
      A rewritten file can either be classified as a modification of its
      contents or of a delete of the complete file followed by an addition of
      the new content. This distinction becomes important when we want to
      detect renames for rewrites. Given a scenario where a file "a" has been
      deleted and another file "b" has been renamed to "a", this should be
      detected as a deletion of "a" followed by a rename of "a" -> "b". Thus,
      splitting of the original rewrite into a delete/add pair is important
      here.
      
      This splitting is represented by a flag we can set at the current delta.
      While the flag is already being set in case we want to break rewrites,
      we do not do so in case where the `GIT_DIFF_FIND_RENAMES_FROM_REWRITES`
      flag is set. This can trigger an assert when we try to match the source
      and target deltas.
      
      Fix the issue by setting the `GIT_DIFF_FLAG__TO_SPLIT` flag at the delta
      when it is a rename target and `GIT_DIFF_FIND_RENAMES_FROM_REWRITES` is
      set.
      Patrick Steinhardt committed
  22. 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
  23. 09 Feb, 2017 1 commit
  24. 29 Dec, 2016 1 commit
  25. 26 May, 2016 1 commit
  26. 11 Mar, 2016 1 commit
    • diff_tform: fix potential NULL pointer access · 1a8c11f4
      When the user passes in a diff which has no repository associated
      we may call `git_config__get_int_force` with a NULL-pointer
      configuration. Even though `git_config__get_int_force` is
      designed to swallow errors, it is not intended to be called with
      a NULL pointer configuration.
      
      Fix the issue by only calling `git_config__get_int_force` only
      when configuration could be retrieved from the repository.
      Patrick Steinhardt committed
  27. 23 Feb, 2016 1 commit
    • diff_tform: fix potential NULL pointer access · 32f07984
      The `normalize_find_opts` function in theory allows for the
      incoming diff to have no repository. When the caller does not
      pass in diff find options or if the GIT_DIFF_FIND_BY_CONFIG value
      is set, though, we try to derive the configuration from the
      diff's repository configuration without first verifying that the
      repository is actually set to a non-NULL value.
      
      Fix this issue by explicitly checking if the repository is set
      and if it is not, fall back to a default value of
      GIT_DIFF_FIND_RENAMES.
      Patrick Steinhardt committed
  28. 28 Oct, 2015 1 commit
  29. 23 Jun, 2015 4 commits
  30. 10 Jun, 2015 1 commit
  31. 30 Mar, 2015 1 commit
  32. 03 Mar, 2015 1 commit
  33. 13 Feb, 2015 2 commits
  34. 14 Jan, 2015 1 commit
  35. 27 Oct, 2014 1 commit
  36. 01 Oct, 2014 1 commit