summaryrefslogtreecommitdiff
path: root/src/common.h
Commit message (Collapse)AuthorAgeFilesLines
* versions: MSVC build fixesVicent Marti2012-12-051-5/+5
|
* common: Silly vmg.Vicent Marti2012-12-051-1/+2
|
* common: Silly MSVCVicent Marti2012-12-051-1/+2
|
* Merge pull request #1115 from ben/struct-versionsVicent Martí2012-12-051-0/+27
|\ | | | | Version info for public structs
| * Don't unconstify when castingBen Straub2012-12-031-1/+1
| |
| * Deploy GIT_INIT_STRUCTUREBen Straub2012-11-301-0/+10
| |
| * Deploy GITERR_CHECK_VERSIONBen Straub2012-11-301-0/+17
| |
* | revparse: Deploy EINVALIDSPEC usagenulltoken2012-12-011-2/+2
|/
* Reorganize transport architecture (squashed 3)Philip Kelley2012-11-011-3/+0
|
* Make giterr_set_str publicRussell Belfer2012-09-211-3/+13
| | | | | | | 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.
* remote: start moving the protocol to a common areaCarlos Martín Nieto2012-07-301-0/+3
| | | | | | | For the transition, http is going to keep its own logic until the git/common code catches up with the implied multi_ack that http has. This also has the side-effect of making the code cleaner and more correct regardingt he protocol.
* Remove old error handling codeMichael Schubert2012-07-171-10/+0
|
* Fix compile errors when building on windowsTim Clem2012-06-151-0/+1
| | | | Errors were due to not including winsock2 early enough.
* ssl: remove GnuTLS supportCarlos Martín Nieto2012-05-191-19/+0
| | | | | | It's too much work for now to redo everything. Move the ssl context struct to transport.h
* https: make it work with OpenSSL as wellCarlos Martín Nieto2012-05-191-0/+8
| | | | Add specific functions that use OpenSSL instead of GnuTLS
* http: add https support when GnuTLS is availableCarlos Martín Nieto2012-05-191-0/+10
| | | | | | | | If it's not available, an error saying so will be returned when trying to use a https:// URL. This also unifies a lot of the network code to use git_transport in many places instead of an socket descriptor.
* error-handling: On-disk config file backendVicent Martí2012-03-091-0/+12
| | | | | | | | | | | | | | | 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!
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* msvc: Move `ssize_t` typedef to MSVC-onlyVicent Martí2012-01-261-4/+0
| | | | This is a MSVC-only issue. All other compilers we support work properly.
* repository: Change ownership semanticsVicent Marti2011-11-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* threads: Fix the shared global state with TLSVicent Marti2011-11-161-1/+0
| | | | | | | See `global.c` for a description of what we're doing. When libgit2 is built with GIT_THREADS support, the threading system must be explicitly initialized with `git_threads_init()`.
* msvc: Properly handle inttypes.h/stdint.hVicent Marti2011-10-051-3/+0
|
* Merge pull request #397 from lambourg/developmentVicent Martí2011-09-181-0/+2
|\ | | | | Fix compilation issues with mingw64 headers
| * Fix compilation issues with ming64 headersJerome Lambourg2011-09-121-0/+2
| |
* | Tabify everythingVicent Marti2011-09-191-2/+2
| | | | | | | | | | | | 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.
* | Cleanup legal dataVicent Marti2011-09-191-0/+6
|/ | | | | | | | | | 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.
* Fix false positive -Wuninitialized warningsKirill A. Shutemov2011-08-241-2/+7
| | | | | | | | GCC produces several -Wuninitialized warnings. Most of them can be fixed if we make visible for gcc that git__throw() and git__rethrow() always return first argument. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* build: Move OS-specific compat to their own foldersVicent Marti2011-07-031-2/+2
|
* common: Force 64 bit fileops at compile timeVicent Marti2011-06-301-4/+0
|
* Merge pull request #261 from Romain-Geissler/discovery-path-v2Vicent Martí2011-06-151-6/+2
|\ | | | | Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
| * Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.Romain Geissler2011-06-151-6/+2
| | | | | | | | | | GIT_PATH_LIST_SEPARATOR and GIT_PATH_MAX are made public so that it's can be used by a client.
* | Remove uneeded arpa/inet.h includeCarlos Martín Nieto2011-06-141-1/+0
|/ | | | | | | This header isn't needed at all and it shows a lot of warnings on OpenBSD. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Move all error-related defines to `git2/errors.h`Vicent Marti2011-05-111-0/+1
|
* Change error handling mechanism once againVicent Marti2011-05-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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");
* errors: Set error messages on memory allocationVicent Marti2011-05-091-2/+2
|
* errors: Add error handling functionVicent Marti2011-05-091-0/+2
|
* Thread safe cacheVicent Marti2011-03-201-3/+6
|
* Add proper threading support to libgit2Vicent Marti2011-03-151-3/+2
| | | | | | | We now depend on libpthread on all Unix platforms (should be installed by default) and use a simple wrapper for Windows threads under Win32. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Split packed from unpacked referencesVicent Marti2011-03-031-1/+0
| | | | | | | | These two reference types are now stored separately to eventually allow the removal/renaming of loose references and rewriting of the refs packfile. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Added git_reference__normalize_name() along with tests.nulltoken2011-03-031-0/+1
|
* Move the compat definitions to types.hVicent Marti2011-01-121-1/+1
| | | | | | | | | Don't need a brand new header for two typedefs when we already have a types.h header. Change comment style to ANSI C. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Revised platform types to use 'best supported' size.Alex Budovski2011-01-111-0/+1
| | | | | This will allow graceful migration to 64 bit file sizes and timestamps should git's binary interface be extended to allow this.
* Remove git_errnoVicent Marti2010-12-231-1/+0
| | | | | | | | | 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>
* Change the library include fileVicent Marti2010-12-061-2/+2
| | | | | | | | | | | | Libgit2 is now officially include as #include "<git2.h>" or indidividual files may be included as #include <git2/index.h> Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Merge remote branch 'ramsay/dev'Andreas Ericsson2010-04-231-41/+2
|\ | | | | | | | | | | | | | | | | | | | | | | * ramsay/dev: Add a pack index 'virtual function' to fetch an index entry Add a pack index 'virtual function' to search by file offset Change the interface of the pack index search function Add an 64-bit offset table index bounds check for v2 pack index Add a minimum size check when opening an v2 pack index file win32: Add separate MinGW and MSVC compatability header files Makefile: Add support for custom build options in config.mak file Fix some coding style issues
| * win32: Add separate MinGW and MSVC compatability header filesRamsay Jones2010-02-281-41/+2
| | | | | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* | Add block-sha1 in favour of the mozilla routinesAndreas Ericsson2010-04-141-0/+1
|/ | | | | | | | | | | | | | | | | | | 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>
* win32: Use an 64-bit file offset typeRamsay Jones2010-01-201-0/+18
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Add support for the MinGW platformRamsay Jones2010-01-201-1/+1
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Use a 64 bit off_t throughout the library and tests on POSIXRamsay Jones2010-01-201-0/+3
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>