summaryrefslogtreecommitdiff
path: root/src/commit.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix broken build when MSVC SDL checks is enabledLinquize2013-05-111-1/+1
|
* commit: make create_from_oids() accept plain oidnulltoken2013-05-051-1/+0
|
* commit: guard create() against not owned treesnulltoken2013-05-051-0/+1
|
* Simplify object table parse functionsRussell Belfer2013-04-221-1/+3
| | | | | This unifies the object parse functions into one signature that takes an odb_object.
* Add callback to git_objects_tableRussell Belfer2013-04-221-11/+5
| | | | | | | | | | This adds create and free callback to the git_objects_table so that more of the creation and destruction of objects can be table driven instead of using switch statements. This also makes the semantics of certain object creation functions consistent so that we can make better use of function pointers. This also fixes a theoretical error case where an object allocation fails and we end up storing NULL into the cache.
* Use git_odb_object_data/_size whereever possibleRussell Belfer2013-04-221-1/+2
| | | | | This uses the odb object accessors so we can change the internals more easily...
* What has science done.Vicent Marti2013-04-221-1/+1
|
* Move git_commit_create_from_oids into sys/commit.hRussell Belfer2013-04-211-38/+43
| | | | | | | | Actually this renames git_commit_create_oid to git_commit_create_from_oids and moves the API declaration to include/git2/sys/commit.h since it is a dangerous API for general use (because it doesn't check that the OID list items actually refer to real objects).
* Added git_commit_create_oidJohn Wiegley2013-04-211-10/+40
|
* commit: correctly detect the start of the commit messageCarlos Martín Nieto2013-04-151-2/+2
| | | | | | | | | The end of the header is signaled by to consecutive LFs and the commit message starts immediately after. Jumping over LFs at the start of the message is a bug and leads to creating different commits if when rebuilding history. This also fixes an empty commit message being returned as "\n".
* Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-1/+1
| | | | | | | Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0
* immutable references and a pluggable ref databaseEdward Thomson2013-03-071-1/+1
|
* Vector improvements and their falloutPhilip Kelley2013-01-271-1/+2
|
* commit: don't include the LF in the header field valueCarlos Martín Nieto2013-01-201-2/+3
| | | | | | | | | When the encoding header changed to be treated as an additional header, the EOL pointer started to point to the byte after the LF, making the git__strndup call copy the LF into the value. Increase the EOL pointer value after copying the data to keep the rest of the semantics but avoid copying LF.
* Add skipping of unknown commit headersRussell Belfer2013-01-171-14/+16
| | | | | | | | This moves the check for the "encoding" header into a loop which is just scanning for non-required headers at the end of a commit header. That loop will skip unrecognized lines (including header continuation lines) until a terminating completely blank line is found, and only then does it move to reading the commit message.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* More external API cleanupVicent Marti2012-11-271-29/+24
| | | | | | Conflicts: src/branch.c tests-clar/refs/branches/create.c
* portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-1/+1
|
* commit: introduce git_commit_nth_gen_ancestor()nulltoken2012-07-121-0/+34
|
* commit: reduce code duplicationnulltoken2012-07-121-10/+9
|
* Fix broken tests caused by no longer prettifying by defaultTim Clem2012-06-151-5/+2
|
* Kill message_prettify - we will export insteadTim Clem2012-06-151-4/+0
|
* Don't strip comments (#) from commit messages by defaultTim Clem2012-06-151-1/+1
|
* Add git_reset()nulltoken2012-06-071-61/+1
| | | | Currently supports Soft and Mixed modes.
* CleanupMichael Schubert2012-05-191-9/+0
| | | | | | | * indexer: remove leftover printf * commit: remove unused macros COMMIT_BASIC_PARSE, COMMIT_FULL_PARSE and COMMIT_PRINT
* commit/tag: ensure the message is cleaned upnulltoken2012-05-071-3/+11
| | | | | | 'git commit' and 'git tag -a' enforce some conventions, like cleaning up excess whitespace and making sure that the last line ends with a '\n'. This fix replicates this behavior. Fix libgit2/libgit2sharp#117
* error handling: move the missing parts over to the new error handlingCarlos Martín Nieto2012-04-261-2/+4
|
* Fix compilation errors and warningsnulltoken2012-04-111-9/+4
|
* error-handling: Commit (WIP)Vicent Martí2012-04-021-79/+104
|
* error-handling: RepositoryVicent Martí2012-03-071-1/+1
| | | | | | | | This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
* commit: actually allow yet to be born update_refschu2012-02-151-3/+7
| | | | | | | | git_commit_create is supposed to update the given reference "update_ref", but segfaulted in case of a yet to be born reference. Fix it. Signed-off-by: schu <schu-github@schulog.org>
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Use git_buf for path storage instead of stack-based buffersRussell Belfer2011-12-071-1/+2
| | | | | | | | | | | | | | | | | | | | This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
* repository: Change ownership semanticsVicent Marti2011-11-261-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Free all used references in the source treeschu2011-11-061-2/+13
| | | | | | | Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
* refs: split internal and external referencesschu2011-11-061-2/+3
| | | | | | | | | | | | | | | | | Currently libgit2 shares pointers to its internal reference cache with the user. This leads to several problems like invalidation of reference pointers when reordering the cache or manipulation of the cache from user side. Give each user its own git_reference instead of leaking the internal representation (struct reference). Add the following new API functions: * git_reference_free * git_reference_is_packed Signed-off-by: schu <schu-github@schulog.org>
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-5/+5
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* commit: properly parse empty commit messagesBrodie Rao2011-10-121-2/+2
| | | | | | | | | This ensures commit->message is always non-NULL, even if the commit message is empty or consists of only a newline. One such commit can be found in the wild in the jQuery repository: https://github.com/jquery/jquery/commit/25b424134f9927a5bf0bab5cba836a0aa6c3cfc1
* Merge pull request #384 from kiryl/warningsVicent Martí2011-09-181-2/+2
|\ | | | | Add more -W flags to CFLAGS
| * CMakefile: add -Wmissing-prototypes and fix warningsKirill A. Shutemov2011-08-301-2/+2
| | | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* | Cleanup legal dataVicent Marti2011-09-191-21/+3
|/ | | | | | | | | | 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.
* Drop STRLEN() macrosKirill A. Shutemov2011-08-251-1/+1
| | | | | | | There is no need in STRLEN macros. Compilers can do this trivial optimization on its own. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* commit: Add support for Encoding headerVicent Marti2011-08-121-30/+30
|
* commit: fix cast warningsKirill A. Shutemov2011-07-251-2/+2
| | | | | | | | /home/kas/git/public/libgit2/src/commit.c: In function ‘commit_parse_buffer’: /home/kas/git/public/libgit2/src/commit.c:186:23: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/commit.c:187:27: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* reflog: Fix reflog writer/readernulltoken2011-07-101-2/+2
| | | | | | - Use a space to separate oids and signature - Enforce test coverage - Make test run in a temporary folder in order not to alter the test repository
* Remove unused methodsVicent Marti2011-07-091-2/+2
| | | | | | | | | The direct-writes commit left some (slow) internals methods that were no longer needed. These have been removed. Also, the Reflog code was using the old `git_signature__write`, so it has been rewritten to use a normal buffer and the new `writebuf` signature writer. It's now slightly simpler and faster.
* odb: Direct writes are backVicent Marti2011-07-091-34/+21
| | | | | | | | | | | | | | | | | | | | | | DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the ODB was an overkill for the smaller objects like Commit and Tags; most of the streaming logic was taking too long. This commit makes Commits, Tags and Trees to be built-up in memory, and then written to disk in 2 pushes (header + data), instead of streaming everything. This is *always* faster, even for big files (since the git_filebuf class still does streaming writes when the memory cache overflows). This is also a gazillion lines of code smaller, because we don't have to precompute the final size of the object before starting the stream (this was kind of defeating the point of streaming, anyway). Blobs are still written with full streaming instead of loading them in memory, since this is still the fastest way. A new `git_buf` class has been added. It's missing some features, but it'll get there.
* signature: Fix optional headerVicent Marti2011-07-091-2/+2
|
* Remove redundant methods from the APIVicent Marti2011-06-281-73/+17
| | | | | | | | | | | | | | | A bunch of redundant methods have been removed from the external API. - All the reference/tag creation methods with `_f` are gone. The force flag is now passed as an argument to the normal create methods. - All the different commit creation methods are gone; commit creation now always requires a `git_commit` pointer for parents and a `git_tree` pointer for tree, to ensure that corrupted commits cannot be generated. - All the different tag creation methods are gone; tag creation now always requires a `git_object` pointer to ensure that tags are not created to inexisting objects.
* Changed commit short messages so that they match git log --oneline output.Marc Pegon2011-06-081-4/+11
| | | | In git, the short message of a commit is the part of the commit message before 2 consecutive line breaks. In the short message, line breaks are replaced by space characters.