1. 14 Nov, 2018 1 commit
  2. 29 Jun, 2018 3 commits
    • settings: optional unsaved index safety · bfa1f022
      Add the `GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY` option, which will cause
      commands that reload the on-disk index to fail if the current
      `git_index` has changed that have not been saved.  This will prevent
      users from - for example - adding a file to the index then calling a
      function like `git_checkout` and having that file be silently removed
      from the index since it was re-read from disk.
      
      Now calls that would re-read the index will fail if the index is
      "dirty", meaning changes have been made to it but have not been written.
      Users can either `git_index_read` to discard those changes explicitly,
      or `git_index_write` to write them.
      Edward Thomson committed
    • index: commit the changes to the index properly · b242cdbf
      Now that the index has a "dirty" state, where it has changes that have
      not yet been committed or rolled back, our tests need to be adapted to
      actually commit or rollback the changes instead of assuming that the
      index can be operated on in its indeterminate state.
      Edward Thomson committed
    • index: add a dirty bit reflecting unsaved changes · 7c56c49b
      Teach the index when it is "dirty", and has unsaved changes.  Consider
      the index dirty whenever a caller has added or removed an entry from the
      main index, REUC or NAME section, including when the index is completely
      cleared.  Similarly, consider the index _not_ dirty immediately after it
      is written, or when it is read from the on-disk index.
      
      This allows us to ensure that unsaved changes are not lost when we
      automatically refresh the index.
      Edward Thomson committed
  3. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  4. 10 Aug, 2016 1 commit
    • index: support index v4 · 5625d86b
      Support reading and writing index v4.  Index v4 uses a very simple
      compression scheme for pathnames, but is otherwise similar to index v3.
      
      Signed-off-by: David Turner <dturner@twitter.com>
      David Turner committed
  5. 25 Jan, 2016 1 commit
  6. 28 Dec, 2015 1 commit
  7. 16 Dec, 2015 1 commit
    • merge: Use `git_index__fill` to populate the index · 879ebab3
      Instead of calling `git_index_add` in a loop, use the new
      `git_index_fill` internal API to fill the index with the initial staged
      entries.
      
      The new `fill` helper assumes that all the entries will be unique and
      valid, so it can append them at the end of the entries vector and only
      sort it once at the end. It performs no validation checks.
      
      This prevents the quadratic behavior caused by having to sort the
      entries list once after every insertion.
      Vicent Marti committed
  8. 23 Nov, 2015 1 commit
    • checkout: only consider nsecs when built that way · 25e84f95
      When examining the working directory and determining whether it's
      up-to-date, only consider the nanoseconds in the index entry when
      built with `GIT_USE_NSEC`.  This prevents us from believing that
      the working directory is always dirty when the index was originally
      written with a git client that uinderstands nsecs (like git 2.x).
      Edward Thomson committed
  9. 14 Aug, 2015 1 commit
  10. 20 Jun, 2015 1 commit
  11. 19 Jun, 2015 1 commit
    • index: use the checksum to check whether it's been modified · 5e947c91
      We currently use a timetamp to check whether an index file has been
      modified since we last read it, but this is racy. If two updates happen
      in the same second and we read after the first one, we won't detect the
      second one.
      
      Instead read the SHA-1 checksum of the file, which are its last 20 bytes which
      gives us a sure-fire way to detect whether the file has changed since we
      last read it.
      
      As we're now keeping track of it, expose an accessor to this data.
      Carlos Martín Nieto committed
  12. 11 May, 2015 1 commit
  13. 14 Feb, 2015 2 commits
  14. 10 Oct, 2014 1 commit
  15. 17 Apr, 2014 5 commits
  16. 01 Apr, 2014 1 commit
  17. 20 Mar, 2014 1 commit
  18. 07 Feb, 2014 1 commit
  19. 29 Jan, 2014 1 commit
  20. 08 Oct, 2013 1 commit
    • More filemode cleanups for FAT on MacOS · 14997dc5
      This cleans up some additional issues.  The main change is that
      on a filesystem that doesn't support mode bits, libgit2 will now
      create new blobs with GIT_FILEMODE_BLOB always instead of being
      at the mercy to the filesystem driver to report executable or not.
      This means that if "core.filemode" lies and claims that filemode
      is not supported, then we will ignore the executable bit from the
      filesystem.  Previously we would have allowed it.
      
      This adds an option to the new git_repository_reset_filesystem to
      recurse through submodules if desired.  There may be other types
      of APIs that would like a "recurse submodules" option, but this
      one is particularly useful.
      
      This also has a number of cleanups, etc., for related things
      including trying to give better error messages when problems come
      up from the filesystem.  For example, the FAT filesystem driver on
      MacOS appears to return errno EINVAL if you attempt to write a
      filename with invalid UTF-8 in it.  We try to capture that with a
      better error message now.
      Russell Belfer committed
  21. 10 Jul, 2013 1 commit
    • 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
  22. 17 May, 2013 1 commit
  23. 30 Apr, 2013 1 commit
  24. 07 Mar, 2013 1 commit
    • Make iterator APIs consistent with standards · 169dc616
      The iterator APIs are not currently consistent with the parameter
      ordering of the rest of the codebase.  This rearranges the order
      of parameters, simplifies the naming of a number of functions, and
      makes somewhat better use of macros internally to clean up the
      iterator code.
      
      This also expands the test coverage of iterator functionality,
      making sure that case sensitive range-limited iteration works
      correctly.
      Russell Belfer committed
  25. 01 Mar, 2013 2 commits
  26. 08 Jan, 2013 1 commit
  27. 27 Nov, 2012 1 commit
    • Fix up some missing consts in tree & index · 16248ee2
      This fixes some missed places where we can apply const-ness to
      various public APIs.
      
      There are still some index and tree APIs that cannot take const
      pointers because we sort our `git_vectors` lazily and so we can't
      reliably bsearch the index and tree content without applying a
      `git_vector_sort()` first.
      
      This also fixes some missed places where size_t can be used and
      where const can be applied to a couple internal functions.
      Russell Belfer committed
  28. 09 Nov, 2012 2 commits
    • Rework checkout with new strategy options · ad9a921b
      This is a major reworking of checkout strategy options.  The
      checkout code is now sensitive to the contents of the HEAD tree
      and the new options allow you to update the working tree so that
      it will match the index content only when it previously matched
      the contents of the HEAD.  This allows you to, for example, to
      distinguish between removing files that are in the HEAD but not
      in the index, vs just removing all untracked files.
      
      Because of various corner cases that arise, etc., this required
      some additional capabilities in rmdir and other utility functions.
      
      This includes the beginnings of an implementation of code to read
      a partial tree into the index based on a pathspec, but that is
      not enabled because of the possibility of creating conflicting
      index entries.
      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
  29. 01 Nov, 2012 1 commit
  30. 30 Oct, 2012 1 commit
  31. 17 Sep, 2012 1 commit