summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* global: Deploy hallochallocVicent Marti2011-10-281-6/+8
|
* global: Properly use `git__` memory wrappersVicent Marti2011-10-2847-268/+270
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* tree: Add traversal in post-orderVicent Marti2011-10-271-2/+54
|
* Merge branch 'status' of https://github.com/carlosmn/libgit2 into developmentVicent Marti2011-10-271-37/+17
|\
| * status: move GIT_STATUS_PATH_* into an enumCarlos Martín Nieto2011-10-271-7/+9
| | | | | | | | | | | | Their actual values have no meaning, so pack them in an enum. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * status: reorder retrieve_head_tree error checksCarlos Martín Nieto2011-10-271-4/+2
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * status: remove git_tree_entry_byposCarlos Martín Nieto2011-10-271-14/+5
| | | | | | | | | | | | | | The only caller has been changed to treat a NULL tree as a special case and use the existing git_tree_entry_byindex. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * status: remove git_index_entry_byposCarlos Martín Nieto2011-10-271-12/+1
| | | | | | | | | | | | | | This function is already implemented (better) as git_index_get. Change the only caller to use that function. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Merge pull request #467 from oleganza/oa-config-parse-fixVicent Martí2011-10-271-2/+8
|\ \ | |/ |/| Fixed crash in config parser when empty value is encountered.
| * Fixed crash in config parser when empty value is encountered.Oleg Andreev2011-10-271-2/+8
| | | | | | | | | | | | | | | | | | Example: key1 = value1 key2 = In this config the value will be a bad pointer which config object will attempt to free() causing a crash.
* | windows: Add support for non-UTF codepagesVicent Marti2011-10-266-28/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our previous assumption that all paths in Windows are encoded in UTF-8 is rather weak, specially when considering that Git is encoding-agnostic. These set of functions allow the user to change the library's active codepage globally, so it is possible to access paths and files on all international versions of Windows. Note that the default encoding here is UTF-8 because we assume that 99% of all Git repositories will be in UTF-8. Also, if you use non-ascii characters in paths, anywhere, please burn on a fire.
* | Tolerate zlib deflation with window size < 32KbRoberto Tyley2011-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 currently identifies loose objects as corrupt if they've been deflated using a window size less than 32Kb, because the is_zlib_compressed_data() function doesn't recognise the header byte as a zlib header. This patch makes the method tolerant of all valid window sizes (15-bit to 8-bit) - but doesn't sacrifice it's accuracy in distingushing the standard loose-object format from the experimental (now abandoned) format. It's based on a patch which has been merged into C-Git master branch: https://github.com/git/git/commit/7f684a2aff636f44a506 On memory constrained systems zlib may use a much smaller window size - working on Agit, I found that Android uses a 4KB window; giving a header byte of 0x48, not 0x78. Consequently all loose objects generated by the Android platform appear 'corrupt' :( It might appear that this patch changes isStandardFormat() to the point where it could incorrectly identify the experimental format as the standard one, but the two criteria (bitmask & checksum) can only give a false result for an experimental object where both of the following are true: 1) object size is exactly 8 bytes when uncompressed (bitmask) 2) [single-byte in-pack git type&size header] * 256 + [1st byte of the following zlib header] % 31 = 0 (checksum) As it happens, for all possible combinations of valid object type (1-4) and window bits (0-7), the only time when the checksum will be divisible by 31 is for 0x1838 - ie object type *1*, a Commit - which, due the fields all Commit objects must contain, could never be as small as 8 bytes in size. Given this, the combination of the two criteria (bitmask & checksum) always correctly determines the buffer format, and is more tolerant than the previous version. References: Android uses a 4KB window for deflation: http://android.git.kernel.org/?p=platform/libcore.git;a=blob;f=luni/src/main/native/java_util_zip_Deflater.cpp;h=c0b2feff196e63a7b85d97cf9ae5bb258 Code snippet searching for false positives with the zlib checksum: https://gist.github.com/1118177 Change-Id: Ifd84cd2bd6b46f087c9984fb4cbd8309f483dec0
* | tree: Fix name lookups once and for allVicent Marti2011-10-201-45/+85
| | | | | | | | Double-pass binary search. Jeez.
* | tree: Fix lookups by entry nameVicent Marti2011-10-191-2/+11
| |
* | mwindow: close LRU window properlyCarlos Martín Nieto2011-10-151-5/+12
| | | | | | | | | | | | | | | | | | | | | | Remove a wrong call to git_mwindow_close which caused a segfault if it ever did run. In that same piece of code, if the LRU was from the first wiindow in the list in a different file, we didn't update that list, so the first element had been freed. Fix these two issues. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | tree: Add git_tree_frompath() which, given a relative path to a tree entry, ↵nulltoken2011-10-131-0/+45
| | | | | | | | retrieves the tree object containing this tree entry
* | oid: Add git_oid_streq() which checks if an oid and an hex formatted string ↵nulltoken2011-10-131-0/+11
| | | | | | | | are equal
* | Fix compilation error on Windowsnulltoken2011-10-131-1/+0
| |
* | Merge pull request #454 from brodie/parsing-fixesVicent Martí2011-10-133-11/+12
|\ \ | | | | | | Improvements to tag, commit, and signature parsing
| * | signature: don't blow up trying to parse names containing '>'Brodie Rao2011-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to find the end of an email, instead of starting at the beginning of the signature, we start at the end of the name (after the first '<'). This brings libgit2 more in line with Git's behavior when reading out existing signatures. However, note that Git does not allow names like these through the usual porcelain; instead, it silently strips any '>' characters it sees.
| * | tag: allow the tagger field to be missing when parsing tagsBrodie Rao2011-10-121-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of bailing out with an error, this sets tagger to NULL when the field is missing from the object. This makes it possible to inspect tags like this one: http://git.kernel.org/?p=git/git.git;a=tag;h=f25a265a342aed6041ab0cc484224d9ca54b6f41
| * | tag: avoid a double-free when parsing tags without a tagger fieldBrodie Rao2011-10-121-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The v0.99 tag in the Git repo triggers this behavior: http://git.kernel.org/?p=git/git.git;a=tag;h=d6602ec5194c87b0fc87103ca4d67251c76f233a Ideally, we'd allow the tag to be instantiated even though the tagger field is missing, but this at the very least prevents libgit2 from crashing. To test this bug, a new repository has been added based on the test branch in testrepo.git. It contains a "e90810b" tag that looks like this: object e90810b8df3e80c413d903f631643c716887138d type commit tag e90810b This is a very simple tag.
| * | 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 #455 from brodie/pack-fixesVicent Martí2011-10-131-1/+1
|\ \ | | | | | | odb_pack: don't do ambiguity checks for fully qualified SHA1 hashes
| * | odb_pack: don't do ambiguity checks for fully qualified SHA1 hashesBrodie Rao2011-10-121-1/+1
| |/ | | | | | | | | | | | | | | This makes libgit2 more closely match Git, which only checks for ambiguous pack entries when given short hashes. Note that the only time this is ever relevant is when a pack has the same object more than once (it's happened in the wild, I promise).
* | pkt: move the protocol strings to the top of the fileCarlos Martín Nieto2011-10-121-17/+14
| | | | | | | | | | | | Put them all together so we know where to find them. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Move the transports to their own directoryCarlos Martín Nieto2011-10-123-0/+0
| |
* | net: plug a few memory leaksCarlos Martín Nieto2011-10-122-2/+17
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: download pack when fetchingCarlos Martín Nieto2011-10-121-12/+123
| | | | | | | | | | | | | | Unfortunately, we can't use the function in fetch.c due to chunked encoding and keep-alive connections. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | remote: bitfield should be unsignedCarlos Martín Nieto2011-10-121-1/+1
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | git transport: don't loose received dataCarlos Martín Nieto2011-10-121-83/+38
| | | | | | | | | | | | | | | | | | Using a different buffer in each function means that some data might get lost. Store all the data in a buffer in the transport object. Take this opportunity to use the generic download-pack function. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | fetch: add a generic pack-download functionCarlos Martín Nieto2011-10-122-0/+63
| | | | | | | | | | | | | | Taken mostly from the git transport's version, this can be used by any transport that takes its pack data from the network. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | pkt: get rid of the chunked supportCarlos Martín Nieto2011-10-124-54/+17
| | | | | | | | | | | | It was a bad idea. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: simple negotiationCarlos Martín Nieto2011-10-122-27/+58
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Introduce the git_pkt_buffer_ family of functionsCarlos Martín Nieto2011-10-122-21/+87
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: parse the response from the serverCarlos Martín Nieto2011-10-122-11/+109
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: add a set of common refsCarlos Martín Nieto2011-10-121-14/+40
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: move stuff out of negotiate_fetchCarlos Martín Nieto2011-10-121-44/+62
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | transport: don't have an extra send-wants stepCarlos Martín Nieto2011-10-125-68/+19
| | | | | | | | | | | | | | It's a bit awkward to run it as an extra step, and HTTP may need to send the wants list several times. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: Start negotiate_fetchCarlos Martín Nieto2011-10-121-0/+92
| |
* | net,pkt: add chunked supportCarlos Martín Nieto2011-10-125-26/+72
| | | | | | | | | | | | | | | | | | As we don't know the length of the message we want to send to the other end, we send a chunk size before each message. In later versions, sending the wants might benefit from batching the lines together. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | http: add more modularity to the codeCarlos Martín Nieto2011-10-121-46/+47
| | | | | | | | | | | | | | | | Not every request needs a new connection if we're using a keep-alive connection. Store the HTTP parser, host and port in the transport in order to have it available in later calls. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Merge pull request #449 from csware/include-win-version-informationVicent Martí2011-10-121-0/+42
|\ \ | | | | | | Include windows version information in git2.dll
| * | include version information in git2.dll on WindowsSven Strickroth2011-10-091-0/+42
| |/ | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | fetch: move 'head' so it's visible to the whole functionCarlos Martín Nieto2011-10-091-1/+2
| | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | Merge pull request #444 from carlosmn/fetch-fixesVicent Martí2011-10-095-11/+45
|\ \ | |/ |/| A couple of fetch fixes
| * fetch: store FETCH_HEADCarlos Martín Nieto2011-10-084-5/+37
| | | | | | | | | | | | We should always save the remote's HEAD as FETCH_HEAD locally. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * A missing refspec is not an errorCarlos Martín Nieto2011-10-082-7/+9
| | | | | | | | | | | | | | It's rare for a configured remote, but for one given as an URL on the command line, it's more often than not the case. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* | msvc: Properly handle inttypes.h/stdint.hVicent Marti2011-10-054-73/+38
| |
* | indexer: NUL-terminate the filenameCarlos Martín Nieto2011-10-051-2/+2
| | | | | | | | | | | | | | As we no longer use the STRLEN macro, the NUL-terminator in the string was not copied over. Fix this. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>