1. 26 Jun, 2016 2 commits
  2. 15 Jun, 2015 1 commit
  3. 12 Jun, 2015 1 commit
    • diff: introduce binary diff callbacks · 8147b1af
      Introduce a new binary diff callback to provide the actual binary
      delta contents to callers.  Create this data from the diff contents
      (instead of directly from the ODB) to support binary diffs including
      the workdir, not just things coming out of the ODB.
      Edward Thomson committed
  4. 28 May, 2015 1 commit
  5. 23 Nov, 2014 1 commit
  6. 02 May, 2014 2 commits
  7. 17 Apr, 2014 1 commit
  8. 14 Nov, 2013 1 commit
  9. 01 Nov, 2013 1 commit
    • Make diff and status perform soft index reload · 4bf630b6
      This changes `git_index_read` to have two modes - a hard index
      reload that always resets the index to match the on-disk data
      (which was the old behavior) and a soft index reload that uses
      the timestamp / file size information and only replaces the index
      data if the file on disk has been modified.
      
      This then updates the git_status code to do a soft reload unless
      the new GIT_STATUS_OPT_NO_REFRESH flag is passed in.
      
      This also changes the behavior of the git_diff functions that use
      the index so that when an index is not explicitly passed in (i.e.
      when the functions call git_repository_index for you), they will
      also do a soft reload for you.
      
      This intentionally breaks the file signature of git_index_read
      because there has been some confusion about the behavior previously
      and it seems like all existing uses of the API should probably be
      examined to select the desired behavior.
      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. 04 Oct, 2013 1 commit
    • Add git_repository_reset_filesystem and fix tests · 5173ea92
      When a repository is transferred from one file system to another,
      many of the config settings that represent the properties of the
      file system may be wrong.  This adds a new public API that will
      refresh the config settings of the repository to account for the
      change of file system.  This doesn't do a full "reinitialize" and
      operates on a existing git_repository object refreshing the config
      when done.
      
      This commit then makes use of the new API in clar as each test
      repository is set up.
      
      This commit also has a number of other clar test fixes where we
      were making assumptions about the type of filesystem, either based
      on outdated config data or based on the OS instead of the FS.
      Russell Belfer committed
  14. 05 Jul, 2013 1 commit
    • Diff hunk context off by one on long lines · a5f9b5f8
      The diff hunk context string that is returned to xdiff need not
      be NUL terminated because the xdiff code just copies the number of
      bytes that you report directly into the output.  There was an off
      by one in the diff driver code when the header context was longer
      than the output buffer size, the output buffer length included
      the NUL byte which was copied into the hunk header.
      
      Fixes #1710
      Russell Belfer committed
  15. 23 May, 2013 1 commit
    • More diff rename tests; better split swap handling · 67db583d
      This adds a couple more tests of different rename scenarios.
      
      Also, this fixes a problem with the case where you have two
      "split" deltas and the left half of one matches the right half of
      the other.  That case was already being handled, but in the wrong
      order in a way that could result in bad output.  Also, if the swap
      also happened to put the other two halves into the correct place
      (i.e. two files exchanged places with each other), then the second
      delta was left with the SPLIT flag set when it really should be
      cleared.
      Russell Belfer committed
  16. 07 May, 2013 1 commit
    • Add GIT_DIFF_LINE_CONTEXT_EOFNL · e35e2684
      This adds a new line origin constant for the special line that
      is used when both files end without a newline.
      
      In the course of writing the tests for this, I was having problems
      with modifying a file but not having diff notice because it was
      the same size and modified less than one second from the start of
      the test, so I decided to start working on nanosecond timestamp
      support.  This commit doesn't contain the nanosecond support, but
      it contains the reorganization of maybe_modified and the hooks so
      that if the nanosecond data were being read by stat() (or rather
      being copied by git_index_entry__init_from_stat), then the nsec
      would be taken into account.
      
      This new stuff could probably use some more tests, although there
      is some amount of it here.
      Russell Belfer committed
  17. 30 Apr, 2013 1 commit
  18. 26 Mar, 2013 1 commit
    • Fix some diff ignores and submodule dirty workdir · ccfa6805
      This started out trying to look at the problems from issue #1425
      and gradually grew to a broader set of fixes.  There are two core
      things fixed here:
      
      1. When you had an ignore like "/bin" which is rooted at the top
         of your tree, instead of immediately adding the "bin/" entry
         as an ignored item in the diff, we were returning all of the
         direct descendants of the directory as ignored items.  This
         changes things to immediately ignore the directory.  Note that
         this effects the behavior in test_status_ignore__subdirectories
         so that we no longer exactly match core gits ignore behavior,
         but the new behavior probably makes more sense (i.e. we now
         will include an ignored directory inside an untracked directory
         that we previously would have left off).
      2. When a submodule only contained working directory changes, the
         diff code was always considering it unmodified which was just
         an outright bug. The HEAD SHA of the submodule matches the SHA
         in the parent repo index, and since the SHAs matches, the diff
         code was overwriting the actual status with UNMODIFIED.
      
      These fixes broke existing tests test_diff_workdir__submodules and
      test_status_ignore__subdirectories but looking it over, I actually
      think the new results are correct and the old results were wrong.
      @nulltoken had actually commented on the subdirectory ignore issue
      previously.
      
      I also included in the tests some debugging versions of the
      shared iteration callback routines that print status or diff
      information.  These aren't used actively in the tests, but can be
      quickly swapped in to test code to give a better picture of what
      is being scanned in some of the complex test scenarios.
      Russell Belfer committed
  19. 20 Feb, 2013 1 commit
    • Replace diff delta binary with flags · 71a3d27e
      Previously the git_diff_delta recorded if the delta was binary.
      This replaces that (with no net change in structure size) with
      a full set of flags.  The flag values that were already in use
      for individual git_diff_file objects are reused for the delta
      flags, too (along with renaming those flags to make it clear that
      they are used more generally).
      
      This (a) makes things somewhat more consistent (because I was
      using a -1 value in the "boolean" binary field to indicate unset,
      whereas now I can just use the flags that are easier to understand),
      and (b) will make it easier for me to add some additional flags to
      the delta object in the future, such as marking the results of a
      copy/rename detection or other deltas that might want a special
      indicator.
      
      While making this change, I officially moved some of the flags that
      were internal only into the private diff header.
      
      This also allowed me to remove a gross hack in rename/copy detect
      code where I was overwriting the status field with an internal
      value.
      Russell Belfer committed
  20. 27 Nov, 2012 2 commits
  21. 23 Oct, 2012 1 commit
    • Initial implementation of diff rename detection · b4f5bb07
      This implements the basis for diff rename and copy detection,
      although it is based on simple SHA comparison right now instead
      of using a matching algortihm.  Just as `git_diff_merge` can be
      used as a post-pass on diffs to emulate certain command line
      behaviors, there is a new API `git_diff_detect` which will
      update a diff list in-place, adjusting some deltas to RENAMED
      or COPIED state (and also, eventually, splitting MODIFIED deltas
      where the change is too large into DELETED/ADDED pairs).
      
      This also adds a new test repo that will hold rename/copy/split
      scenarios.  Right now, it just has exact-match rename and copy,
      but the tests are written to use tree diffs, so we should be able
      to add new test scenarios easily without breaking tests.
      Russell Belfer committed
  22. 08 Oct, 2012 1 commit
  23. 25 Sep, 2012 3 commits
    • Add const to all shared pointers in diff API · bae957b9
      There are a lot of places where the diff API gives the user access
      to internal data structures and many of these were being exposed
      through non-const pointers.  This replaces them all with const
      pointers for any object that the user can access but is still
      owned internally to the git_diff_list or git_diff_patch objects.
      
      This will probably break some bindings...  Sorry!
      Russell Belfer committed
    • Fix bugs in new diff patch code · 64286308
      This fixes all the bugs in the new diff patch code.  The only
      really interesting one is that when we merge two diffs, we now
      have to actually exclude diff delta records that are not supposed
      to be tracked, as opposed to before where they could be included
      because they would be skipped silently by `git_diff_foreach()`.
      Other than that, there are just minor errors.
      Russell Belfer committed
    • Initial implementation of new diff patch API · 5f69a31f
      Replacing the `git_iterator` object, this creates a simple API
      for accessing the "patch" for any file pair in a diff list and
      then gives indexed access to the hunks in the patch and the lines
      in the hunk.  This is the initial implementation of this revised
      API - it is still broken, but at least builds cleanly.
      Russell Belfer committed
  24. 11 Sep, 2012 1 commit
    • Fix diff binary file detection · 1f35e89d
      In the process of adding tests for the max file size threshold
      (which treats files over a certain size as binary) there seem to
      be a number of problems in the new code with detecting binaries.
      This should fix those up, as well as add a test for the file
      size threshold stuff.
      
      Also, this un-deprecates `GIT_DIFF_LINE_ADD_EOFNL`, since I
      finally found a legitimate situation where it would be returned.
      Russell Belfer committed
  25. 10 Sep, 2012 1 commit
    • Replace git_diff_iterator_num_files with progress · b36effa2
      The `git_diff_iterator_num_files` API was problematic, since we
      don't actually know the exact number of files to be iterated over
      until we load those files into memory.  This replaces it with a
      new `git_diff_iterator_progress` API that goes from 0 to 1, and
      moves and renamed the old API for the internal places that can
      tolerate a max value instead of an exact value.
      Russell Belfer committed
  26. 05 Sep, 2012 1 commit
    • Diff iterators · f335ecd6
      This refactors the diff output code so that an iterator object
      can be used to traverse and generate the diffs, instead of just
      the `foreach()` style with callbacks.  The code has been rearranged
      so that the two styles can still share most functions.
      
      This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses
      that as a common error code for marking the end of iteration when
      using a iterator style of object.
      Russell Belfer committed
  27. 22 Aug, 2012 1 commit
    • Minor bug fixes in diff code · 5fdc41e7
      In looking at PR #878, I found a few small bugs in the diff code,
      mostly related to work that can be avoided when processing tree-
      to-tree diffs that was always being carried out.  This commit has
      some small fixes in it.
      Russell Belfer committed
  28. 24 Jul, 2012 1 commit
  29. 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
  30. 07 May, 2012 2 commits
  31. 30 Apr, 2012 2 commits
  32. 17 Apr, 2012 1 commit
  33. 06 Mar, 2012 1 commit