Commit Graph

2140 Commits

Author SHA1 Message Date
nulltoken
e2580375dc transport: make local transport accept a file Uri containing percent-encoded characters
This makes libgit2 compliant with the following scenario

$ git ls-remote file:///d:/temp/dwm%20tinou
732d790b702db4b8985f5104fc44642654f6a6b6        HEAD
732d790b702db4b8985f5104fc44642654f6a6b6        refs/heads/master
732d790b702db4b8985f5104fc44642654f6a6b6        refs/remotes/origin/HEAD
732d790b702db4b8985f5104fc44642654f6a6b6        refs/remotes/origin/master

$ mv "/d/temp/dwm tinou" /d/temp/dwm+tinou

$ git ls-remote file:///d:/temp/dwm%20tinou
fatal: 'd:/temp/dwm tinou' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

$ git ls-remote file:///d:/temp/dwm+tinou
732d790b702db4b8985f5104fc44642654f6a6b6        HEAD
732d790b702db4b8985f5104fc44642654f6a6b6        refs/heads/master
732d790b702db4b8985f5104fc44642654f6a6b6        refs/remotes/origin/HEAD
732d790b702db4b8985f5104fc44642654f6a6b6        refs/remotes/origin/master
2011-12-28 20:40:08 +01:00
nulltoken
2017a15d6c path: add git_path_fromurl() 2011-12-28 20:35:09 +01:00
nulltoken
459e2dcd7d path: add git__percent_decode() 2011-12-28 20:31:11 +01:00
nulltoken
eb8de7476b util: add git__fromhex() 2011-12-28 20:25:29 +01:00
Vicent Martí
06fcf057b6 Merge pull request #520 from antono/patch-1
Added link to vala bindings
2011-12-27 06:32:11 -08:00
Antono Vasiljev
27f69e4826 Added link to vala bindings 2011-12-27 17:10:12 +03:00
Vicent Martí
9aeef3929c Merge pull request #519 from ingydotnet/development
Add Perl to the list of bindings.
2011-12-26 23:01:06 -08:00
Ingy döt Net
20626db1ac Add Perl to the list of bindings. 2011-12-26 21:58:17 -08:00
Vicent Martí
d16e4b2b88 remotes: Remove unused variables 2011-12-25 00:25:04 +01:00
Vicent Martí
fa51565625 refs: Fix double free
Includes relevant Clay test
2011-12-25 00:22:20 +01:00
Vicent Martí
1b8cbe8be8 Merge pull request #517 from nulltoken/fix/local-remote-ls
Small enhancements to remote-ls when working against local repositories
2011-12-22 13:29:03 -08:00
nulltoken
db1f7e596c remote: add test to retrieve the advertised references from a local repository and fix related implementation 2011-12-21 21:30:12 +01:00
Russell Belfer
ee1f0b1aed Add APIs for git attributes
This adds APIs for querying git attributes.  In addition to
the new API in include/git2/attr.h, most of the action is in
src/attr_file.[hc] which contains utilities for dealing with
a single attributes file, and src/attr.[hc] which contains
the implementation of the APIs that merge all applicable
attributes files.
2011-12-20 16:32:58 -08:00
Vicent Martí
1bdba3386d Merge pull request #514 from schu/fix-warning-uninitialized
config_file: honor error
2011-12-20 16:27:25 -08:00
schu
e95849c14f config_file: honor error
Return an error if we can't write an updated version of the config file
after config_delete.

Along with that, fix an uninitialized warning.

Signed-off-by: schu <schu-github@schulog.org>
2011-12-19 16:07:21 +01:00
Russell Belfer
be00b00dd1 Add unit test for proper init of index entries 2011-12-18 12:21:18 -08:00
Russell Belfer
86e356ee51 Restore missing lstat in index_entry_init
In an effort to remove duplicate code, I accidentally left
the stat structure uninitialized in this function.  This
patch restores that data gathering.
2011-12-18 12:08:50 -08:00
Vicent Martí
3e72809b5e Merge pull request #513 from carlosmn/development
Really delete variables
2011-12-16 01:06:01 -08:00
Carlos Martín Nieto
80a665aaca config: really delete variables
Instead of just setting the value to NULL, which gives unwanted
results when asking for that variable after deleting it, delete the
variable from the list and re-write the file.
2011-12-16 02:28:39 +01:00
Carlos Martín Nieto
7b2b4adfb1 Revert "config: Return ENOTFOUND when a variable was deleted"
This would make us think that config variables like

    [core]
        something

is missing.
2011-12-16 01:39:28 +01:00
Vicent Marti
2ea14da648 config: Return ENOTFOUND when a variable was deleted 2011-12-15 18:14:41 +01:00
Vicent Marti
bc57b80b83 Update to Clay 0.10.0
Comes with support for global events; this fixes #496.
2011-12-15 02:09:15 +01:00
Russell Belfer
b5daae68a4 Allow git_buf_joinpath to accept self-joins
It was not safe for git_buf_joinpath to be used with a pointer
into the buf itself because a reallocation could invalidate
the input parameter that pointed into the buffer.  This patch
makes it safe to self join, at least for the leading input to
the join, which is the common "append" case for self joins.

Also added unit tests to explicitly cover this case.

This should actually fix #511
2011-12-14 14:31:06 -08:00
Russell Belfer
d6ccedddd2 Check error on path manipulations.
This commit fixes #511.
2011-12-14 14:31:06 -08:00
Vicent Martí
52d552e901 Merge pull request #510 from nulltoken/topic/commit-oid-generation
commit: add test to ensure predictability of generation of commit, tree and blob object ids
2011-12-14 13:55:41 -08:00
Paul Betts
dcb7447cba Merge pull request #512 from nulltoken/fix/mktemp-segfault
Prevent segfaulting on Windows when building a temporary filename
2011-12-14 11:15:19 -08:00
nulltoken
489c36663e posix_w32: prevent segfaulting on Windows when building a temporary filename 2011-12-14 20:03:11 +01:00
nulltoken
8fae76c5e5 commit: add test to ensure predictability of generation of commit, tree and blob object ids 2011-12-14 13:16:56 +01:00
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