summaryrefslogtreecommitdiff
path: root/src/oid.c
Commit message (Collapse)AuthorAgeFilesLines
* git_oid_fromstrn: Simplify the implementation and fix memory access issuesJiri Pospisil2014-03-071-15/+9
|
* Make git_oid_equal a non-inline APIRussell Belfer2014-02-201-0/+5
|
* oid: handle NULL pointers passed to git_oid_shorten_free()Brodie Rao2014-01-121-0/+3
| | | | Signed-off-by: Brodie Rao <brodie@sf.io>
* Fix warningLinquize2013-09-191-1/+1
|
* oid: git_oid_shorten_add() sets GITERR_INVALID when OID set is fullLinquize2013-08-311-3/+12
|
* Merge pull request #1595 from arrbee/even-more-rename-fixesVicent Martí2013-05-241-19/+27
|\ | | | | Even more rename detection fixes
| * Add git_oid_nfmt - a flexible OID formatterRussell Belfer2013-05-171-19/+27
| | | | | | | | | | | | I frequently want to the the first N digits of an OID formatted as a string and I'd like it to be efficient. This function makes that easy and I could rewrite the OID formatters in terms of it.
* | Bugfix: Return NULL in push_leaf, when trie is fullAxel Wagner2013-05-221-1/+3
|/ | | | | os->full was set 1, but the overflowed idx_leaf was still used to index into os->nodes a little later. Returning NULL fixes that.
* Make git_oid_cmp public and add git_oid__cmpRussell Belfer2013-04-291-2/+2
|
* Add git_oid_strcmp and use it for git_oid_streqRussell Belfer2013-04-291-5/+22
| | | | | | | | Add a new git_oid_strcmp that compares a string OID with a hex oid for sort order, and then reimplement git_oid_streq using it. This actually should speed up git_oid_streq because it only reads as far into the string as it needs to, whereas previously it would convert the whole string into an OID and then use git_oid_cmp.
* Fix fragile git_oid_ncmpRussell Belfer2013-04-291-2/+5
| | | | | | | git_oid_ncmp was making some assumptions about the length of the data - this shifts the check to the top of the loop so it will work more robustly, limits the max, and adds some tests to verify the functionality.
* Introduce git_oid_compare, an exported oid cmpRussell Belfer2013-04-291-0/+5
|
* oid: Do not parse OIDs longer than 40Vicent Marti2013-03-251-1/+1
|
* git_oid_fromstrn already sets a maximum on the length of the stringXavier L2013-03-211-1/+1
|
* Added an oid function that accepts nul-terminated stringsXavier L2013-03-211-0/+5
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix oid tostr issue with NULL oidRussell Belfer2013-01-041-1/+4
| | | | | I made a small change to the behavior of this code and apparently got it wrong. Sigh.
* Make git_oid_tostr use out buffer for NULL oidRussell Belfer2013-01-041-2/+2
| | | | | | Previously a NULL oid was handled like an empty buffer and returned a status empty string. This makes git_oid_tostr() set the output buffer to the empty string instead.
* Remove use of English expletivesMartin Woodward2012-11-231-1/+1
| | | | | | Remove words such as fuck, crap, shit etc. Remove other potentially offensive words from comments. Tidy up other geopolicital terms in comments.
* Revparse: GIT_EAMBIGUOUSBen Straub2012-08-251-3/+0
| | | | Revparse now returns EAMBIGUOUS if the the spec doesn't match any refs/tags, and is <4 characters.
* Merge remote-tracking branch 'nulltoken/topic/amd64-compat' into developmentVicent Marti2012-08-021-1/+1
|\ | | | | | | | | | | | | Conflicts: src/netops.c src/netops.h src/oid.c
| * portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-1/+1
| |
* | git_oid_cmp: inline memcmp by hand to optimizeMichael Schubert2012-07-291-5/+0
|/ | | | | | | | | git.git uses an inlined hashcmp function instead of memcmp, since it performes much better when comparing hashes (most hashes compared diverge within the first byte). Measurements and rationale for the curious reader: http://thread.gmane.org/gmane.comp.version-control.git/172286
* Merge branch 'new-error-handling' into developmentVicent Martí2012-05-021-35/+42
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-5/+8
| | | | | | | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
| * error-handling: Commit (WIP)Vicent Martí2012-04-021-3/+3
| |
| * Migrate index, oid, and utils to new errorsRussell Belfer2012-03-191-30/+34
| | | | | | | | | | | | | | | | | | | | | | | | This includes a few cleanups that came up while converting these files. This commit introduces a could new git error classes, including the catchall class: GITERR_INVALID which I'm using as the class for invalid and out of range values which are detected at too low a level of library to use a higher level classification. For example, an overflow error in parsing an integer or a bad letter in parsing an OID string would generate an error in this class.
* | Rename git_oid_to_string to git_oid_tostrAuthmillenon2012-03-061-1/+1
|/ | | | | To conform the naming scheme of git_oid_fromstr we should change the name of git_oid_to_string to git_oid_tostr.
* Update diff to use iteratorsRussell Belfer2012-03-021-0/+10
| | | | | | | | | | | | | This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* util: add git__fromhex()nulltoken2011-12-281-23/+5
|
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-4/+4
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* oid: Add git_oid_streq() which checks if an oid and an hex formatted string ↵nulltoken2011-10-131-0/+11
| | | | are equal
* oid: add missing check to git_oid_fromstrnJ. David Ibáñez2011-10-021-0/+3
| | | | Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
* oid: now git_oid_fromstrn checks whether the given string is too shortJ. David Ibáñez2011-09-301-0/+3
| | | | Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
* oid: optimize git_oid_fromstrn by using memsetJ. David Ibáñez2011-09-301-2/+1
| | | | Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
* oid: make git_oid_fromstrn support hex strings of odd lengthJ. David Ibáñez2011-09-301-5/+9
| | | | | | This fixes issue #433. Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
* Tabify everythingVicent Marti2011-09-191-3/+3
| | | | | | 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-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.
* Remove unused methodsVicent Marti2011-07-091-15/+1
| | | | | | | | | 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-0/+10
| | | | | | | | | | | | | | | | | | | | | | 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.
* index: Return `GIT_ENOTFOUND` when an entry cannot be openedVicent Marti2011-07-091-0/+3
|
* cleanup: remove trailing spacesKirill A. Shutemov2011-07-011-1/+1
| | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* Remove redundant methods from the APIVicent Marti2011-06-281-5/+23
| | | | | | | | | | | | | | | 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.
* oid: Uniformize ncmp methodsVicent Marti2011-06-161-23/+17
| | | | Drop redundant methods. The ncmp method is now public
* oid: Rename methodsVicent Marti2011-06-161-3/+3
| | | | | Yeah. Finally. Fuck the old names, this ain't POSIX and they don't make any sense at all.
* fix gid_ misspellingScott Chacon2011-06-141-1/+1
|
* Renamed git_oid_match to git_oid_ncmp.Marc Pegon2011-06-061-4/+4
| | | | | | 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.
* Changed return value of git_oid_match to be consistent with the other ↵Marc Pegon2011-06-011-3/+8
| | | | compare methods (0 means oids match). Added method to compare prefixes of hex formatted oids.
* Added error for ambiguous oid prefixes. Added methods to compare the first ↵Marc Pegon2011-06-011-0/+20
| | | | nth hexadecimal characters (i.e. packets of 4 bits) of OIDs.