1. 22 Apr, 2014 2 commits
    • 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
    • Some doc and examples/diff.c changes · 12e422a0
      I was playing with "git diff-index" and wanted to be able to
      emulate that behavior a little more closely with the diff example.
      
      Also, I wanted to play with running `git_diff_tree_to_workdir`
      directly even though core Git doesn't exactly have the equivalent,
      so I added a command line option for that and tweaked some other
      things in the example code.
      
      This changes a minor output thing in that the "raw" print helper
      function will no longer add ellipses (...) if the OID is not
      actually abbreviated.
      Russell Belfer committed
  2. 05 Mar, 2014 3 commits
  3. 27 Feb, 2014 1 commit
  4. 09 Feb, 2014 1 commit
  5. 08 Feb, 2014 1 commit
  6. 02 Nov, 2013 1 commit
  7. 01 Nov, 2013 1 commit
  8. 31 Oct, 2013 1 commit
  9. 30 Oct, 2013 1 commit
    • Extract common example helpers and reorg examples · 66902d47
      This reorganizes a few of the examples so that the main function
      comes first with the argument parsing extracted into a helper
      that can come at the end of the file (so the example focuses more
      on the use of libgit2 instead of command line support).  This also
      creates a shared examples/common.[ch] so that useful helper funcs
      can be shared across examples instead of repeated.
      Russell Belfer committed
  10. 21 Oct, 2013 1 commit
    • Create git_diff_line and extend git_diff_hunk · 3b5f7954
      Instead of having functions with so very many parameters to pass
      hunk and line data, this takes the existing git_diff_hunk struct
      and extends it with more hunk data, plus adds a git_diff_line.
      Those structs are used to pass back hunk and line data instead of
      the old APIs that took tons of parameters.
      
      Some work that was previously only being done for git_diff_patch
      creation (scanning the diff content for exact line counts) is now
      done for all callbacks, but the performance difference should not
      be noticable.
      Russell Belfer committed
  11. 15 Oct, 2013 1 commit
    • Diff API cleanup · 10672e3e
      This lays groundwork for separating formatting options from diff
      creation options.  This groups the formatting flags separately
      from the diff list creation flags and reorders the options.  This
      also tweaks some APIs to further separate code that uses patches
      from code that just looks at git_diffs.
      Russell Belfer committed
  12. 11 Oct, 2013 1 commit
  13. 18 May, 2013 1 commit
  14. 16 May, 2013 1 commit
  15. 15 Apr, 2013 2 commits
  16. 09 Apr, 2013 1 commit
  17. 02 Mar, 2013 1 commit
  18. 23 Jan, 2013 1 commit
  19. 17 Dec, 2012 1 commit
    • Fix diff constructor name order confusion · 56c72b75
      The diff constructor functions had some confusing names, where the
      "old" side of the diff was coming after the "new" side.  This
      reverses the order in the function name to make it less confusing.
      
      Specifically...
      
      * git_diff_index_to_tree becomes git_diff_tree_to_index
      * git_diff_workdir_to_index becomes git_diff_index_to_workdir
      * git_diff_workdir_to_tree becomes git_diff_tree_to_workdir
      Russell Belfer committed
  20. 30 Nov, 2012 1 commit
  21. 27 Nov, 2012 2 commits
  22. 15 Nov, 2012 1 commit
    • Add explicit git_index ptr to diff and checkout · bbe6dbec
      A number of diff APIs and the `git_checkout_index` API take a
      `git_repository` object an operate on the index.  This updates
      them to take a `git_index` pointer explicitly and only fall back
      on the `git_repository` index if the index input is NULL.  This
      makes it easier to operate on a temporary index.
      Russell Belfer committed
  23. 01 Nov, 2012 1 commit
  24. 08 Jun, 2012 1 commit
    • Minor fixes, cleanups, and clarifications · 145e696b
      There are three actual changes in this commit:
      
      1. When the trailing newline of a file is removed in a diff, the
         change will now be reported with `GIT_DIFF_LINE_DEL_EOFNL` passed
         to the callback.  Previously, the `ADD_EOFNL` constant was given
         which was just an error in my understanding of when the various
         circumstances arose.  `GIT_DIFF_LINE_ADD_EOFNL` is deprecated and
         should never be generated.  A new newline is simply an `ADD`.
      2. Rewrote the `diff_delta__merge_like_cgit` function that contains
         the core logic of the `git_diff_merge` implementation.  The new
         version doesn't actually have significantly different behavior,
         but the logic should be much more obvious, I think.
      3. Fixed a bug in `git_diff_merge` where it freed a string pool
         while some of the string data was still in use.  This led to
         `git_diff_print_patch` accessing memory that had been freed.
      
      The rest of this commit contains improved documentation in `diff.h`
      to make the behavior and the equivalencies with core git clearer,
      and a bunch of new tests to cover the various cases, oh and a minor
      simplification of `examples/diff.c`.
      Russell Belfer committed
  25. 17 May, 2012 3 commits
  26. 13 Mar, 2012 1 commit
  27. 02 Mar, 2012 3 commits
    • Update diff to use iterators · 74fa4bfa
      This is a major reorganization of the diff code.  This changes
      the diff functions to use the iterators for traversing the
      content.  This allowed a lot of code to be simplified.  Also,
      this moved the functions relating to outputting a diff into a
      new file (diff_output.c).
      
      This includes a number of other changes - adding utility
      functions, extending iterators, etc. plus more tests for the
      diff code.  This also takes the example diff.c program much
      further in terms of emulating git-diff command line options.
      Russell Belfer committed
    • Continue implementation of git-diff · a2e895be
      * Implemented git_diff_index_to_tree
      * Reworked git_diff_options structure to handle more options
      * Made most of the options in git_diff_options actually work
      * Reorganized code a bit to remove some redundancy
      * Added option parsing to examples/diff.c to test most options
      Russell Belfer committed
    • Clean up diff implementation for review · 3a437590
      This fixes several bugs, updates tests and docs, eliminates the
      FILE* assumption in favor of printing callbacks for the diff patch
      formatter helpers, and adds a "diff" example function that can
      perform a diff from the command line.
      Russell Belfer committed