include/git2


Log

Author Commit Date CI Message
Vicent Martí e3f56a2b 2011-06-08T08:11:26 Merge pull request #216 from glesserd/development git_tag_create{,_o,_frombuffer} correction and improvement
Carlos Martín Nieto a2a305fc 2011-06-07T15:39:40 config: explain the cfg and file relationship better It's not clear how git_config and git_config_file relate to one another. Be more explicit about their relationship in the function documentation. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto ce78f39e 2011-06-07T14:18:22 config: update the git_config_add_file documentation Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
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 b74c867a 2011-06-07T11:11:09 blob: Stat path inside git_blob_create_fromfile 00582bc introduced a change that required the caller of git_blob_create_fromfile() to pass a struct stat with the stat information for the file. Several developers pointed out that this would make life hard for the bindings developers as struct stat isn't widely supported by other languages. Make git_blob_create_fromfile() stat the path itself, eliminating the need for the file to be stat'ed by the caller. This makes index_init_entry() more costly as the file will be stat'ed twice but makes life easier for everyone else.
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.
Jakob Pfender 4d7905c5 2011-05-25T16:04:29 blob: Require stat information for git_blob_create_fromfile() In order to be able to write symlinks with git_blob_create_fromfile(), we need to check whether the file to be written is a symbolic link or not. Since the calling function of git_blob_create_fromfile() is likely to have stated the file before calling, we make it pass the stat. The reason for this is that writing symbolic link blobs is significantly different from writing ordinary files - we do not want to open the link destination but instead want to write the link itself, regardless of whether it exists or not. Previously, index_init_entry() used to error out if the file to be added was a symlink that pointed to a nonexistent file. Fix this behaviour to add the file regardless of whether it exists. This mimics git.git's behaviour.
Vicent Marti 340fc0d4 2011-06-07T03:39:19 threads: Cleanup TLS declarations This time for good.
Vicent Marti 9d77d83a 2011-06-07T03:38:09 Revert "threads: Fix TLS declarations" This commit uploaded an old broken test. Oops!
Vicent Martí 1097dacd 2011-06-06T18:33:38 Merge pull request #240 from Romain-Geissler/tree-object-type Tree: Added a function that returns the type of a tree entry.
Vicent Martí 9b1692eb 2011-06-06T18:31:21 Merge pull request #239 from pegonma/oid_prefix Search objects of different types given OID prefix
Vicent Martí 1b0d92b1 2011-06-06T18:28:11 Merge pull request #238 from pegonma/git_oid_ncmp Better name for git_oid_match
Vicent Martí 00c31dd2 2011-06-06T18:26:50 Merge pull request #234 from Romain-Geissler/entry-count-API-uniformisation [Tree | Index] API uniformisation
Vicent Marti 64fe8c62 2011-06-07T03:22:32 threads: Fix TLS declarations Cleanup the thread-utils file. Do not define TLS if libgit2 is not threadsafe.
Romain Geissler ff9a4c13 2011-06-06T17:14:30 Tree: Added a function that returns the type of a tree entry.
Marc Pegon c09093cc 2011-06-06T10:55:36 Renamed git_oid_match to git_oid_ncmp. As suggested by carlosmn, git_oid_ncmp would probably be a better name than git_oid_match, for it does the same as git_oid_cmp but only up to a certain amount of hex digits.
Marc Pegon 790c6c95 2011-06-06T11:55:48 Added methods to search objects of different types given an OID prefix.
Romain Geissler f11e0797 2011-06-05T21:19:03 Index: API uniformisation: Use unsigned int for all index number. Feature Added: Search an unmerged entry by path (git_index_get_unmerged renamed to git_index_get_unmerged_bypath) or by index (git_index_get_unmerged_byindex).
Romain Geissler e5c80097 2011-06-05T21:18:05 Tree: API uniformasation: Use unsigned int for all index number.
Vicent Marti 602ee38b 2011-06-04T20:44:14 repository: Export all internal paths
David Glesser f4c925c5 2011-06-04T16:09:19 Change a dirty indentation
Vicent Martí 793545ef 2011-06-03T17:41:53 Merge pull request #227 from Romain-Geissler/discovery-path-v2 Discovery path v2
Romain Geissler fd0574e5 2011-06-04T01:01:20 Repository: Added the git_repository_discover function that finds by itself the git directory that manage a given directory path.
Vicent Marti 3a42e0a3 2011-06-03T21:38:55 index: Add `git_index_entry_stage` method As suggested by Romain-Geissler
Vicent Marti d0323a5f 2011-06-01T21:25:56 short-oid: Cleanup
Marc Pegon da03c9f3 2011-05-29T11:45:34 Changed return value of git_oid_match to be consistent with the other compare methods (0 means oids match). Added method to compare prefixes of hex formatted oids.
Marc Pegon ac2b94ad 2011-05-28T21:24:25 Added a GIT_OID_MINPREFIXLEN constant to define the minimum length allowed for oid prefixes (set to 4, like in git). Consequently updated some object lookup methods and their documentation.
Marc Pegon dd453c4d 2011-05-27T22:46:41 Added git.git sha1 lookup method to replace simple binary search in pack backend. Implemented find_unique_short_oid for pack backend, based on git sha1 lookup method; finding an object given its full oid is just a particular case of searching the unique object matching an oid prefix (short oid). Added git_odb_read_unique_short_oid, which iterates over all the backends to find and read the unique object matching the given oid prefix. Added a git_object_lookup_short_oid method to find the unique object in the repository matching a given oid prefix : it generalizes git_object_lookup which now does nothing but calls git_object_lookup_short_oid.
Marc Pegon 53c0bd81 2011-05-27T22:37:10 Added error for ambiguous oid prefixes. Added methods to compare the first nth hexadecimal characters (i.e. packets of 4 bits) of OIDs.
Marc Pegon ecd6fdf1 2011-05-27T18:49:09 Added a read_unique_short_oid method to backends, to make it possible to find objects from sha1 prefixes in the future. Default implementations throw GIT_ENOTIMPLEMENTED for strict prefixes (i.e. length < GIT_OID_HEXSZ).
Vicent Martí 50b7334e 2011-06-01T09:58:21 Merge pull request #206 from nulltoken/topic/is-bare Add git_repository_is_bare() accessor
Vicent Marti f7e59c4d 2011-06-01T18:34:21 index: Change the memory management for repo indexes The `git_repository_index` call now returns a brand new index that must be manually free'd.
Vicent Marti ef5ffed3 2011-06-01T18:23:36 object: Update documentation
David Glesser 23123151 2011-05-30T09:03:55 Set the oid when a tag already exists. When a tag already exists, it can be useful to directly have the oid of the existed tag, just after trying to add it.
nulltoken fa9bcd81 2011-05-24T21:48:07 Add git_repository_is_bare() accessor
Vicent Marti b0b527e0 2011-05-20T03:20:12 config: Cleanup & renaming of the external API "git_config_backend" have been renamed to "git_config_file", which implements a generic interface to access a configuration file -- be it either on disk, from a DB or whatever mumbojumbo. I think this makes more sense.
Vicent Martí 274f2c21 2011-05-19T14:18:57 Merge pull request #193 from carlosmn/config A couple of config improvements
Vicent Marti f4e2aca2 2011-05-19T20:38:17 index: Fix issues in the unmerged entries API
Jakob Pfender 050e8877 2011-05-17T15:31:05 Merge branch 'development' into unmerged
Carlos Martín Nieto f44cbec4 2011-05-17T14:59:23 Add documentation for git_config_add_backend
Carlos Martín Nieto 32234541 2011-05-17T14:18:42 Implement git_config_open_global Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 128d3731 2011-05-17T15:05:41 config_file: Fix compilation
Carlos Martín Nieto 94711cad 2011-05-17T12:12:59 Merge upstream/development
Vicent Marti f87d9beb 2011-05-15T23:46:39 Change error codes from DEFINEs to an enum
Vicent Marti f31bd03f 2011-05-13T04:15:46 Include "common.h" in "errors.h"
Vicent Marti 6810bf28 2011-05-11T00:40:07 Move all error-related defines to `git2/errors.h`
Vicent Marti f4a936b5 2011-05-11T00:35:05 Bring back `git_strerror` We cannot totally deprecate this until the new error handling mechanisms are all in place.
Carlos Martín Nieto c0335005 2011-05-06T12:42:47 Move config to a backend structure Configuration options can come from different sources. Currently, there is only support for reading them from a flat file, but it might make sense to read it from a database at some point. Move the parsing code into src/config_file.c and create an include file include/git2/config_backend.h to allow for other backends to be developed. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
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 5711ca93 2011-05-09T21:58:26 Merge branch 'error-handling' into development
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`
Vicent Marti 02f9e637 2011-05-05T01:12:17 errors: Add error handling function
Carlos Martín Nieto ca8d2dfc 2011-05-05T16:22:06 Merge remote-tracking branch 'upstream/development' into config
Jason R. McNeil 773bc20d 2011-05-03T22:22:42 Fix misspelling of git_index_append2 (was git_index_apppend2).
Vicent Marti 1648fbd3 2011-05-02T01:12:53 Re-apply missing patches
Vicent Marti f7a5058a 2011-04-24T00:31:43 index: Refactor add/replace methods Removed the optional `replace` argument, we now have 4 add methods: `git_index_add`: add or update from path `git_index_add2`: add or update from struct `git_index_append`: add without replacing from path `git_index_append2`: add without replacing from struct Yes, this breaks the bindings.
Jakob Pfender 4c0b6a6d 2011-04-21T10:54:54 index: Add API for unmerged entries New external functions: - git_index_unmerged_entrycount: Counts the unmerged entries in the index - git_index_get_unmerged: Gets an unmerged entry from the index by name New internal functions: - read_unmerged: Wrapper for read_unmerged_internal - read_unmerged_internal: Reads unmerged entries from the index if the index has the INDEX_EXT_UNMERGED_SIG set - unmerged_srch: Search function for unmerged vector - unmerged_cmp: Compare function for unmerged vector New data structures: - git_index now contains a git_vector unmerged that stores unmerged entries - git_index_entry_unmerged: Representation of an unmerged file entry. It represents all three versions of the file at the same time, with one name, three modes and three OIDs
Jakob Pfender 729b6f49 2011-04-21T10:40:54 index: Allow user to toggle whether to replace an index entry When in the middle of a merge, the index needs to contain several files with the same name. git_index_insert() used to prevent this by not adding a new entry if an entry with the same name already existed.
Carlos Martín Nieto e69ac243 2011-04-19T16:38:52 config: export git_config_[sg]et_long Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti def3fef1 2011-04-12T15:52:34 Add `git_tag_list` Lists all the tag references in a repository using a custom callback. Includes unit tests courtesy of Emeric Fermas <3
Carlos Martín Nieto 55c197cd 2011-04-11T17:41:21 Merge upstream/development
Jakob Pfender 1eb0f68e 2011-04-11T12:38:50 merge branch development
Vicent Marti 8416c9ad 2011-04-09T15:31:12 Rename `git_signature_new_now` The new name is more cool.
Carlos Martín Nieto 9e9e6ae1 2011-04-05T16:15:54 Add API git_signature_new_now Most tags will have a timestamp of whenever the code is running and dealing with time and timezones is error-prone. Optimize for this case by adding a function which causes the signature to be created with a current timestamp. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto b5c00c6d 2011-04-07T13:27:34 Fix the signature documentation The parameters are given by '@param name' and not '@name'. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken 4a34b3a9 2011-04-09T15:49:44 Add two new accessors to the repository git_repository_path() and git_repository_workdir() respectively return the path to the git repository and the working directory. Those paths are absolute and normalized.
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.
Vicent Marti 41233c40 2011-04-08T12:42:18 Add new method `git_repository_is_empty`
Jakob Pfender 26f2c897 2011-04-04T16:20:09 index.h: Add IDXENTRY flags needed for index operations Add several IDXENTRY flags that need to be checked in order to properly implement update-index --refresh.
Sam 5924b282 2011-04-06T10:48:31 Added git_commit_tree_oid and git_commit_parent_oid.
Jakob Pfender a5a546b3 2011-04-07T16:53:50 index.h: Correct values for extended flags As libgit2 separates an index entry's 32-bit flag into two 16-bit values flags and flags_extended, the values of flags_extended need to be adjusted.
Carlos Martín Nieto 8bd6c0ab 2011-04-06T15:49:29 Merge remote-tracking branch 'upstream/development' into config
Jakob Pfender 59f8f24f 2011-04-05T10:57:41 Merge branch 'development' into index-flags
Vicent Marti 0ad6efa1 2011-04-04T19:24:19 Build & write custom trees in memory
Jakob Pfender 7c7fcdae 2011-04-04T16:20:09 index.h: Add IDXENTRY flags needed for index operations Add several IDXENTRY flags that need to be checked in order to properly implement update-index --refresh.
Vicent Marti 29e1789b 2011-04-04T12:14:03 Fix the git_tree_write implementation
Sarath Lakshman 47d8ec56 2011-04-03T17:18:56 New external API method: `git_tree_create` Creates a tree by scanning the index file. The method handles recursive creation of trees for subdirectories and adds them to the parent tree.
Vicent Marti 3e3e4631 2011-04-02T12:49:14 Merge branch 'tagging' of https://github.com/nulltoken/libgit2 into development Conflicts: include/git2/tag.h src/tag.c
Vicent Marti d8ad64d3 2011-04-02T12:28:35 Merge branch 'parse-tag-buffer' of https://github.com/carlosmn/libgit2 into development
Carlos Martín Nieto f026f2b9 2011-03-31T15:29:13 Merge upstream/development Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken ac26e245 2011-03-30T23:46:54 Rename git_tag_create_o_f() to git_tag_create_fo()
nulltoken 9e680bcc 2011-03-30T23:26:36 Add git_tag_delete()
nulltoken a50c1458 2011-03-30T23:16:30 Add git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag reference, if any
nulltoken bf4c39f9 2011-03-30T22:30:55 Prevent tag_create() from creating a conflicting reference
Carlos Martín Nieto 2974aa94 2011-03-30T11:30:40 Determine variable type at runtime Config variables should be interpreted at run-time, as we don't know if a zero means false or zero, or if yes means true or "yes". As a variable has no intrinsic type, git_cvtype is gone and the public API takes care of enforcing a few rules. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 95cde17c 2011-03-29T19:22:21 Enforce coding conventions in refs.c Internal methods are static and without the git prefix. 'Force' methods have a `_f` prefix to match the other 'force' methods.
Carlos Martín Nieto 4cd6ed75 2011-03-28T15:05:02 Fix documentation copy error 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 fa204962 2011-03-28T12:00:50 Allow forcing the creation or renaming of references Add internal reference create and rename functions which take a force parameter, telling them to overwrite an existing reference if it exists. These functions try to update the reference if it's of the same type as the one it's going to be replaced by. Otherwise the old reference becomes invalid. 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 9a3c5e55 2011-03-29T17:44:10 Expose config API for setters, getters and foreach These functions can be used to query or modify the variables in a given configuration. No sanity checking is done on the variable names. This is mostly meant as an API preview. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 6d7bb4e0 2011-03-29T17:35:02 Move git_cvar_type to include/git2/config.h Include it in src/config.h and fix the header name #define. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 238df559 2011-03-29T12:29:21 Rename git_config_{type,var} to git_cvar{_type,} 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>
schu 9d80d74d 2011-03-28T17:57:08 signature.h: Fix tiny typo
Carlos Martín Nieto 5d4cd003 2011-03-28T17:02:45 Move the struct declaration outside config.c Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 7b4a16e2 2011-03-28T13:59:48 Add git_tag_create_frombuffer API Expose the tag parsing capabilities already present in the library. Exporting this function makes it possible to implement the mktag command without duplicating this functionality. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 09e8de0f 2011-03-25T23:53:38 New external API method: `git_reference_listcb` List all the references in the repository, calling a custom callback for each one. The listed references may be filtered by type, or using a bitwise OR of several types. Use the magic value `GIT_REF_LISTALL` to obtain all references, including packed ones. The `callback` function will be called for each of the references in the repository, and will receive the name of the reference and the `payload` value passed to this method.
Jakob Pfender 051d6915 2011-03-24T18:28:04 index.h: Fix minor typo