1. 08 Jan, 2013 1 commit
  2. 01 Dec, 2012 1 commit
  3. 02 Nov, 2012 2 commits
  4. 21 Sep, 2012 1 commit
    • Make giterr_set_str public · 1a628100
      There has been discussion for a while about making some set of
      the `giterr_set` type functions part of the public API for code
      that is implementing new backends to libgit2.  This makes the
      `giterr_set_str()` and `giterr_set_oom()` functions public.
      Russell Belfer committed
  5. 24 Aug, 2012 1 commit
  6. 03 May, 2012 2 commits
  7. 25 Apr, 2012 1 commit
    • Implement git_pool paged memory allocator · 2bc8fa02
      This adds a `git_pool` object that can do simple paged memory
      allocation with free for the entire pool at once.  Using this,
      you can replace many small allocations with large blocks that
      can then cheaply be doled out in small pieces.  This is best
      used when you plan to free the small blocks all at once - for
      example, if they represent the parsed state from a file or data
      stream that are either all kept or all discarded.
      
      There are two real patterns of usage for `git_pools`: either
      for "string" allocation, where the item size is a single byte
      and you end up just packing the allocations in together, or for
      "fixed size" allocation where you are allocating a large object
      (e.g. a `git_oid`) and you generally just allocation single
      objects that can be tightly packed.  Of course, you can use it
      for other things, but those two cases are the easiest.
      Russell Belfer committed
  8. 11 Apr, 2012 1 commit
    • Refactor git_repository_open with new options · 7784bcbb
      Add a new command `git_repository_open_ext` with extended options
      that control how searching for a repository will be done.  The
      existing `git_repository_open` and `git_repository_discover` are
      reimplemented on top of it.  We may want to change the default
      behavior of `git_repository_open` but this commit does not do that.
      
      Improve support for "gitdir" files where the work dir is separate
      from the repo and support for the "separate-git-dir" config.  Also,
      add support for opening repos created with `git-new-workdir` script
      (although I have only confirmed that they can be opened, not that
      all functions work correctly).
      
      There are also a few minor changes that came up:
      
      - Fix `git_path_prettify` to allow in-place prettifying.
      
      - Fix `git_path_root` to support backslashes on Win32.  This fix
        should help many repo open/discover scenarios - it is the one
        function called when opening before prettifying the path.
      
      - Tweak `git_config_get_string` to set the "out" pointer to NULL
        if the config value is not found.  Allows some other cleanup.
      
      - Fix a couple places that should have been calling
        `git_repository_config__weakptr` and were not.
      
      - Fix `cl_git_sandbox_init` clar helper to support bare repos.
      Russell Belfer committed
  9. 13 Mar, 2012 2 commits
    • Resolve comments from pull request · e3c47510
      This converts the map validation function into a macro, tweaks
      the GITERR_OS system error automatic appending, and adds a
      tentative new error access API and some quick unit tests for
      both the old and new error APIs.
      Russell Belfer committed
    • 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
  10. 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
  11. 07 Mar, 2012 2 commits
  12. 05 Mar, 2012 1 commit
  13. 03 Mar, 2012 1 commit
  14. 13 Feb, 2012 1 commit
  15. 16 Nov, 2011 1 commit
  16. 29 Oct, 2011 1 commit
  17. 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
  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. 24 Aug, 2011 1 commit
  20. 28 Jun, 2011 1 commit
  21. 01 Jun, 2011 1 commit
  22. 10 May, 2011 1 commit
  23. 09 May, 2011 3 commits
    • Change error handling mechanism once again · fa59f18d
      Ok, this is the real deal. Hopefully. Here's how it's going to work:
      
      - One main method, called `git__throw`, that sets the error
      	code and error message when an error happens.
      
      	This method must be called in every single place where an error
      	code was being returned previously, setting an error message
      	instead.
      
      	Example, instead of:
      
      		return GIT_EOBJCORRUPTED;
      
      	Use:
      
      		return git__throw(GIT_EOBJCORRUPTED,
      			"The object is missing a finalizing line feed");
      
      	And instead of:
      
      		[...] {
      			error = GIT_EOBJCORRUPTED;
      			goto cleanup;
      		}
      
      	Use:
      
      		[...] {
      			error = git__throw(GIT_EOBJCORRUPTED, "What an error!");
      			goto cleanup;
      		}
      
      	The **only** exception to this are the allocation methods, which
      	return NULL on failure but already set the message manually.
      
      		/* only place where an error code can be returned directly,
      		   because the error message has already been set by the wrapper */
      		if (foo == NULL)
      			return GIT_ENOMEM;
      
      - One secondary method, called `git__rethrow`, which can be used to
      fine-grain an error message and build an error stack.
      
      	Example, instead of:
      
      		if ((error = foobar(baz)) < GIT_SUCCESS)
      			return error;
      
      	You can now do:
      
      		if ((error = foobar(baz)) < GIT_SUCCESS)
      			return git__rethrow(error, "Failed to do a major operation");
      
      	The return of the `git_lasterror` method will be a string in the
      	shape of:
      
      		"Failed to do a major operation. (Failed to do an internal
      		operation)"
      
      	E.g.
      
      		"Failed to open the index. (Not enough permissions to access
      		'/path/to/index')."
      
      	NOTE: do not abuse this method. Try to write all `git__throw`
      	messages in a descriptive manner, to avoid having to rethrow them to
      	clarify their meaning.
      
      	This method should only be used in the places where the original
      	error message set by a subroutine is not specific enough.
      
      	It is encouraged to continue using this style as much possible to
      	enforce error propagation:
      
      		if ((error = foobar(baz)) < GIT_SUCCESS)
      			return error; /* `foobar` has set an error message, and
      							 we are just propagating it */
      
      The error handling revamp will take place in two phases:
      
      	- Phase 1: Replace all pieces of code that return direct error codes
      	with calls to `git__throw`. This can be done semi-automatically
      	using `ack` to locate all the error codes that must be replaced.
      
      	- Phase 2: Add some `git__rethrow` calls in those cases where the
      	original error messages are not specific enough.
      
      Phase 1 is the main goal. A minor libgit2 release will be shipped once
      Phase 1 is ready, and the work will start on gradually improving the
      error handling mechanism by refining specific error messages.
      
      OTHER NOTES:
      
      	- When writing error messages, please refrain from using weasel
      	words. They add verbosity to the message without giving any real
      	information. (<3 Emeric)
      
      	E.g.
      
      		"The reference file appears to be missing a carriage return"
      			Nope.
      
      		"The reference file is missing a carriage return"
      			Yes.
      
      	- When calling `git__throw`, please try to use more generic error
      	codes so we can eventually reduce the list of error codes to
      	something more reasonable. Feel free to add new, more generic error
      	codes if these are going to replace several of the old ones.
      
      	E.g.
      
      		return GIT_EREFCORRUPTED;
      
      	Can be turned into:
      
      		return git__throw(GIT_EOBJCORRUPTED,
      			"The reference is corrupted");
      Vicent Marti committed
  24. 09 Apr, 2011 1 commit
  25. 29 Mar, 2011 2 commits
  26. 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
  27. 03 Mar, 2011 1 commit
  28. 05 Feb, 2011 1 commit
  29. 29 Jan, 2011 2 commits
    • Merge nulltoken's reference parsing code · 9282e921
      All the commits have been squashed into a single one before refactoring
      the final code, to keep everything tidy.
      
      Individual commit messages are as follows:
      
      Added repository reference looking up functionality placeholder.
      
      Added basic reference database definition and caching infrastructure.
      
      Removed useless constant.
      
      Added GIT_EINVALIDREFNAME error and description. Added missing description for GIT_EBAREINDEX.
      
      Added GIT_EREFCORRUPTED error and description.
      
      Added GIT_ETOONESTEDSYMREF error and description.
      
      Added resolving of direct and symbolic references.
      
      Prepared the packed-refs parsing.
      
      Added parsing of the packed-refs file content.
      
      When no loose reference has been found, the full content of the packed-refs file is parsed. All of the new (i.e. not previously parsed as a loose reference) references are eagerly stored in the cached references storage.
      
      The method packed_reference_file__parse() is in deer need of some refactoring. :-)
      
      Extracted to a method the parsing of the peeled target of a tag.
      
      Extracted to a method the parsing of a standard packed ref.
      
      Fixed leaky removal of the cached references.
      
      Ensured that a previously parsed packed reference isn't returned if a more up-to-date loose reference exists.
      
      Enhanced documentation of git_repository_reference_lookup().
      
      Moved some refs related constants from repository.c to refs.h.
      
      Made parsing of a packed tag reference more robust.
      
      Updated git_repository_reference_lookup() documentation.
      
      Added some references to the test repository.
      
      Added some tests covering tag references looking up.
      
      Added some tests covering symbolic and head references looking up.
      
      Added some tests covering packed references looking up.
      nulltoken committed
  30. 22 Dec, 2010 1 commit
    • Remove git_errno · 9f54fe48
      It was not being used by any methods (only by malloc and calloc), and
      since it needs to be TLS, it cannot be exported on DLLs on Windows.
      
      Burn it with fire. The API always returns error codes!
      
      Signed-off-by: Vicent Marti <tanoku@gmail.com>
      Vicent Marti committed
  31. 05 Nov, 2010 1 commit
  32. 20 Jan, 2010 1 commit