1. 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
  2. 30 Jul, 2012 1 commit
  3. 17 Jul, 2012 1 commit
  4. 15 Jun, 2012 1 commit
  5. 19 May, 2012 3 commits
  6. 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
  7. 13 Feb, 2012 1 commit
  8. 27 Jan, 2012 1 commit
  9. 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
  10. 16 Nov, 2011 1 commit
  11. 05 Oct, 2011 1 commit
  12. 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
  13. 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
  14. 12 Sep, 2011 1 commit
  15. 24 Aug, 2011 1 commit
  16. 03 Jul, 2011 1 commit
  17. 30 Jun, 2011 1 commit
  18. 15 Jun, 2011 1 commit
  19. 14 Jun, 2011 1 commit
  20. 07 Jun, 2011 2 commits
  21. 10 May, 2011 1 commit
  22. 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
  23. 20 Mar, 2011 1 commit
  24. 15 Mar, 2011 1 commit
  25. 03 Mar, 2011 2 commits
  26. 11 Jan, 2011 2 commits
  27. 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
  28. 06 Dec, 2010 1 commit
  29. 14 Apr, 2010 1 commit
    • Add block-sha1 in favour of the mozilla routines · 5dddf7c8
      Since block-sha1 from git.git has such excellent performance, we
      can also get rid of the openssl dependency. It's rather simple
      to add it back later as an optional extra, but we really needn't
      bother to pull in the entire ssl library and have to deal with
      linking issues now that we have the portable and, performance-wise,
      truly excellent block-sha1 code to fall back on.
      
      Since this requires a slight revamp of the build rules anyway, we
      take the opportunity to fix including EXTRA_OBJS in the final build
      as well.
      
      The block-sha1 code was originally implemented for git.git by
      Linus Torvalds <torvalds@linux-foundation.org> and was later
      polished by Nicolas Pitre <nico@cam.org>.
      
      Signed-off-by: Andreas Ericsson <ae@op5.se>
      Andreas Ericsson committed
  30. 28 Feb, 2010 1 commit
  31. 20 Jan, 2010 3 commits