Commit Graph

1875 Commits

Author SHA1 Message Date
nulltoken
b3f993e287 Add test commit containing subtrees and files 2011-10-13 22:48:58 +02:00
nulltoken
a41e9f131e Fix compilation error on Windows 2011-10-13 22:48:07 +02:00
Vicent Martí
5c3d5fb018 Merge pull request #454 from brodie/parsing-fixes
Improvements to tag, commit, and signature parsing
2011-10-13 12:16:07 -07:00
Vicent Martí
a3e23a7c0a Merge pull request #455 from brodie/pack-fixes
odb_pack: don't do ambiguity checks for fully qualified SHA1 hashes
2011-10-13 12:01:06 -07:00
Brodie Rao
b2a2702da2 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).
2011-10-12 17:34:04 -07:00
Brodie Rao
6f2856f308 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.
2011-10-12 16:19:46 -07:00
Brodie Rao
15b0bed2ba 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
2011-10-12 16:09:16 -07:00
Brodie Rao
cf7b13f3c3 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.
2011-10-12 16:06:25 -07:00
Brodie Rao
04f788023f 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:

25b424134f
2011-10-12 15:14:25 -07:00
Carlos Martín Nieto
3707b331e2 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>
2011-10-12 21:34:25 +02:00
Carlos Martín Nieto
dfafb03bdc Move the transports to their own directory 2011-10-12 21:34:25 +02:00
Carlos Martín Nieto
8c2528748d net: plug a few memory leaks
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
546a3c8f9e 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>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
03e4833b09 remote: bitfield should be unsigned
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
fc3e3c5577 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>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
2c982daa2e 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>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
51760bc13d pkt: get rid of the chunked support
It was a bad idea.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
e5e92c1fab http: simple negotiation
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
65c86048cb Introduce the git_pkt_buffer_ family of functions
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
f9613325f1 http: parse the response from the server
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
cbb2feded6 http: add a set of common refs
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
3313a05a47 http: move stuff out of negotiate_fetch
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-12 21:33:19 +02:00
Carlos Martín Nieto
1636ba5a0d 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>
2011-10-12 21:33:18 +02:00
Carlos Martín Nieto
747bf5f14c http: Start negotiate_fetch 2011-10-12 21:33:18 +02:00
Carlos Martín Nieto
34bfb4b0d4 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>
2011-10-12 21:33:18 +02:00
Carlos Martín Nieto
eb07a4d1dd 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>
2011-10-12 21:33:18 +02:00
Vicent Marti
502dd2dadb msvc: Fix resourc embedding 2011-10-12 12:09:56 -07:00
Vicent Martí
92e2081f40 Merge pull request #449 from csware/include-win-version-information
Include windows version information in git2.dll
2011-10-12 11:03:58 -07:00
Vicent Martí
bff5f4e396 Merge pull request #452 from carlosmn/cmake-respect-user
Assorted CMake fixes
2011-10-11 15:11:23 -07:00
Carlos Martín Nieto
5cb7a1addf Explain how to build universal OSX binaries
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-11 18:14:13 +02:00
Carlos Martín Nieto
5b216d1a6f CMake: don't overwrite the user's CFLAGS
If either CFLAGS is defined or the user passes -DCMAKE_C_FLAGS to
cmake, the variable already contains flags. Don't overwrite them, but
append them to our settings.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-11 18:08:54 +02:00
Carlos Martín Nieto
dcd62cb2e9 CMake: Only add the STDCALL option when using MSVC
This option is only ever used with MSVC.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-11 17:57:00 +02:00
Carlos Martín Nieto
8f9be31677 fetch: move 'head' so it's visible to the whole function
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-10-09 21:49:10 +02:00
Vicent Martí
6aac5afb6d Merge pull request #444 from carlosmn/fetch-fixes
A couple of fetch fixes
2011-10-09 12:09:57 -07:00
Sven Strickroth
cf9bf6b787 include version information in git2.dll on Windows
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2011-10-09 18:55:28 +02:00
Sven Strickroth
96fab093e3 put version information in separate file
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2011-10-09 18:39:52 +02:00
Sven Strickroth
da2281c7c0 libgit2 doesn't use -LIB define
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2011-10-09 18:35:42 +02:00
Vicent Martí
5a1d2b2a17 Merge pull request #447 from csware/fix-win64-build
fix build for x64
2011-10-08 21:18:09 -07:00
Sven Strickroth
314f54eb06 fix build for x64
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2011-10-09 05:29:57 +02:00
Carlos Martín Nieto
517bda196e 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>
2011-10-08 02:28:02 +02:00
Carlos Martín Nieto
4a3b18a62f 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>
2011-10-08 02:12:26 +02:00
Vicent Martí
d322d10ae0 Merge pull request #439 from carlosmn/network-examples
Add network examples
2011-10-07 14:20:53 -07:00
Vicent Martí
01be6f37d1 Merge pull request #446 from schu/tests-clay-update
tests-clay: update
2011-10-07 14:20:25 -07:00
schu
1d33bf9d02 tests-clay: add a readme file
Signed-off-by: schu <schu-github@schulog.org>
2011-10-07 23:13:09 +02:00
schu
681008c768 tests-clay: update clay
The clay script didn't match the latest version from upstream.
Additionaly, add core/strtol.c to complete porting the core tests to
clay.

Signed-off-by: schu <schu-github@schulog.org>
2011-10-07 23:02:02 +02:00
Vicent Marti
3eaf34f4c6 libgit2 v0.15.0 "Das Wunderbar Release"
I am aware the codename is not gramatically correct in any language.

Check the COPYING file for the detailed terms on libgit2's license. Check
the AUTHORS file for the full list of guilty parties.

As we slowly stabilize the API, we've dropped 1 function from the library,
and changed the signature of only 5 of them. There's of course a good
chunk of new functionality, and a thousand bug fixes.

In this release of libgit2:

	- Changed `git_blob_rawsize`: Now returns `size_t` instead of int, allowing
	files >4GB in 64 bit systems.

	- Removed `git_commit_message_short`: Please use `git_commit_message`
	to get the full message and decide which is the "short view" according
	to your needs (first line, first 80 chars...)

	- Added `git_commit_message_encoding`: Returns the encoding field of a commit
	message, if it exists.

	- Changed `git_commit_create`, `git_commit_create_v`: New argument `encoding`, which
	adds a encoding field to the generated commit object.

	- Added `git_config_find_system`: Returns the path to the system's global config
	file (according to the Core Git standards).

	- Changed `git_config_get_XX`, `git_config_set_XX`: the `long` and `int` types have
	been replaced by `int64` and `int32` respectively, to make their meaning more
	obvious.

	- Added `git_indexer`: An interface to index Git Packfiles has been added in the
	`git2/indexer.h` header.

	- Changed `git_reflog_entry_XX`: Reflog entries are now returned as `git_oid *` objects
	instead of hexadecimal OIDs.

	- Added `git_remote`: More fetch functionality has been added to the `git2/remote.h`
	functionality. Local, Smart HTTP and Git protocols are now supported.

	- Added `git_repository_head`: Returns the HEAD of the repository.

	- Added `git_repository_config_autoload`: Opens the configuration file of a repository,
	including the user's and the system's global config files, if they can be found.

	- Changed `git_signature_now`: Now returns an error code; the signature is stored by
	reference.
2011-10-05 16:48:36 -04:00
Vicent Marti
d3fb6a81c3 cmake: Set the old test suite as default for the release 2011-10-05 16:46:34 -04:00
Vicent Marti
dd3fd68266 msvc: Remove superfluous includes 2011-10-05 13:44:27 -07:00
Vicent Marti
c060854ed5 msvc: Properly handle inttypes.h/stdint.h 2011-10-05 16:21:16 -04:00
Carlos Martín Nieto
72d6a20be0 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>
2011-10-05 20:25:28 +02:00