include/git2/common.h


Log

Author Commit Date CI Message
Edward Thomson 3eac1037 2015-11-16T23:31:19 settings: allow users to set PROGRAMDATA Allow users to set the `git_libgit2_opts` search path for the `GIT_CONFIG_LEVEL_PROGRAMDATA`. Convert `GIT_CONFIG_LEVEL_PROGRAMDATA` to `GIT_SYSDIR_PROGRAMDATA` for setting the configuration.
Carlos Martín Nieto 75a0ccf5 2015-11-12T19:53:09 Merge pull request #3170 from CmdrMoozy/nsec_fix git_index_entry__init_from_stat: set nsec fields in entry stats
Carlos Martín Nieto de870533 2015-10-02T03:43:11 settings: add a setter for a custom user-agent
Linquize 240a85cf 2015-10-22T07:56:34 inttypes.h is built-in header file since MSVC 2013 The reason is that the types defined in libgit2's inttypes.h collide with system inttypes.h 3rd party library header files may directly reference MSVC's built-in inttypes.h Fixes #3476
Edward Thomson 0f9b6742 2015-10-21T09:24:10 win32: add c linkage guard around inttypes.h inclusion
Axel Rasmussen 0269833f 2015-06-02T12:42:07 settings: expose GIT_USE_NSEC flag in git_libgit2_features
Carlos Martín Nieto a295bd2d 2014-12-06T03:36:18 doc: add documentation to all the public structs and enums This makes them show up in the reference, even if the text itself isn't the most descriptive. These have been found with grep -Przon '\n\ntypedef struct.*?\{' -- include grep -Przon '\n\ntypedef enum.*?\{' -- include
Russell Belfer babbff34 2014-10-10T15:17:05 Move un-namespaced constant to internal header FLAG_BITS only seems to be used internally
Carlos Martín Nieto 9b36537d 2014-10-10T17:42:52 Merge pull request #2588 from swansontec/ssl-cert-path2 Add support for setting the SSL CA location
William Swanson 737b445a 2014-09-26T20:31:33 Add support for setting the SSL CA location This allows users to specify self-signed certificates, or to provide their own certificate stores on limited platforms such as mobile phones.
nulltoken 3a728fb5 2012-11-13T16:35:24 object: introduce git_describe_object()
Carlos Martín Nieto 6057c4a0 2014-03-23T15:48:13 opts: bits are not bytes The default cache size is 256 megabytes, not megabits as claimed in the docs.
Carlos Martín Nieto 42dee8ec 2014-03-23T13:34:33 settings: use git_buf for returning strings This survived the last round of culling, as the signature is only in the comments.
Arthur Schreiber 96484ecd 2014-03-03T12:59:35 Fix the description for `GIT_FEATURE_SSH`.
Vicent Marti ebb3c506 2014-03-03T12:40:25 features: Rename `_HAS_` to `_FEATURE_`
Vicent Marti 2491c416 2014-03-03T12:13:17 caps: Rename the enum name too!
Vicent Marti c9f5298b 2014-03-03T12:09:17 caps: Rename to features to avoid confusion
Russell Belfer 72556cc6 2014-02-20T14:27:10 Address PR comments * Make GIT_INLINE an internal definition so it cannot be used in public headers * Fix language in CONTRIBUTING * Make index caps API use signed instead of unsigned values
Linquize 1b57699a 2013-09-22T09:11:43 Fix typo in documentation
Linquize b99b10f2 2013-09-17T23:38:52 Can git_libgit2_opts() with GIT_OPT_GET_TEMPLATE_PATH and GIT_OPT_SET_TEMPLATE_PATH
Russell Belfer 290e1479 2013-07-09T16:17:41 Add GIT_CAP_SSH if library was built with SSH This also adds a test that actually calls git_libgit2_capabilities and git_libgit2_version.
Russell Belfer 2e62e7c2 2013-05-24T10:33:41 Docs for git_libgit2_opts and cache disable tweak This adds docs for the cache control options to git_libgit2_opts and also tweaks the cache code so that if the cache is disabled, then the next time we attempt to insert something into the cache in question, we will actually clear any old cached objects.
Russell Belfer 0f1f9833 2013-05-24T10:32:07 Add typedefs on some public enums Apparently this makes things easier to bind in some languages.
Carlos Martín Nieto b4117e19 2013-04-24T20:09:42 docs: formatting fixes
Vicent Marti a2378ae4 2013-04-23T20:42:29 opts: Add getter for cached memory
Vicent Marti d8771592 2013-04-22T17:04:52 cache: Max cache size, and evict when the cache fills up
Vicent Marti ee12272d 2013-04-05T22:48:39 Global option setters
Vicent Marti e16e2684 2013-04-04T02:09:32 No longer needed
Michael Schubert f5e28202 2013-03-25T13:38:43 opts: allow configuration of odb cache size Currently, the odb cache has a fixed size of 128 slots as defined by GIT_DEFAULT_CACHE_SIZE. Allow users to set the size of the cache via git_libgit2_opts(). Fixes #1035.
Russell Belfer 41954a49 2013-03-18T14:19:35 Switch search paths to classic delimited strings This switches the APIs for setting and getting the global/system search paths from using git_strarray to using a simple string with GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment PATH variable would contain. This makes it simpler to get and set the value. I also added code to expand "$PATH" when setting a new value to embed the old value of the path. This means that I no longer require separate actions to PREPEND to the value.
Russell Belfer 5540d947 2013-03-15T16:39:00 Implement global/system file search paths The goal of this work is to expose the search logic for "global", "system", and "xdg" files through the git_libgit2_opts() interface. Behind the scenes, I changed the logic for finding files to have a notion of a git_strarray that represents a search path and to store a separate search path for each of the three tiers of config file. For each tier, I implemented a function to initialize it to default values (generally based on environment variables), and then general interfaces to get it, set it, reset it, and prepend new directories to it. Next, I exposed these interfaces through the git_libgit2_opts interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants for the user to control which search path they were modifying. There are alternative designs for the opts interface / argument ordering, so I'm putting this phase out for discussion. Additionally, I ended up doing a little bit of clean up regarding attr.h and attr_file.h, adding a new attrcache.h so the other two files wouldn't have to be included in so many places.
Vicent Marti a0f777c8 2013-01-23T23:44:34 opts: Add getters too
Vicent Marti 59853eff 2013-01-23T02:58:58 Global options setter
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Philip Kelley 613d5eb9 2012-11-28T11:42:37 Push! By schu, phkelley, and congyiwu, et al
Paul Thompson b46708aa 2012-10-11T23:04:08 Separated git_strarray from common.h. Added doxy comments.
Sascha Cunz e564e496 2012-08-01T20:02:32 Add function to query for compile time settings.
Chris Young a8df98c6 2012-06-14T18:57:24 Updates from comments on OS4 compatibility pull request http://github.com/libgit2/libgit2/pull/766
Chris Young 327fb51c 2012-06-09T18:13:07 Fix gethostbyname compatibility
Chris Young fa56478f 2012-06-08T19:15:11 Generic needs compat files
Chris Young aa5a92d1 2012-06-08T18:57:35 OS4 compatibility
Chris Young 0f5e1f3b 2012-06-07T21:56:19 Network byte order is big-endian - the way it should be :)
Vicent Martí 79fdde49 2012-05-14T22:15:53 Revert "Specifiy dllimport to MSVC if we're not building libgit2.dll" This reverts commit 1093e2de22f6ca245b09d758a3510899a8362048.
Sascha Cunz 1093e2de 2012-05-11T04:25:23 Specifiy dllimport to MSVC if we're not building libgit2.dll Building a "shared object" (DLL) in Windows includes 2 steps: - specify __declspec(dllexport) when building the library itself. MSVC will disallow itself from optimizing these symbols out and reference them in the PE's Exports-Table. Further, a static link library will be generated. This library contains the symbols which are exported via the declsepc above. The __declspec(dllexport) becomes part of the symbol-signature (like parameter types in C++ are 'mangled' into the symbol name, the export specifier is mingled with the name) - specify __declspec(dllimport) when using the library. This again mingles the declspec into the name and declares the function / variable with external linkage. cmake automatically adds -Dgit2_EXPORTS to the compiler arguments when compiling the libgit2 project. The 'git2' is the name specified via PROJECT() in CMakeLists.txt.
Scott J. Goldman b1ec25fa 2012-05-10T17:16:24 Fix comment typo in common.h
Vicent Martí 40879fac 2012-05-02T15:59:02 Merge branch 'new-error-handling' into development Conflicts: .travis.yml include/git2/diff.h src/config_file.c src/diff.c src/diff_output.c src/mwindow.c src/path.c tests-clar/clar_helpers.c tests-clar/object/tree/frompath.c tests/t00-core.c tests/t03-objwrite.c tests/t08-tag.c tests/t10-refs.c tests/t12-repo.c tests/t18-status.c tests/test_helpers.c tests/test_main.c
Sven Strickroth c02f1392 2012-04-21T18:43:10 Check for _WIN32 is sufficient, even for x64 compilers There is no need to check for _WIN32 and _WIN64. x64 compiler also set _WIN32 (compare http://sourceforge.net/apps/mediawiki/predef/index.php?title=Operating_Systems#Windows). Signed-off-by: Sven Strickroth <email@cs-ware.de>
Russell Belfer 14a513e0 2012-04-13T15:00:29 Add support for pathspec to diff and status This adds preliminary support for pathspecs to diff and status. The implementation is not very optimized (it still looks at every single file and evaluated the the pathspec match against them), but it works.
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
Vicent Marti a15c550d 2011-11-16T14:09:44 threads: Fix the shared global state with TLS 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()`.
Sven Strickroth 314f54eb 2011-10-09T05:29:57 fix build for x64 Signed-off-by: Sven Strickroth <email@cs-ware.de>
Vicent Marti c060854e 2011-10-04T21:11:51 msvc: Properly handle inttypes.h/stdint.h
Vicent Martí e311519d 2011-09-18T19:38:14 Merge pull request #411 from boyski/gcc4 Don't use '__attribute__ visibility' with gcc unless it's at version 4 or better
David Boyce d2a1861e 2011-09-18T21:27:25 Don't use '__attribute__ visibility' with gcc unless it's at version 4 or better.
Vicent Marti 87d9869f 2011-09-19T03:34:49 Tabify everything 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 bb742ede 2011-09-19T01:54:32 Cleanup legal data 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 536955f9 2011-06-16T02:21:33 Add method to get the compiled version of the lib
Romain Geissler 0657e46d 2011-06-15T12:36:08 Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows. GIT_PATH_LIST_SEPARATOR and GIT_PATH_MAX are made public so that it's can be used by a client.
Jakob Pfender ee4912bf 2011-06-07T11:15:23 Revert "common: Include stat.h in include/git2/common.h instead of src/common.h" This reverts commit df1c98ab6d6171ed63729195bd190b54b67fe530. As 8a27b6b reverts the exposition of struct stat to the external API, we do not need - indeed, do not want - struct stat to be in the outer include layer.
Jakob Pfender cbf4f9f4 2011-05-25T16:31:14 common: Include stat.h in include/git2/common.h instead of src/common.h 00582bcb introduced a change to git_blob_create_fromfile() that required the caller to pass a stat struct. This means that we need to include stat.h higher in the hierarchy of includes.
Vicent Marti 6810bf28 2011-05-11T00:40:07 Move all error-related defines to `git2/errors.h`
kelly.leahy ab86f159 2011-05-09T23:39:32 Fix issue #79 - git_lasterror() isn't appearing in git2.dll in windows. The GIT_EXPORT macro is used to declare a function to be externally accessible to other libraries. This commit uses GIT_EXPORT to declare the git_lasterror() function as externally exported. I verified with depends.exe that the function is available to external callers (i.e. in the exports table of the PE file).
Vicent Marti fa59f18d 2011-05-09T20:54:04 Change error handling mechanism once again 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 5eb0fab8 2011-05-05T01:49:27 errors: Update external API with new `git_lasterror`
Carlos Martín Nieto 55c197cd 2011-04-11T17:41:21 Merge upstream/development
Vicent Marti c6e65aca 2011-04-09T15:22:11 Properly check `strtol` for errors We are now using a custom `strtol` implementation to make sure we're not missing any overflow errors.
Carlos Martín Nieto f026f2b9 2011-03-31T15:29:13 Merge upstream/development Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto baad182c 2011-03-28T11:31:58 Add GIT_EEXISTS error code Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto c7db45e8 2011-03-28T14:53:52 Match the comment with the error string Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 05314b5b 2011-03-29T12:25:46 Make GIT_EINVALIDTYPE available for use in config Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Jakob Pfender c585f55f 2011-03-23T12:35:08 common.h: Fix minor typos Fix a few minor typos in the documentation of the GIT_ERROR codes.
Vicent Marti 72a3fe42 2011-03-18T19:38:49 I broke your bindings 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 955f9ae9 2011-03-16T01:06:15 Export `git_strarray_free` instead of inlining That way non-C bindings can use it.
Vicent Marti 00571828 2011-03-12T16:04:46 Add new method `git_reference_listall` Lists all the references in a repository. Listing may be filtered by reference type. This should applease Lord Clem.
Vicent Marti 71d33382 2011-03-03T20:20:45 Move the external includes folder from `src` to `include` Signed-off-by: Vicent Marti <tanoku@gmail.com>