1. 10 Jul, 2013 10 commits
    • Add BARE option to git_repository_open_ext · 3fe046cf
      This adds a BARE option to git_repository_open_ext which allows
      a fast open path that still knows how to read gitlinks and to
      search for the actual .git directory from a subdirectory.
      
      `git_repository_open_bare` is still simpler and faster, but having
      a gitlink aware fast open is very useful for submodules where we
      want to quickly be able to peek at the HEAD and index data without
      doing any other meaningful repo operations.
      Russell Belfer committed
    • Add timestamp check to submodule status · e807860f
      This is probably not the final form of this change, but this is
      a preliminary version of checking a timestamp to see if the cached
      working directory HEAD OID matches the current.  Right now, this
      uses the timestamp on the index and is, like most of our timestamp
      checking, subject to having only second accuracy.
      Russell Belfer committed
    • More diff submodule tests for cache issues · 4535f044
      The submodules code caches data about submodules in a way that
      can cause problems.  This adds some tests that try making various
      modifications to the state of a submodule to see where we can
      catch out problems in the submodule caching.
      
      Right now, I've put in an extra git_submodule_reload_all so that
      the test will pass, but with that commented out, the test fails.
      I'm working on fixing the broken version of the test at which
      point I'll commit the fix and delete the extra reload that makes
      the test pass.
      Russell Belfer committed
    • More improvements to submodule diff tests · 12f8fe00
      This controls for the diff.mnemonicprefix setting so that can't
      break the tests.  Also, this expands one test to emulate an
      ObjectiveGit test more closely.
      Russell Belfer committed
    • Add git_pathspec_match_diff API · 2b672d5b
      This adds an additional pathspec API that will match a pathspec
      against a diff object.  This is convenient if you want to handle
      renames (so you need the whole diff and can't use the pathspec
      constraint built into the diff API) but still want to tell if the
      diff had any files that matched the pathspec.
      
      When the pathspec is matched against a diff, instead of keeping
      a list of filenames that matched, instead the API keeps the list
      of git_diff_deltas that matched and they can be retrieved via a
      new API git_pathspec_match_list_diff_entry.
      
      There are a couple of other minor API extensions here that were
      mostly for the sake of convenience and to reduce dependencies
      on knowing the internal data structure between files inside the
      library.
      Russell Belfer committed
    • Basic bit vector · 6fc5a581
      This is a simple bit vector object that is not resizable after
      the initial allocation but can be of arbitrary size.  It will
      keep the bti vector entirely on the stack for vectors 64 bits
      or less, and will allocate the vector on the heap for larger
      sizes.  The API is uniform regardless of storage location.
      
      This is very basic right now and all the APIs are inline functions,
      but it is useful for storing an array of boolean values.
      Russell Belfer committed
    • Add public API for pathspec matching · d2ce27dd
      This adds a new public API for compiling pathspecs and matching
      them against the working directory, the index, or a tree from the
      repository.  This also reworks the pathspec internals to allow the
      sharing of code between the existing internal usage of pathspec
      matching and the new external API.
      
      While this is working and the new API is ready for discussion, I
      think there is still an incorrect behavior in which patterns are
      always matched against the full path of an entry without taking
      the subdirectories into account (so "s*" will match "subdir/file"
      even though it wouldn't with core Git).  Further enhancements are
      coming, but this was a good place to take a functional snapshot.
      Russell Belfer committed
  2. 09 Jul, 2013 2 commits
  3. 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
  4. 03 Jul, 2013 2 commits
  5. 29 Jun, 2013 2 commits
  6. 28 Jun, 2013 1 commit
  7. 27 Jun, 2013 1 commit
  8. 26 Jun, 2013 1 commit
  9. 25 Jun, 2013 2 commits
  10. 24 Jun, 2013 2 commits
  11. 21 Jun, 2013 4 commits
  12. 20 Jun, 2013 2 commits
    • Add test for fixed diff bug · 94ef2a35
      Add test for bug fixed in 852ded96
      Sorry, I wrote that bug fix and forgot to check in a test at the
      same time.  Here is one that fails on the old version of the code
      and now works.
      Russell Belfer committed
    • Add status flags to force output sort order · 22b6b82f
      Files in status will, be default, be sorted according to the case
      insensitivity of the filesystem that we're running on.  However,
      in some cases, this is not desirable.  Even on case insensitive
      file systems, 'git status' at the command line will generally use
      a case sensitive sort (like 'ls').  Some GUIs prefer to display a
      list of file case insensitively even on case-sensitive platforms.
      
      This adds two new flags: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY
      and GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY that will override the
      default sort order of the status output and give the user control.
      This includes tests for exercising these new options and makes
      the examples/status.c program emulate core Git and always use a
      case sensitive sort.
      Russell Belfer committed
  13. 19 Jun, 2013 2 commits
    • Add tests and fix use of freed memory · 7863523a
      This adds some tests for updating the index and having it remove
      items to make sure that the iteration over the index still works
      even as earlier items are removed.
      
      In testing with valgrind, this found a path that would use the
      path string from the index entry after it had been freed.  The
      bug fix is simply to copy the path of the index entry before
      doing any actual index manipulation.
      Russell Belfer committed
    • Add index pathspec-based operations · f30fff45
      This adds three new public APIs for manipulating the index:
      
      1. `git_index_add_all` is similar to `git add -A` and will add
         files in the working directory that match a pathspec to the
         index while honoring ignores, etc.
      2. `git_index_remove_all` removes files from the index that match
         a pathspec.
      3. `git_index_update_all` updates entries in the index based on
         the current contents of the working directory, either added
         the new information or removing the entry from the index.
      Russell Belfer committed
  14. 18 Jun, 2013 4 commits
    • Fix rename looped reference issues · e4acc3ba
      This makes the diff rename tracking code more careful about the
      order in which it processes renames and more thorough in updating
      the mapping of correct renames when an earlier rename update
      alters the index of a later matched pair.
      Russell Belfer committed
    • Add "as_path" parameters to blob and buffer diffs · 74ded024
      This adds parameters to the four functions that allow for blob-to-
      blob and blob-to-buffer differencing (either via callbacks or by
      making a git_diff_patch object).  These parameters let you say
      that filename we should pretend the blob has while doing the diff.
      If you pass NULL, there should be no change from the existing
      behavior, which is to skip using attributes for file type checks
      and just look at content.  With the parameters, you can plug into
      the new diff driver functionality and get binary or non-binary
      behavior, plus function context regular expressions, etc.
      
      This commit also fixes things so that the git_diff_delta that is
      generated by these functions will actually be populated with the
      data that we know about the blobs (or buffers) so you can use it
      appropriately.  It also fixes a bug in generating patches from
      the git_diff_patch objects created via these functions.
      
      Lastly, there is one other behavior change that may matter.  If
      there is no difference between the two blobs, these functions no
      longer generate any diff callbacks / patches unless you have
      passed in GIT_DIFF_INCLUDE_UNMODIFIED.  This is pretty natural,
      but could potentially change the behavior of existing usage.
      Russell Belfer committed
  15. 17 Jun, 2013 4 commits
    • Fix memory leaks in diff rename tests · de0555a3
      This fixes a couple objects I forgot to free, and also updates
      the valgrind suppressions file on the Mac to cover a few more
      cases that had crept in.
      Russell Belfer committed
    • Add test of rename with no changes · f3b5bc83
      A tree to index rename with no changes was getting erased by
      the iteration routine (if the routine actually loaded the data
      for the unmodified file).  This invokes the code path that was
      previously messing up the diff and iterates twice to make sure
      that the iteration process itself doesn't modify the data.
      Russell Belfer committed
    • More tests and bug fixes for status with rename · a1683f28
      This changes the behavior of the status RENAMED flags so that they
      will be combined with the MODIFIED flags if appropriate.  If a file
      is modified in the index and also renamed, then the status code
      will have both the GIT_STATUS_INDEX_MODIFIED and INDEX_RENAMED bits
      set.  If it is renamed but the OID has not changed, then just the
      GIT_STATUS_INDEX_RENAMED bit will be set.  Similarly, the flags
      GIT_STATUS_WT_MODIFIED and GIT_STATUS_WT_RENAMED can both be set
      independently of one another.
      
      This fixes a serious bug where the check for unmodified files that
      was done at data load time could end up erasing the RENAMED state
      of a file that was renamed with no changes.
      
      Lastly, this contains a bunch of new tests for status with renames,
      including tests where the only rename changes are case changes.
      The expected results of these tests have to vary by whether the
      platform uses a case sensitive filesystem or not, so the expected
      data covers those platform differences separately.
      Russell Belfer committed