|
11d51ca6
|
2011-10-26T16:43:55
|
|
windows: Add support for non-UTF codepages
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.
|
|
c51065e3
|
2011-10-24T14:39:03
|
|
Tolerate zlib deflation with window size < 32Kb
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
|
|
28c1451a
|
2011-10-20T02:35:19
|
|
tree: Fix name lookups once and for all
Double-pass binary search. Jeez.
|
|
8cf2de07
|
2011-10-19T01:34:42
|
|
tree: Fix lookups by entry name
|
|
5fa1bed0
|
2011-10-15T23:09:05
|
|
mwindow: close LRU window properly
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>
|
|
3fa735ca
|
2011-10-13T23:17:19
|
|
tree: Add git_tree_frompath() which, given a relative path to a tree entry, retrieves the tree object containing this tree entry
|
|
34aff010
|
2011-10-12T14:06:23
|
|
oid: Add git_oid_streq() which checks if an oid and an hex formatted string are equal
|
|
a41e9f13
|
2011-10-13T22:48:07
|
|
Fix compilation error on Windows
|
|
5c3d5fb0
|
2011-10-13T12:16:07
|
|
Merge pull request #454 from brodie/parsing-fixes
Improvements to tag, commit, and signature parsing
|
|
a3e23a7c
|
2011-10-13T12:01:06
|
|
Merge pull request #455 from brodie/pack-fixes
odb_pack: don't do ambiguity checks for fully qualified SHA1 hashes
|
|
b2a2702d
|
2011-10-11T22:05:12
|
|
odb_pack: don't do ambiguity checks for fully qualified SHA1 hashes
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).
|
|
6f2856f3
|
2011-10-05T15:17:37
|
|
signature: don't blow up trying to parse names containing '>'
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.
|
|
15b0bed2
|
2011-08-11T16:12:29
|
|
tag: allow the tagger field to be missing when parsing tags
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
|
|
cf7b13f3
|
2011-08-11T14:05:55
|
|
tag: avoid a double-free when parsing tags without a tagger field
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.
|
|
04f78802
|
2011-08-09T20:49:12
|
|
commit: properly parse empty commit messages
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
|
|
3707b331
|
2011-10-08T02:44:31
|
|
pkt: move the protocol strings to the top of the file
Put them all together so we know where to find them.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
dfafb03b
|
2011-10-07T00:44:41
|
|
Move the transports to their own directory
|
|
03e4833b
|
2011-10-05T20:17:21
|
|
remote: bitfield should be unsigned
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
fc3e3c55
|
2011-10-05T20:12:12
|
|
git transport: don't loose received data
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>
|
|
2c982daa
|
2011-10-05T20:09:49
|
|
fetch: add a generic pack-download function
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>
|
|
51760bc1
|
2011-10-05T18:11:22
|
|
pkt: get rid of the chunked support
It was a bad idea.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
e5e92c1f
|
2011-10-05T16:57:34
|
|
http: simple negotiation
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
65c86048
|
2011-10-05T01:28:16
|
|
Introduce the git_pkt_buffer_ family of functions
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
f9613325
|
2011-10-05T00:42:27
|
|
http: parse the response from the server
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
cbb2fede
|
2011-09-27T00:34:52
|
|
http: add a set of common refs
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
3313a05a
|
2011-09-18T21:11:45
|
|
http: move stuff out of negotiate_fetch
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
8c252874
|
2011-10-06T00:51:32
|
|
net: plug a few memory leaks
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
546a3c8f
|
2011-10-06T00:10:11
|
|
http: download pack when fetching
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>
|
|
1636ba5a
|
2011-09-18T20:07:49
|
|
transport: don't have an extra send-wants step
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>
|
|
747bf5f1
|
2011-09-13T23:28:42
|
|
http: Start negotiate_fetch
|
|
34bfb4b0
|
2011-09-14T00:54:45
|
|
net,pkt: add chunked support
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>
|
|
eb07a4d1
|
2011-09-12T15:25:45
|
|
http: add more modularity to the code
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>
|
|
92e2081f
|
2011-10-12T11:03:58
|
|
Merge pull request #449 from csware/include-win-version-information
Include windows version information in git2.dll
|
|
8f9be316
|
2011-10-09T21:49:10
|
|
fetch: move 'head' so it's visible to the whole function
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
6aac5afb
|
2011-10-09T12:09:57
|
|
Merge pull request #444 from carlosmn/fetch-fixes
A couple of fetch fixes
|
|
cf9bf6b7
|
2011-10-09T18:45:23
|
|
include version information in git2.dll on Windows
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
517bda19
|
2011-10-04T00:30:01
|
|
fetch: store FETCH_HEAD
We should always save the remote's HEAD as FETCH_HEAD locally.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
4a3b18a6
|
2011-10-03T22:26:06
|
|
A missing refspec is not an error
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>
|
|
c060854e
|
2011-10-04T21:11:51
|
|
msvc: Properly handle inttypes.h/stdint.h
|
|
72d6a20b
|
2011-10-05T19:59:34
|
|
indexer: NUL-terminate the filename
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>
|
|
24ce105b
|
2011-10-03T14:42:52
|
|
Merge pull request #441 from csware/ignore-missing-pack-file
ignore missing pack file
|
|
ef1e5da1
|
2011-10-03T14:40:06
|
|
Merge pull request #438 from jdavid/development
Make git_oid_fromstrn support hex strings of odd length
|
|
599297fd
|
2011-10-03T23:12:43
|
|
ignore missing pack file as git does
See http://code.google.com/p/tortoisegit/issues/detail?id=862
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
0e058e78
|
2011-10-02T21:40:57
|
|
oid: add missing check to git_oid_fromstrn
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
cd19ca95
|
2011-10-01T20:16:13
|
|
Squelch a couple of warnings
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
9ac581bf
|
2011-10-01T19:56:04
|
|
config: behave like git with [section.subsection]
The documentation is a bit misleading. The subsection name is always
case-sensitive, but with a [section.subsection] header, the subsection
is transformed to lowercase when the configuration is parsed.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
92be7908
|
2011-10-01T14:46:30
|
|
indexer: return immediately if passed a NULL value
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
922bc225
|
2011-10-01T14:34:51
|
|
pkt: send all of the wants in the negotiation
A missing if caused the function to return after the first want line
without capabilities.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
7ad994bb
|
2011-10-01T13:41:16
|
|
transport-git: fix git request length calculation
There was an off-by-one error that was uncovered when we used the
right length from git_buf.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
10063aeb
|
2011-10-01T13:10:29
|
|
transport-git: Encapsulation ist gut
|
|
657ce4b5
|
2011-10-01T12:58:55
|
|
http-transport: Properly cleanup the WSA context
|
|
1e5b2635
|
2011-10-01T12:58:17
|
|
http-transport: Update copyright
|
|
bad53552
|
2011-09-30T23:48:27
|
|
netops: abstract away socket closing
Winsock wants us to use closesocket() instead of close(), so introduce
the gitno_close function, which does the right thing.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
a2888919
|
2011-09-30T18:35:33
|
|
local transport: don't segfault on wrong URL
memset the structure on initialisation and don't try to dereference
the vector with the heads if we didn't find a repository.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
ccc9872d
|
2011-09-30T17:21:30
|
|
Initialise the winsock DLL
Windows wants us to initialise the networking DLL before we're allowed
to send data through a socket. Call WSASetup and WSACleanup if
GIT_WIN32 is defined.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
a95aeb48
|
2011-09-30T16:55:05
|
|
Use git_buf in the git request
This is clearer and sidesteps the issue of what the return value of
snprintf is on the particular OS we're running on.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
b9caa185
|
2011-09-30T19:50:13
|
|
oid: now git_oid_fromstrn checks whether the given string is too short
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
6d8d3f19
|
2011-09-30T19:41:29
|
|
oid: optimize git_oid_fromstrn by using memset
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
e724b058
|
2011-09-30T19:08:48
|
|
oid: make git_oid_fromstrn support hex strings of odd length
This fixes issue #433.
Signed-off-by: J. David Ibáñez <jdavid.ibp@gmail.com>
|
|
fafd4710
|
2011-09-30T16:08:06
|
|
config: Proper type declarations for 64 bit ints
|
|
358a15fd
|
2011-09-30T15:43:58
|
|
config: fix check for environment string expansion
If ExpandEnvironmentStringsW is successful, it returns the amount of
characters written, including the NUL terminator.
Thanks to Emeric for reading the MSDN documentation correctly.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
472fa08f
|
2011-09-30T10:31:41
|
|
refs.c: fix reference_rename
6c8b458 removed an "unused" variable needed for git_hashtable_insert2(),
causing a segfault in reference_rename(). Instead, use
git_hashtable_insert().
Signed-off-by: schu <schu-github@schulog.org>
|
|
6c8b458d
|
2011-09-29T17:04:45
|
|
mingw: Fix compilation warnings
|
|
6e34111e
|
2011-09-29T16:30:38
|
|
netops: Use pragmas only in MSVC
|
|
356f11fe
|
2011-09-29T16:28:00
|
|
index: Silence type-punned warning
|
|
780bea6e
|
2011-09-29T16:23:24
|
|
mingw: Fix printf identifiers
|
|
c103d7b4
|
2011-09-29T15:49:28
|
|
odb: Pass compression settings to filebuf
|
|
8af4d074
|
2011-09-29T15:34:17
|
|
odb: Let users decide compression level for the loose ODB
|
|
72bdfdbc
|
2011-09-29T15:24:41
|
|
http-parser: Disable MSVC warnings locally
|
|
5888860d
|
2011-09-28T23:42:38
|
|
msvc: Disable warnings in header file
Remove clutter from the CMakeLists file by disabling the warnings
programatically.
|
|
a5b0e7f8
|
2011-09-27T20:08:13
|
|
Really fix MSVC
These was left over from the previous PRs.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
887eaf4d
|
2011-09-23T17:36:37
|
|
Fix dev branch under MSVC
In libgit2: Move an enum out of an int bitfield in the HTTP transport.
In the parser: Use int bitfields and change some variable sizes to
better fit thir use. Variables that count the size of the data chunk
can only ever be as large as off_t. Warning 4127 can be ignored, as
nobody takes it seriously anyway.
From Emeric: change some variable declarations to keep MSVC happy.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
40fe5fbe
|
2011-09-22T22:50:36
|
|
Make repo config loading automatic or completely explicit
git_repository_config wants to take the global and system paths again
so that one can be explicit if needed.
The git_repository_config_autoload function is provided for the cases
when it's good enough for the library to guess where those files are
located.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
4c562347
|
2011-09-22T21:34:46
|
|
Add git_config_find_system
This allows the library to guess where the system configuration file
should be located.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
8e9bfa4c
|
2011-09-27T14:31:57
|
|
tree: Fix check for valid attributes
|
|
01d7fded
|
2011-09-22T20:44:30
|
|
Revert "Rewrite getenv to use Win32 version on Windows"
This reverts commit e1b86444676b70154bf8ab450d429bdef57a8276.
|
|
9ef9e8c3
|
2011-09-27T14:30:14
|
|
tree: Use an internal append functiont to add new entries
|
|
8255c69b
|
2011-09-24T17:06:52
|
|
Make use of the tree cache
Taking advantage of the tree cache, git_tree_create_fromindex becomes
comparable in speed to git write-tree when the cache is available.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
3ba69ba8
|
2011-08-02T15:27:42
|
|
Add git_tree_cache_get
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
b419fe2d
|
2011-08-02T14:38:49
|
|
Invalidate the path when removing from the index
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
e23ede0d
|
2011-07-26T15:22:15
|
|
index: invalidate added paths
When a file is updated in the index, it's path needs to be invalidated
in the tree cache as the hash is no longer correct.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
69bffab9
|
2011-07-26T14:58:32
|
|
Add git_tree_cache_invalidate_path
Whenever a file is updated in the index, each tree leading towards it
needs to be invalidated. Provide the supporting function.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
acd31b4a
|
2011-07-26T12:44:06
|
|
tree cache: correctly handle invalidated trees
The fix introduced in a02fc2cd1 (2011-05-24; index: correctly parse
invalidated TREE extensions) threw out the rest of the data in the
extension if it found an invalidated entry. This was the result of
incorrect reading of the documentation.
Insted, keep reading the extension, as there may be cached data we can
use.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
b183ffe7
|
2011-07-26T12:26:12
|
|
Make tree cache name a flex-array
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
b4171320
|
2011-07-26T11:34:54
|
|
Move the tree cache functions to their own file
Rename git_index_tree to git_tree_cache.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
dd44887a
|
2011-09-23T00:00:05
|
|
Implment p_access and use it in git_fileutils_exists
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
01ab592b
|
2011-09-22T10:28:05
|
|
Merge pull request #421 from nulltoken/ntk/fix/config-get-set-long
config: make git_config_[get|set]_long() able to properly deal with 8 bytes wide values
|
|
8114ee4c
|
2011-09-22T10:17:43
|
|
Merge pull request #405 from carlosmn/http-ls
Implement ls-remote over HTTP
|
|
ad196c6a
|
2011-09-21T23:17:39
|
|
config: make git_config_[get|set]_long() able to properly deal with 8 bytes wide values
Should fix issue #419.
Signed-off-by: nulltoken <emeric.fermas@gmail.com>
|
|
4ee8418a
|
2011-09-21T22:14:09
|
|
http: get rid of the global state
Move the header parsing state into the transport, making use of the
existing bitfield.
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
e1b86444
|
2011-09-21T11:17:30
|
|
Rewrite getenv to use Win32 version on Windows
|
|
e3ecf7e9
|
2011-09-21T14:09:56
|
|
Do not have duplicate filenames
Two `posix.c` files may or may not break MSVC builds under 2008. Do not
have repeated objects.
You will need to clean & regenerate CMake.
|
|
805dc2a0
|
2011-09-20T15:52:16
|
|
Merge pull request #415 from schu/ref-rename-regression
refs: fix git_reference_rename()
|
|
4e52d340
|
2011-09-20T15:38:10
|
|
Merge pull request #413 from libgit2/utf8-paths-win32
Rewrite p_* functions to use Unicode and marshal to UTF8 internally, take 2
|
|
b6dcc2eb
|
2011-09-20T15:37:55
|
|
Merge pull request #414 from carlosmn/repo-discover-short
repsitory: use better error code if path is too short for discover
|
|
9457a36c
|
2011-09-21T01:10:11
|
|
Merge branch 'development' of github.com:libgit2/libgit2 into development
|
|
93fdbe00
|
2011-09-20T11:11:59
|
|
refs: fix git_reference_rename()
reference_rename() recently failed when renaming an existing reference
refs/heads/foo/bar -> refs/heads/foo because of a change in the
underlying functions / error codes. Fixes #412.
Signed-off-by: schu <schu-github@schulog.org>
|
|
c3fe018b
|
2011-09-20T10:02:11
|
|
repsitory: use better error code if path is too short for discover
GIT_EOVERFLOW means something different. Use GIT_ESHORTBUFFER. On the
way, remove a redundant sizeof(char).
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
6d0ef974
|
2011-09-19T12:41:27
|
|
Fix opendir/readdir and friends on Win32 to use Unicode
|
|
7998ae5a
|
2011-09-19T12:36:12
|
|
Rewrite p_* functions to use Unicode and marshal to UTF8 internally
|