1. 28 Feb, 2017 1 commit
  2. 22 Mar, 2016 1 commit
  3. 24 Jul, 2015 1 commit
    • filebuf: remove lockfile upon rename errors · 19d9beb7
      When we have an error renaming the lockfile, we need to make sure
      that we remove it upon cleanup. For this, we need to keep track of
      whether we opened the file and whether the rename succeeded.
      
      If we did create the lockfile but the rename did not succeed, we
      remove the lockfile. This won't protect against all errors, but
      the most common ones (target file is open) does get handled.
      Carlos Martín Nieto committed
  4. 24 Sep, 2014 1 commit
  5. 05 Nov, 2013 1 commit
  6. 08 Jan, 2013 1 commit
  7. 13 Nov, 2012 1 commit
  8. 30 Oct, 2012 1 commit
    • Add git_config_refresh() API to reload config · 744cc03e
      This adds a new API that allows users to reload the config if the
      file has changed on disk.  A new config callback function to
      refresh the config was added.
      
      The modified time and file size are used to test if the file needs
      to be reloaded (and are now stored in the disk backend object).
      
      In writing tests, just using mtime was a problem / race, so I
      wanted to check file size as well.  To support that, I extended
      `git_futils_readbuffer_updated` to optionally check file size in
      addition to mtime, and I added a new function `git_filebuf_stats`
      to fetch the mtime and size for an open filebuf (so that the
      config could be easily refreshed after a write).
      
      Lastly, I moved some similar file checking code for attributes
      into filebuf.  It is still only being used for attrs, but it
      seems potentially reusable, so I thought I'd move it over.
      Russell Belfer committed
  9. 27 May, 2012 1 commit
  10. 13 Apr, 2012 1 commit
  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. 09 Mar, 2012 1 commit
    • error-handling: On-disk config file backend · dda708e7
      Includes:
      
      	- Proper error reporting when encountering syntax errors in a
      	config file (file, line number, column).
      
      	- Rewritten `config_write`, now with 99% less goto-spaghetti
      
      	- Error state in `git_filebuf`: filebuf write functions no longer
      	need to be checked for error returns. If any of the writes performed
      	on a buffer fail, the last call to `git_filebuf_commit` or
      	`git_filebuf_hash` will fail accordingly and set the appropiate error
      	message. Baller!
      Vicent Martí committed
  13. 15 Feb, 2012 1 commit
  14. 13 Feb, 2012 1 commit
  15. 22 Nov, 2011 1 commit
  16. 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
  17. 29 Sep, 2011 1 commit
  18. 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
  19. 25 Jul, 2011 1 commit
  20. 09 Jul, 2011 1 commit
    • odb: Direct writes are back · afeecf4f
      DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the
      ODB was an overkill for the smaller objects like Commit and Tags; most
      of the streaming logic was taking too long.
      
      This commit makes Commits, Tags and Trees to be built-up in memory, and
      then written to disk in 2 pushes (header + data), instead of streaming
      everything.
      
      This is *always* faster, even for big files (since the git_filebuf class
      still does streaming writes when the memory cache overflows). This is
      also a gazillion lines of code smaller, because we don't have to
      precompute the final size of the object before starting the stream (this
      was kind of defeating the point of streaming, anyway).
      
      Blobs are still written with full streaming instead of loading them in
      memory, since this is still the fastest way.
      
      A new `git_buf` class has been added. It's missing some features, but
      it'll get there.
      Vicent Marti committed
  21. 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
  22. 03 Mar, 2011 1 commit
  23. 22 Feb, 2011 1 commit
  24. 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