1. 28 Dec, 2012 1 commit
    • Make spoolandsort a pushable iterator behavior · f616a36b
      An earlier change to `git_diff_from_iterators` introduced a
      memory leak where the allocated spoolandsort iterator was not
      returned to the caller and thus not freed.
      
      One proposal changes all iterator APIs to use git_iterator** so
      we can reallocate the iterator at will, but that seems unexpected.
      This commit makes it so that an iterator can be changed in place.
      The callbacks are isolated in a separate structure and a pointer
      to that structure can be reassigned by the spoolandsort extension.
      
      This means that spoolandsort doesn't create a new iterator; it
      just allocates a new block of callbacks (along with space for its
      own extra data) and swaps that into the iterator.
      
      Additionally, since spoolandsort is only needed to switch the
      case sensitivity of an iterator, this simplifies the API to only
      take the ignore_case boolean and to be a no-op if the iterator
      already matches the requested case sensitivity.
      Russell Belfer committed
  2. 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
  3. 10 Dec, 2012 1 commit
    • Clean up iterator APIs · 9950d27a
      This removes the need to explicitly pass the repo into iterators
      where the repo is implied by the other parameters.  This moves
      the repo to be owned by the parent struct.  Also, this has some
      iterator related updates to the internal diff API to lay the
      groundwork for checkout improvements.
      Russell Belfer committed
  4. 05 Dec, 2012 1 commit
  5. 01 Dec, 2012 1 commit
  6. 30 Nov, 2012 1 commit
  7. 27 Nov, 2012 1 commit
  8. 15 Nov, 2012 5 commits
  9. 09 Nov, 2012 4 commits
    • Fix various cross-platform build issues · 0f3def71
      This fixes a number of warnings and problems with cross-platform
      builds.  Among other things, it's not safe to name a member of a
      structure "strcmp" because that may be #defined.
      Russell Belfer committed
    • Some diff refactorings to help code reuse · 55cbd05b
      There are some diff functions that are useful in a rewritten
      checkout and this lays some groundwork for that.  This contains
      three main things:
      
      1. Share the function diff uses to calculate the OID for a file
         in the working directory (now named `git_diff__oid_for_file`
      2. Add a `git_diff__paired_foreach` function to iterator over
         two diff lists concurrently.  Convert status to use it.
      3. Move all the string/prefix/index entry comparisons into
         function pointers inside the `git_diff_list` object so they
         can be switched between case sensitive and insensitive
         versions.  This makes them easier to reuse in various
         functions without replicating logic.  As part of this, move
         a couple of index functions out of diff.c and into index.c.
      Russell Belfer committed
    • Move pathspec code in separate files · 2e3d4b96
      Diff uses a `git_strarray` of path specs to represent a subset
      of all files to be processed.  It is useful to be able to reuse
      this filtering in other places outside diff, so I've moved it
      into a standalone set of utilities.
      Russell Belfer committed
  10. 30 Oct, 2012 1 commit
    • Move rename detection into new file · db106d01
      This improves the naming for the rename related functionality
      moving it to be called `git_diff_find_similar()` and renaming
      all the associated constants, etc. to make more sense.
      
      I also moved the new code (plus the existing `git_diff_merge`)
      into a new file `diff_tform.c` where I can put new functions
      related to manipulating git diff lists.
      
      This also updates the implementation significantly from the
      last revision fixing some ordering issues (where break-rewrite
      needs to be handled prior to copy and rename detection) and
      improving config option handling.
      Russell Belfer committed
  11. 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
  12. 18 Oct, 2012 1 commit
  13. 09 Oct, 2012 2 commits
    • Add complex checkout test and then fix checkout · 0d64bef9
      This started as a complex new test for checkout going through the
      "typechanges" test repository, but that revealed numerous issues
      with checkout, including:
      
      * complete failure with submodules
      * failure to create blobs with exec bits
      * problems when replacing a tree with a blob because the tree
        "example/" sorts after the blob "example" so the delete was
        being processed after the single file blob was created
      
      This fixes most of those problems and includes a number of other
      minor changes that made it easier to do that, including improving
      the TYPECHANGE support in diff/status, etc.
      Russell Belfer committed
    • Introduce status/diff TYPECHANGE flags · bc16fd3e
      When I wrote the diff code, I based it on core git's diff output
      which tends to split a type change into an add and a delete.  But
      core git's status has the notion of a T (typechange) flag for a
      file.  This introduces that into our status APIs and modifies the
      diff code so it can be forced to not split type changes.
      Russell Belfer committed
  14. 08 Oct, 2012 2 commits
    • Add test for diffs with submodules and bug fixes · 5d1308f2
      The adds a test for the submodule diff capabilities and then
      fixes a few bugs with how the output is generated.  It improves
      the accuracy of OIDs in the diff delta object and makes the
      submodule output more closely mirror the OIDs that will be used
      by core git.
      Russell Belfer committed
    • Fix a few diff bugs with directory content · dfbff793
      There are a few cases where diff should leave directories in
      the diff list if we want to match core git, such as when the
      directory contains a .git dir.  That feature was lost when I
      introduced some of the new submodule handling.
      
      This restores that and then fixes a couple of related to diff
      output that are triggered by having diffs with directories in
      them.
      
      Also, this adds a new flag that can be passed to diff if you
      want diff output to actually include the file content of any
      untracked files.
      Russell Belfer committed
  15. 05 Oct, 2012 2 commits
    • Diff: Do not try to calculate an oid for a GITLINK. · 1dca8510
      We don't have anything useful that we could do with that oid anyway (We
      need to query the submodule for the HEAD commit instead).
      
      Without this, the following code creates the error "Failed to read
      descriptor: Is a directory" when run against the submod2 test-case:
      
          const char* oidstr = "873585b94bdeabccea991ea5e3ec1a277895b698";
          git_tree* tree = resolve_commit_oid_to_tree(g_repo, oidstr);
          git_diff_list* diff = NULL;
          cl_assert(tree);
          cl_git_pass(git_diff_workdir_to_tree(g_repo, NULL, tree, &diff));
      Sascha Cunz committed
    • Diff: teach get_workdir_content to show a submodule as text · 7e57d250
      1. teach diff.c:maybe_modified to query git_submodule_status for the
         modification state of a submodule. According to the
         git_submodule_status docs, it will filter for to-ignore states
         already.
      
      2. teach diff_output.c:get_workdir_content to check the submodule status
         again and create a line like:
      
            Subproject commit <SHA-1>\n
         or
            Subproject comimt <SHA-1>-dirty\n
      
         like git.git does.
      Sascha Cunz committed
  16. 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
  17. 17 Sep, 2012 2 commits
  18. 06 Sep, 2012 1 commit
    • Implement filters for status/diff blobs · 60b9d3fc
      This adds support to diff and status for running filters (a la crlf)
      on blobs in the workdir before computing SHAs and before generating
      text diffs.  This ended up being a bit more code change than I had
      thought since I had to reorganize some of the diff logic to minimize
      peak memory use when filtering blobs in a diff.
      
      This also adds a cap on the maximum size of data that will be loaded
      to diff.  I set it at 512Mb which should match core git.  Right now
      it is a #define in src/diff.h but it could be moved into the public
      API if desired.
      Russell Belfer committed
  19. 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
  20. 24 Aug, 2012 1 commit
  21. 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
  22. 09 Aug, 2012 1 commit
  23. 24 Jul, 2012 2 commits
  24. 19 Jul, 2012 1 commit
  25. 20 Jun, 2012 1 commit
  26. 19 Jun, 2012 1 commit
    • Make index add/append support core.filemode flag · da825c92
      This fixes git_index_add and git_index_append to behave more like
      core git, preserving old filemode data in the index when adding
      and/or appending with core.filemode = false.
      
      This also has placeholder support for core.symlinks and
      core.ignorecase, but those flags are not implemented (well,
      symlinks has partial support for preserving mode information in
      the same way that git does, but it isn't tested).
      Russell Belfer committed