1. 20 Jun, 2015 1 commit
  2. 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
  3. 11 May, 2015 1 commit
  4. 14 Feb, 2015 2 commits
  5. 10 Oct, 2014 1 commit
  6. 17 Apr, 2014 5 commits
  7. 01 Apr, 2014 1 commit
  8. 20 Mar, 2014 1 commit
  9. 07 Feb, 2014 1 commit
  10. 29 Jan, 2014 1 commit
  11. 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
  12. 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
  13. 17 May, 2013 1 commit
  14. 30 Apr, 2013 1 commit
  15. 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
  16. 01 Mar, 2013 2 commits
  17. 08 Jan, 2013 1 commit
  18. 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
  19. 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
  20. 01 Nov, 2012 1 commit
  21. 30 Oct, 2012 1 commit
  22. 17 Sep, 2012 1 commit
  23. 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
  24. 15 May, 2012 1 commit
    • Ranged iterators and rewritten git_status_file · 41a82592
      The goal of this work is to rewrite git_status_file to use the
      same underlying code as git_status_foreach.
      
      This is done in 3 phases:
      
      1. Extend iterators to allow ranged iteration with start and
         end prefixes for the range of file names to be covered.
      2. Improve diff so that when there is a pathspec and there is
         a common non-wildcard prefix of the pathspec, it will use
         ranged iterators to minimize excess iteration.
      3. Rewrite git_status_file to call git_status_foreach_ext
         with a pathspec that covers just the one file being checked.
      
      Since ranged iterators underlie the status & diff implementation,
      this is actually fairly efficient.  The workdir iterator does
      end up loading the contents of all the directories down to the
      single file, which should ideally be avoided, but it is pretty
      good.
      Russell Belfer committed
  25. 19 Mar, 2012 1 commit
    • Migrate index, oid, and utils to new errors · 7c7ff7d1
      This includes a few cleanups that came up while converting
      these files.
      
      This commit introduces a could new git error classes, including
      the catchall class: GITERR_INVALID which I'm using as the class
      for invalid and out of range values which are detected at too low
      a level of library to use a higher level classification.  For
      example, an overflow error in parsing an integer or a bad letter
      in parsing an OID string would generate an error in this class.
      Russell Belfer committed
  26. 13 Feb, 2012 1 commit
  27. 26 Nov, 2011 1 commit
    • repository: Change ownership semantics · 9462c471
      The ownership semantics have been changed all over the library to be
      consistent. There are no more "borrowed" or duplicated references.
      
      Main changes:
      
      	- `git_repository_open2` and `3` have been dropped.
      
      	- Added setters and getters to hotswap all the repository owned
      	objects:
      
      		`git_repository_index`
      		`git_repository_set_index`
      		`git_repository_odb`
      		`git_repository_set_odb`
      		`git_repository_config`
      		`git_repository_set_config`
      		`git_repository_workdir`
      		`git_repository_set_workdir`
      
      	Now working directories/index files/ODBs and so on can be
      	hot-swapped after creating a repository and between operations.
      
      	- All these objects now have proper ownership semantics with
      	refcounting: they all require freeing after they are no longer
      	needed (the repository always keeps its internal reference).
      
      	- Repository open and initialization has been updated to keep in
      	mind the configuration files. Bare repositories are now always
      	detected, and a default config file is created on init.
      
      	- All the tests affected by these changes have been dropped from the
      	old test suite and ported to the new one.
      Vicent Marti committed
  28. 14 Oct, 2011 1 commit
    • *: correct and codify various file permissions · 01ad7b3a
      The following files now have 0444 permissions:
      
      - loose objects
      - pack indexes
      - pack files
      - packs downloaded by fetch
      - packs downloaded by the HTTP transport
      
      And the following files now have 0666 permissions:
      
      - config files
      - repository indexes
      - reflogs
      - refs
      
      This brings libgit2 more in line with Git.
      
      Note that git_filebuf_commit() and git_filebuf_commit_at() have both
      gained a new mode parameter.
      
      The latter change fixes an important issue where filebufs created with
      GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3)
      usage). Now we chmod() the file before renaming it into place.
      
      Tests have been added to confirm that new commit, tag, and tree
      objects are created with the right permissions. I don't have access to
      Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
      Brodie Rao committed
  29. 27 Sep, 2011 1 commit
  30. 18 Sep, 2011 1 commit
    • Cleanup legal data · bb742ede
      1. The license header is technically not valid if it doesn't have a
      copyright signature.
      
      2. The COPYING file has been updated with the different licenses used in
      the project.
      
      3. The full GPLv2 header in each file annoys me.
      Vicent Marti committed
  31. 21 Apr, 2011 1 commit
    • index: Add API for unmerged entries · 4c0b6a6d
      New external functions:
      	- git_index_unmerged_entrycount: Counts the unmerged entries in
      	  the index
      	- git_index_get_unmerged: Gets an unmerged entry from the index
      	  by name
      
      New internal functions:
      	- read_unmerged: Wrapper for read_unmerged_internal
      	- read_unmerged_internal: Reads unmerged entries from the index
      	  if the index has the INDEX_EXT_UNMERGED_SIG set
      	- unmerged_srch: Search function for unmerged vector
      	- unmerged_cmp: Compare function for unmerged vector
      
      New data structures:
      	- git_index now contains a git_vector unmerged that stores
      	  unmerged entries
      	- git_index_entry_unmerged: Representation of an unmerged file
      	  entry. It represents all three versions of the file at the
      	  same time, with one name, three modes and three OIDs
      Jakob Pfender committed
  32. 03 Mar, 2011 1 commit
    • Fix searching in git_vector · 86d7e1ca
      We now store only one sorting callback that does entry comparison. This
      is used when sorting the entries using a quicksort, and when looking for
      a specific entry with the new search methods.
      
      The following search methods now exist:
      
      	git_vector_search(vector, entry)
      	git_vector_search2(vector, custom_search_callback, key)
      
      	git_vector_bsearch(vector, entry)
      	git_vector_bsearch2(vector, custom_search_callback, key)
      
      The sorting state of the vector is now stored internally.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  33. 21 Feb, 2011 1 commit
    • Rewrite all file IO for more performance · 817c2820
      The new `git_filebuf` structure provides atomic high-performance writes
      to disk by using a write cache, and optionally a double-buffered scheme
      through a worker thread (not enabled yet).
      
      Writes can be done 3-layered, like in git.git (user code -> write cache
      -> disk), or 2-layered, by writing directly on the cache. This makes
      index writing considerably faster.
      
      The `git_filebuf` structure contains all the old functionality of
      `git_filelock` for atomic file writes and reads. The `git_filelock`
      structure has been removed.
      
      Additionally, the `git_filebuf` API allows to automatically hash (SHA1)
      all the data as it is written to disk (hashing is done smartly on big
      chunks to improve performance).
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed