1. 10 Apr, 2023 1 commit
  2. 14 Jul, 2022 1 commit
  3. 20 Jun, 2022 1 commit
  4. 23 Feb, 2022 1 commit
  5. 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
  6. 16 Sep, 2020 1 commit
  7. 18 Apr, 2020 1 commit
  8. 04 Oct, 2018 2 commits
    • diff_stats: use git's formatting of renames with common directories · e5090ee3
      In cases where a file gets renamed such that the directories containing
      it previous and after the rename have a common prefix, then git will
      avoid printing this prefix twice and instead format the rename as
      "prefix/{old => new}". We currently didn't do anything like that, but
      simply printed "prefix/old -> prefix/new".
      
      Adjust our behaviour to instead match upstream. Adjust the test for this
      behaviour to expect the new format.
      Patrick Steinhardt committed
    • tests: verify diff stats with renames in subdirectory · 3148efd2
      Until now, we didn't have any tests that verified that our format for
      renames in subdirectories is correct. While our current behaviour is no
      different than for renames that do not happen with a common prefix
      shared between old and new file name, we intend to change the format to
      instead match the format that upstream git uses.
      
      Add a test case for this to document our current behaviour and to show
      how the next commit will change that format.
      Patrick Steinhardt committed
  9. 10 Jun, 2018 1 commit
  10. 05 Apr, 2018 1 commit
  11. 09 Oct, 2016 1 commit
  12. 26 May, 2016 1 commit
  13. 12 May, 2014 1 commit
  14. 22 Apr, 2014 1 commit
    • Use git_diff_get_stats in example/diff + refactor · 8d09efa2
      This takes the `--stat` and related example options in the example
      diff.c program and converts them to use the `git_diff_get_stats`
      API which nicely formats stats for you.
      
      I went to add bar-graph scaling to the stats formatter and noticed
      that the `git_diff_stats` structure was holding on to all of the
      `git_patch` objects.  Unfortunately, each of these objects keeps
      the full text of the diff in memory, so this is very expensive.  I
      ended up modifying `git_diff_stats` to keep just the data that it
      needs to keep and allowed it to release the patches.  Then, I added
      width scaling to the output on top of that.
      
      In making the diff example program match 'git diff' output, I ended
      up removing an newline from the sumamry output which I then had to
      compensate for in the email formatting to match the expectations.
      
      Lastly, I went through and refactored the tests to use a couple of
      helper functions and reduce the overall amount of code there.
      Russell Belfer committed
  15. 15 Apr, 2014 1 commit