1. 11 Apr, 2016 1 commit
  2. 13 May, 2015 1 commit
    • odb: make the writestream's size a git_off_t · 77b339f7
      Restricting files to size_t is a silly limitation. The loose backend
      writes to a file directly, so there is no issue in using 63 bits for the
      size.
      
      We still assume that the header is going to fit in 64 bytes, which does
      mean quite a bit smaller files due to the run-length encoding, but it's
      still a much larger size than you would want Git to handle.
      Carlos Martín Nieto committed
  3. 17 Sep, 2013 1 commit
    • Create public filter object and use it · 85d54812
      This creates include/sys/filter.h with a basic definition of a
      git_filter and then converts the internal code to use it.  There
      are related internal objects (git_filter_list) that we will want
      to publish at some point, but this is a first step.
      Russell Belfer committed
  4. 22 Apr, 2013 3 commits
  5. 08 Jan, 2013 1 commit
  6. 30 Nov, 2012 1 commit
    • indexer: use the packfile streaming API · f56f8585
      The new API allows us to read the object bit by bit from the packfile,
      instead of needing it all at once in the packfile. This also allows us
      to hash the object as it comes in from the network instead of having
      to try to read it all and failing repeatedly for larger objects.
      
      This is only the first step, but it already shows huge improvements
      when dealing with objects over a few megabytes in size. It reduces the
      memory needs in some cases, but delta objects still need to be
      completely in memory and the old inefficent method is still used for
      that.
      Carlos Martín Nieto committed
  7. 10 Sep, 2012 1 commit
    • Reorg internal odb read header and object lookup · c6ac28fd
      Often `git_odb_read_header` will "fail" and have to read the
      entire object into memory instead of just the header.  When this
      happens, the object is loaded and then disposed of immediately,
      which makes it difficult to efficiently use the header information
      to decide if the object should be loaded (since attempting to do
      so will often result in loading the object twice).
      
      This commit takes the existing code and reorganizes it to have
      two new functions:
      
      - `git_odb__read_header_or_object` which acts just like the old
        read header function except that it returns the object, too, if
        it was forced to load the whole thing.  It then becomes the
        callers responsibility to free the `git_odb_object`.
      - `git_object__from_odb_object` which was extracted from the old
        `git_object_lookup` and creates a subclass of `git_object` from
        an existing `git_odb_object` (separating the ODB lookup from the
        `git_object` creation).  This allows you to use the first header
        reading function efficiently without instantiating the
        `git_odb_object` twice.
      
      There is no net change to the behavior of any of the existing
      functions, but this allows internal code to tap into the ODB
      lookup and object creation to be more efficient.
      Russell Belfer committed
  8. 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
  9. 17 May, 2012 2 commits
  10. 04 May, 2012 1 commit
    • Fix valgrind issues · 282283ac
      There are three changes here:
      - correctly propogate error code from failed object lookups
      - make zlib inflate use our allocators
      - add OID to notfound error in ODB lookups
      Russell Belfer committed
  11. 13 Mar, 2012 1 commit
    • Migrate ODB files to new error handling · e1de726c
      This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to
      the new style of error handling.  Also got the unix and win32
      versions of map.c.  There are some minor changes to other
      files but no others were completely converted.
      
      This also contains an update to filebuf so that a zeroed out
      filebuf will not think that the fd (== 0) is actually open
      (and inadvertently call close() on fd 0 if cleaned up).
      
      Lastly, this was built and tested on win32 and contains a
      bunch of fixes for the win32 build which was pretty broken.
      Russell Belfer committed
  12. 13 Feb, 2012 1 commit
  13. 10 Feb, 2012 2 commits
  14. 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
  15. 14 Oct, 2011 2 commits
    • *: 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
    • fileops/repository: create (most) directories with 0777 permissions · ce8cd006
      To further match how Git behaves, this change makes most of the
      directories libgit2 creates in a git repo have a file mode of
      0777. Specifically:
      
      - Intermediate directories created with git_futils_mkpath2file() have
        0777 permissions. This affects odb_loose, reflog, and refs.
      
      - The top level folder for bare repos is created with 0777
        permissions.
      
      - The top level folder for non-bare repos is created with 0755
        permissions.
      
      - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are
        created with 0777 permissions.
      
      Additionally, the following changes have been made:
      
      - fileops functions that create intermediate directories have grown a
        new dirmode parameter. The only exception to this is filebuf's
        lock_file(), which unconditionally creates intermediate directories
        with 0777 permissions when GIT_FILEBUF_FORCE is set.
      
      - The test runner now sets the umask to 0 before running any
        tests. This ensurses all file mode checks are consistent across
        systems.
      
      - t09-tree.c now does a directory permissions check. I've avoided
        adding this check to other tests that might reuse existing
        directories from the prefabricated test repos. Because they're
        checked into the repo, they have 0755 permissions.
      
      - Other assorted directories created by tests have 0777 permissions.
      Brodie Rao committed
  16. 19 Sep, 2011 1 commit
    • Tabify everything · 87d9869f
      There were quite a few places were spaces were being used instead of
      tabs. Try to catch them all. This should hopefully not break anything.
      Except for `git blame`. Oh well.
      Vicent Marti committed
  17. 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
  18. 18 Aug, 2011 1 commit
  19. 20 Mar, 2011 1 commit
    • I broke your bindings · 72a3fe42
      Hey. Apologies in advance -- I broke your bindings.
      
      This is a major commit that includes a long-overdue redesign of the
      whole object-database structure. This is expected to be the last major
      external API redesign of the library until the first non-alpha release.
      
      Please get your bindings up to date with these changes. They will be
      included in the next minor release. Sorry again!
      
      Major features include:
      
      	- Real caching and refcounting on parsed objects
      	- Real caching and refcounting on objects read from the ODB
      	- Streaming writes & reads from the ODB
      	- Single-method writes for all object types
      	- The external API is now partially thread-safe
      
      The speed increases are significant in all aspects, specially when
      reading an object several times from the ODB (revwalking) and when
      writing big objects to the ODB.
      
      Here's a full changelog for the external API:
      
      blob.h
      ------
      
      	- Remove `git_blob_new`
      	- Remove `git_blob_set_rawcontent`
      	- Remove `git_blob_set_rawcontent_fromfile`
      	- Rename `git_blob_writefile` -> `git_blob_create_fromfile`
      	- Change `git_blob_create_fromfile`:
      		The `path` argument is now relative to the repository's working dir
      	- Add `git_blob_create_frombuffer`
      
      commit.h
      --------
      
      	- Remove `git_commit_new`
      	- Remove `git_commit_add_parent`
      	- Remove `git_commit_set_message`
      	- Remove `git_commit_set_committer`
      	- Remove `git_commit_set_author`
      	- Remove `git_commit_set_tree`
      
      	- Add `git_commit_create`
      	- Add `git_commit_create_v`
      	- Add `git_commit_create_o`
      	- Add `git_commit_create_ov`
      
      tag.h
      -----
      
      	- Remove `git_tag_new`
      	- Remove `git_tag_set_target`
      	- Remove `git_tag_set_name`
      	- Remove `git_tag_set_tagger`
      	- Remove `git_tag_set_message`
      
      	- Add `git_tag_create`
      	- Add `git_tag_create_o`
      
      tree.h
      ------
      
      	- Change `git_tree_entry_2object`:
      		New signature is `(git_object **object_out, git_repository *repo, git_tree_entry *entry)`
      
      	- Remove `git_tree_new`
      	- Remove `git_tree_add_entry`
      	- Remove `git_tree_remove_entry_byindex`
      	- Remove `git_tree_remove_entry_byname`
      	- Remove `git_tree_clearentries`
      	- Remove `git_tree_entry_set_id`
      	- Remove `git_tree_entry_set_name`
      	- Remove `git_tree_entry_set_attributes`
      
      object.h
      ------------
      
      	- Remove `git_object_new
      	- Remove `git_object_write`
      
      	- Change `git_object_close`:
      		This method is now *mandatory*. Not closing an object causes a
      		memory leak.
      
      odb.h
      -----
      
      	- Remove type `git_rawobj`
      	- Remove `git_rawobj_close`
      	- Rename `git_rawobj_hash` -> `git_odb_hash`
      	- Change `git_odb_hash`:
      		New signature is `(git_oid *id, const void *data, size_t len, git_otype type)`
      
      	- Add type `git_odb_object`
      	- Add `git_odb_object_close`
      
      	- Change `git_odb_read`:
      		New signature is `(git_odb_object **out, git_odb *db, const git_oid *id)`
      	- Change `git_odb_read_header`:
      		New signature is `(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)`
      	- Remove `git_odb_write`
      	- Add `git_odb_open_wstream`
      	- Add `git_odb_open_rstream`
      
      odb_backend.h
      -------------
      
      	- Change type `git_odb_backend`:
      		New internal signatures are as follows
      
      			int (* read)(void **, size_t *, git_otype *, struct git_odb_backend *, const git_oid *)
      			int (* read_header)(size_t *, git_otype *, struct git_odb_backend *, const git_oid *)
      			int (* writestream)(struct git_odb_stream **, struct git_odb_backend *, size_t, git_otype)
      			int (* readstream)( struct git_odb_stream **, struct git_odb_backend *, const git_oid *)
      
      	- Add type `git_odb_stream`
      	- Add enum `git_odb_streammode`
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  20. 07 Feb, 2011 1 commit
  21. 06 Dec, 2010 1 commit
  22. 05 Dec, 2010 2 commits
  23. 30 Apr, 2010 1 commit
  24. 03 Jan, 2009 1 commit
    • Add basic support to read pack-*.idx v1 and v2 files · a7c60cfc
      The index data is mapped into memory and then scanned using a
      binary search algorithm to locate the matching entry for the
      supplied git_oid.  The standard fanout hash trick is applied to
      reduce the search space by 8 iterations.
      
      Since the v1 and v2 file formats differ in their search function,
      due to the different layouts used for the object records, we use
      two different search implementations and a virtual function pointer
      to jump to the correct version of code for the current pack index.
      The single function jump per-pack should be faster then computing
      a branch point inside the inner loop of a common binary search.
      
      To improve concurrency during read operations the pack lock is only
      held while verifying the index is actually open, or while opening
      the index for the first time.  This permits multiple concurrent
      readers to scan through the same index.
      
      If an invalid index file is opened we close it and mark the
      git_pack's invalid bit to true.  The git_pack structure is kept
      around in its parent git_packlist, but the invalid bit will cause
      all future readers to skip over the pack entirely.  Pruning the
      invalid entries is relatively unimportant because they shouldn't
      be very common, a $GIT_DIRECTORY/objects/pack directory tends to
      only have valid pack files.
      
      Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
      Shawn O. Pearce committed