Commit Graph

2112 Commits

Author SHA1 Message Date
Vicent Marti
16a9f32abd Merge remote-tracking branch 'nulltoken/topic/oid-generation' into development
Conflicts:
	tests-clay/clay.h
	tests-clay/clay_main.c
2011-12-14 03:32:49 +01:00
Vicent Marti
bf6d2717ab buffer: inline git_buf_cstr 2011-12-14 03:27:53 +01:00
Vicent Marti
7af26f8f58 Fix tree-diff with the new path API 2011-12-14 03:24:16 +01:00
Vicent Marti
40e73d6f88 Merge remote-tracking branch 'arrbee/git-buf-for-paths' into development
Conflicts:
	tests-clay/clay_main.c
2011-12-09 01:38:46 +01:00
Russell Belfer
97769280ba Use git_buf for path storage instead of stack-based buffers
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.
2011-12-07 23:08:15 -08:00
nulltoken
a7954d2a5a tree: add test to ensure predictability of generation of object ids 2011-12-04 18:12:40 +01:00
Vicent Marti
e923868766 tree: recursive diff-index
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Signed-off-by: Vicent Marti <tanoku@gmail.com>

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Author:    Carlos Martín Nieto <carlos@cmartin.tk>
#
# On branch development
# Your branch is ahead of 'origin/development' by 11 commits.
#
# Changes to be committed:
#   (use "git reset HEAD^1 <file>..." to unstage)
#
#	modified:   include/git2/tree.h
#	modified:   src/tree.c
#	modified:   tests-clay/clay_main.c
#	modified:   tests-clay/object/tree/diff.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	0001-remote-Cleanup-the-remotes-code.patch
#	466.patch
#	466.patch.1
#	488.patch
#	Makefile
#	libgit2.0.15.0.dylib
#	libgit2.0.dylib
#	libgit2.dylib
#	libgit2_clay
#	libgit2_test
#	tests-clay/object/tree/
2011-12-03 18:06:34 +01:00
Carlos Martín Nieto
b4d757c0a8 clay: add tests for tree diff'ing
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-12-03 18:06:27 +01:00
Carlos Martín Nieto
a1fdea2855 tree: implement tree diffing
For each difference in the trees, the callback gets called with the
relevant information so the user can fill in their own data
structures.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-12-03 17:47:06 +01:00
Vicent Martí
a22b14d32d Merge pull request #506 from nulltoken/fix/warnings
Fix compilation warnings
2011-11-30 23:04:23 -08:00
nulltoken
8e80decf34 Fix compilation warnings 2011-12-01 07:48:20 +01:00
Vicent Martí
8a4e3181df Merge pull request #504 from arrbee/git-buf-fast-join
Optimized implementation of git_buf_join
2011-11-30 13:33:30 -08:00
Russell Belfer
969d588d9a Optimized of git_buf_join.
This streamlines git_buf_join and removes the join-append behavior,
opting instead for a very compact join-replace of the git_buf contents.
The unit tests had to be updated to remove the join-append tests and
have a bunch more exhaustive tests added.
2011-11-30 13:10:47 -08:00
Vicent Martí
f5f0482658 Merge pull request #503 from arrbee/git-buf-always-cstr
Make git_buf functions always maintain a valid cstr
2011-11-30 11:02:34 -08:00
Russell Belfer
309113c984 Make initial value of git_buf ptr always be a valid empty string.
Taking a page from core git's strbuf, this introduces git_buf_initbuf
which is an empty string that is used to initialize the git_buf ptr
value even for new buffers.  Now the git_buf ptr will always point to
a valid NUL-terminated string.

This change required jumping through a few hoops for git_buf_grow
and git_buf_free to distinguish between a actual allocated buffer
and the global initial value.  Also, this moves the allocation
related functions to be next to each other near the top of buffer.c.
2011-11-29 23:45:17 -08:00
Russell Belfer
7df41387f5 Adding unit tests for git_buf_copy_cstr 2011-11-29 21:44:54 -08:00
Russell Belfer
c63728cd73 Make git_buf functions always maintain a valid cstr.
At a tiny cost of 1 extra byte per allocation, this makes
git_buf_cstr into basically a noop, which simplifies error
checking when trying to convert things to use dynamic allocation.

This patch also adds a new function (git_buf_copy_cstr) for copying
the cstr data directly into an external buffer.
2011-11-29 16:39:49 -08:00
Vicent Martí
fc88a8d321 Merge pull request #500 from schu/minor-fixups
Minor fixups
2011-11-29 02:37:39 -08:00
Vicent Marti
8e46168cd9 clay: Add buffer tests 2011-11-29 11:36:18 +01:00
schu
91a9a0707a tests-clay: mix the tests
Actually add the tests introduced with 8c74d22.

Signed-off-by: schu <schu-github@schulog.org>
2011-11-29 11:13:31 +01:00
schu
fe9a0e09fe transports: fix -Wunused-but-set-variable warning
Signed-off-by: schu <schu-github@schulog.org>
2011-11-29 11:02:42 +01:00
Vicent Martí
798dd36c08 Merge pull request #499 from arrbee/extend-git-buf
Extend git_buf with new utility functions and unit tests.
2011-11-29 01:39:52 -08:00
Russell Belfer
679b69c49d Resolve remaining feedback
* replace some ints with size_ts
* update NULL checks in various places
2011-11-28 13:05:25 -08:00
Carlos Martín Nieto
89886d0bbb Plug a bunch of leaks 2011-11-28 21:08:29 +01:00
Vicent Marti
a5123ea80b repository: Do not double-increment refcounts 2011-11-28 20:00:42 +01:00
Russell Belfer
3aa294fd45 Add two string git_buf_join and tweak input error checking.
This commit addresses two of the comments:
* renamed existing n-input git_buf_join to git_buf_join_n
* added new git_buf_join that always takes two inputs
* moved some parameter error checking to asserts
* extended unit tests to cover new version of git_buf_join
2011-11-28 10:42:57 -08:00
Vicent Marti
b233714360 remote: Fix connected test 2011-11-28 18:46:25 +01:00
Vicent Marti
bb34a93621 Merge branch 'repo-ownership' into development 2011-11-28 18:44:47 +01:00
Vicent Marti
d88d4311c7 remote: Cleanup the remotes code
- Hide the remaining transports code
- Drop `git_headarray`, switch to using a callback to list refs. Makes
the code cleaner.
2011-11-28 08:40:40 +01:00
Russell Belfer
8c74d22ebf Extend git_buf with new utility functions and unit tests.
Add new functions to git_buf for:
* initializing a buffer from a string
* joining one or more strings onto a buffer with separators
* swapping two buffers in place
* extracting data from a git_buf (leaving it empty)

Also, make git_buf_free leave a git_buf back in its initted state,
and slightly tweak buffer allocation sizes and thresholds.

Finally, port unit tests to clay and extend with lots of new tests
for the various git_buf functions.
2011-11-27 21:56:44 -08:00
Vicent Marti
c94785a9f3 repository: Use git_config when initializing
Thanks @carlosmn!
2011-11-26 08:48:01 +01:00
Vicent Marti
b028a898a1 util: Remove unused macro 2011-11-26 08:48:01 +01:00
Vicent Marti
03da4480f6 refcount: Fix off-by one error 2011-11-26 08:48:01 +01:00
Vicent Marti
6632c15509 Document all of the things 2011-11-26 08:48:01 +01:00
Vicent Marti
b54b88c465 tests: Add refs folder to the bad_tag.git repo 2011-11-26 08:48:01 +01:00
Vicent Marti
45e79e3701 Rename all _close methods
There's no difference between `_free` and `_close` semantics: keep
everything with the same name to avoid confusions.
2011-11-26 08:48:00 +01:00
Vicent Marti
9462c47143 repository: Change ownership semantics
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.
2011-11-26 08:37:08 +01:00
Vicent Martí
880b6f0c22 Merge pull request #497 from carlosmn/config
Don't fail when opening a new config file
2011-11-25 21:31:35 -08:00
Vicent Martí
e42ea1f488 Merge pull request #491 from schu/refs-cleanup
reference_rename() cleanup
2011-11-25 21:30:08 -08:00
Carlos Martín Nieto
533fda3b83 config: test saving config to new file 2011-11-26 02:00:18 +01:00
Carlos Martín Nieto
4e90a0a4a0 config: allow to open and write to a new file 2011-11-26 01:54:12 +01:00
Vicent Marti
2869f404fd transport: Add git_transport_valid_url 2011-11-22 15:49:23 +01:00
Carlos Martín Nieto
6616e20750 Add a note not to free the result from git_remote_ls 2011-11-22 11:18:27 +01:00
Carlos Martín Nieto
391575638c Free the created refs in git_remote_update_tips 2011-11-22 11:16:44 +01:00
Carlos Martín Nieto
a31471140f Set transport to NULL after freeing it 2011-11-22 10:31:32 +01:00
Brandon Casey
b026b00d9c tests-clay: remove extra semi-colon in clay_libgit2.h, add one to index/rename.c 2011-11-22 01:19:07 -06:00
Vicent Martí
f80263225b Merge pull request #493 from euler0/fix-typos-readme
Fix typos in the README file
2011-11-21 22:36:19 -08:00
Vincent Lee
9d163937ea Fix to follow the Qt trademark policy
Never use the Qt trade mark with both letters capitalized, in the form
"QT".
(http://qt-project.org/trademarkpolicy.html)
2011-11-22 15:12:57 +09:00
Vincent Lee
5689a8d5fd Fix a typo in the README file 2011-11-22 15:04:33 +09:00
Vicent Marti
4bef35656e remote: Assert things that should be asserted 2011-11-22 02:16:20 +01:00