1. 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
  2. 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
  3. 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
  4. 17 Feb, 2011 1 commit
    • Improve the performance when writing Index files · 348c7335
      In response to issue #60 (git_index_write really slow), the write_index
      function has been rewritten to improve its performance -- it should now
      be in par with the performance of git.git.
      
      On top of that, if Posix Threads are available when compiling libgit2, a
      new threaded writing system will be used (3 separate threads take care
      of solving byte-endianness, hashing the contents of the index and
      writing to disk, respectively). For very long Index files, this method
      is up to 3x times faster than git.git.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  5. 06 Dec, 2010 1 commit
  6. 02 Dec, 2010 1 commit
    • Refactor all 'vector' functions into common code · c4034e63
      All the operations on the 'git_index_entry' array and the
      'git_tree_entry' array have been refactored into common code in the
      src/vector.c file.
      
      The new vector methods support:
      	- insertion:	O(1) (avg)
      	- deletion:		O(n)
      	- searching:	O(logn)
      	- sorting:		O(logn)
      	- r. access:	O(1)
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  7. 29 Nov, 2010 1 commit
  8. 16 Nov, 2010 1 commit
    • Add support for 'index add' · c3a20d5c
      Actually add files to the index by creating their corresponding blob and
      storing it on the repository, then getting the hash and updating the
      index file.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  9. 02 Nov, 2010 1 commit
    • Change git_repository initialization to use a path · 6fd195d7
      The constructor to git_repository is now called
      
      	'git_repository_open(path)'
      
      and takes a path to a git repository instead of an existing ODB object.
      Unit tests have been updated accordingly and the two test repositories
      have been merged into one.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  10. 12 Aug, 2010 1 commit
    • Add support for git index files · 68535125
      The new 'git_index' structure is an in-memory representation
      of a git index on disk; the 'git_index_entry' structures represent
      each one of the file entries on the index.
      
      The following calls for index instantiation have been added:
      
      	git_index_alloc(): instantiate a new index structure
      	git_index_free(): free an existing index
      	git_index_clear(): clear all the entires in an existing file
      
      The following calls for index reading and writing have been added:
      
      	git_index_read(): update the contents of the index structure from
      					  its file on disk.
      
      		Internally implemented through:
      			git_index__parse()
      
      	Index files are stored on disk in network byte order; all integer fields
      	inside them are properly converted to the machine's byte order when
      	loading them in memory. The parsing engine also distinguishes
      	between normal index entries and extended entries with 2 extra bytes
      	of flags.
      
      	The 'TREE' extension for index entries is also loaded into memory:
      	Tree caches stored in Index files are loaded into the
      	'git_index_tree' structure pointed by the 'tree' pointer inside
      	'git_index'.
      
      	'index->tree' points to the root node of the tree cache; the full tree
      	can be traversed through each of the node's 'tree->children'.
      
      	Index files can be written back to disk through:
      
      	git_index_write(): atomic writing of existing index objects
      		backed by internal method git_index__write()
      
      The following calls for entry manipulation have been added:
      
      	git_index_add(): insert an empty entry to the index
      
      	git_index_find(): search an entry by its path name
      
      	git_index__append(): appends a new index entry to the end of the
      						 list, resizing the entries array if required
      
      	New index entries are always inserted at the end of the array; since the
      	index entries must be sorted for it to be internally consistent, the
      	index object is only sorted once, and if required, before accessing the
      	whole entriea array (e.g. before writing to disk, before traversing,
      	etc).
      
      	git_index__remove_pos(): remove an index entry in a specific position
      
      	git_index__sort(): sort the entries in the array by path name
      
      	The entries array is sorted stably and in place using an
      	insertion sort, which ought to be the most efficient approach
      	since the entries array is always mostly-sorted.
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed