Commit Graph

2112 Commits

Author SHA1 Message Date
Vicent Martí
bec92f78bf Merge pull request #492 from carlosmn/networking
Networking improvements
2011-11-21 17:12:23 -08:00
Vicent Marti
2744806f32 tree: Fix documentation 2011-11-22 02:10:41 +01:00
Vicent Marti
bf038dab30 clay: Properly initialize filebuf 2011-11-22 02:06:24 +01:00
Russell Belfer
b762e576c6 filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanups
Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT
and make git_filebuf_open and git_filebuf_cleanup safe to be called
multiple times on the same buffer.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-11-22 01:53:56 +01:00
Vicent Marti
1d09a1c88d clay: Merge manually @leto's tests from #485
This uses the new Clay code. As you can see, the diff is minimal... It
works!
2011-11-22 01:41:22 +01:00
Vicent Martí
967617ccad Merge pull request #489 from lht/fix-doc-bare-repo
Fix typo in repository documentation
2011-11-21 16:37:44 -08:00
Carlos Martín Nieto
6ac3b707b1 Add git_remote_connected
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-21 21:00:43 +01:00
Carlos Martín Nieto
4cf01e9a1a Add git_remote_disconnect
It can be useful to separate disconnecting from actually destroying
the object.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-21 21:00:42 +01:00
schu
a5cd086dff reference_rename: don't delete the reflog
reference_rename used to delete an old reflog file when renaming a
reference to not confuse git.git. Don't do this anymore but let the user
take care of writing a reflog entry.

Signed-off-by: schu <schu-github@schulog.org>
2011-11-21 16:38:30 +01:00
schu
b7c93a66e2 Add git_reflog_rename() and git_reflog_delete()
Signed-off-by: schu <schu-github@schulog.org>
2011-11-21 13:15:56 +01:00
schu
64093ce518 reference_rename: make sure to rollback
Actually rollback when we can't create the new reference. Mark the
rolled back reference as loose.

Signed-off-by: schu <schu-github@schulog.org>
2011-11-21 13:11:10 +01:00
schu
bdbdefac39 fileops.h: remove git_futils_mv_atomic prototype
0c49ec2 replaced git_futils_mv_atomic with p_rename without removing its
prototype.

Signed-off-by: schu <schu-github@schulog.org>
2011-11-21 13:11:10 +01:00
Carlos Martín Nieto
0ca7ca3ef7 refspec: allow a simple branchname
A simple branchname as refspec is valid and we shouldn't throw an
error when encountering one.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 21:57:16 +01:00
Carlos Martín Nieto
dc9e960f4b refspec: make the structure more complete
Add a next pointer to make it a linked list and add the 'pattern' and
'matching' flags.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 21:57:16 +01:00
Carlos Martín Nieto
617bfdf47f Add a name to a remote created from the API
Make it a bit more resilient.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 21:39:34 +01:00
Carlos Martín Nieto
95057b8503 remote: get rid of git_remote_negotiate
There is no good reason to expose the negotiation as a different step
to downloading the packfile.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 21:18:39 +01:00
Carlos Martín Nieto
40a40e8e9d net: move the reference storage to common code 2011-11-18 21:03:23 +01:00
Haitao Li
28ba94ceed Fix typo in repository documentation 2011-11-18 17:47:22 +08:00
Carlos Martín Nieto
e4c93a3927 Update clay instructions to use -vtap 2011-11-18 02:35:46 +01:00
Carlos Martín Nieto
c515b5bf1e Add test for renaming a file and adding it to the index
Thanks to Emeric.
2011-11-18 02:35:45 +01:00
Carlos Martín Nieto
472d4d858b Don't overwrite existing objects
It's redundant to do this (git doesn't) and Windows doesn't allow us
to overwrite a read-only file (which objects are).

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-18 02:12:28 +01:00
Vicent Marti
2cbca8b06c include: Unify internal include strategies
Do not add the `git2` path to internal includes, or that will cause
an extra path dependency.
2011-11-18 01:43:27 +01:00
Vicent Marti
d1a721c595 clay: Bump to 0.9.0, add TAP support
Comes with schu's stress tests for config files. Hopefully the diffs
will stay minimal from now on.
2011-11-18 01:40:35 +01:00
Vicent Marti
2ba14f2367 tree: Add payload to git_tree_walk 2011-11-18 01:40:35 +01:00
Vicent Marti
9432af36fc Rename git_tree_frompath to git_tree_get_subtree
That makes more sense to me.
2011-11-18 01:40:35 +01:00
Vicent Martí
010879d9e7 Merge pull request #486 from petdance/development
Quoted the asterisk to avoid markdown highlighter confusion
2011-11-16 20:35:29 -08:00
Andy Lester
a07d899449 Quoted the asterisk to avoid markdown highlighter confusion 2011-11-16 17:33:02 -06:00
Vicent Martí
682408110f Merge pull request #484 from brodie/packed-refs-perms
refs: permissions-related fixes/improvements
2011-11-16 11:45:37 -08:00
Brodie Rao
9788e72ad4 refs: move GIT_PACKED_REFS_FILE_MODE to refs.h as GIT_PACKEDREFS_FILE_MODE
This groups the #define with the other ref-related file modes, and it
makes the name consistent with the other packed-refs definitions.
2011-11-16 11:39:03 -08:00
Brodie Rao
7096d0f9e4 refs: use 0666 permissions when writing packed-refs, not 0644
This matches stock Git's behavior.
2011-11-16 11:36:13 -08:00
Vicent Martí
b2ae96fd6b Merge pull request #482 from leto/patch-1
Fix docs about the command to mix the clay tests
2011-11-16 11:34:10 -08:00
Jonathan "Duke" Leto
7b6156108c Fix docs about the command to mix the clay tests 2011-11-16 10:22:13 -08:00
Vicent Marti
a15c550db8 threads: Fix the shared global state with TLS
See `global.c` for a description of what we're doing.

When libgit2 is built with GIT_THREADS support, the threading system
must be explicitly initialized with `git_threads_init()`.
2011-11-16 14:09:44 +01:00
Vicent Martí
b0b2dd5ecc Merge pull request #475 from carlosmn/perms
Fix Windows permissions problems
2011-11-07 12:04:13 -08:00
Carlos Martín Nieto
657a395186 Write packed-refs with 0644 permissions
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-07 20:40:50 +01:00
Carlos Martín Nieto
718eb4b8ae Reword packed-refs error messages so they're easier to track down
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-07 20:34:42 +01:00
Carlos Martín Nieto
0c49ec2d3b Implement p_rename
Move the callers of git_futils_mv_atomic to use p_rename.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-07 20:34:27 +01:00
Vicent Martí
38068dc1d3 Merge pull request #473 from drafnel/bc/update-examples
bc/update examples
2011-11-07 06:27:49 -08:00
Vicent Martí
3b83bdac39 Merge pull request #470 from schu/test-helpers-no-assert
test_helpers: do not rely on assert
2011-11-07 06:25:22 -08:00
Vicent Martí
f8e8c8d44d Merge pull request #472 from libgit2/new-references
References! References! References!
2011-11-07 04:38:12 -08:00
Brandon Casey
0b142c9cb2 examples/network/.gitignore: ignore 'git2' 2011-11-06 20:07:27 -06:00
Brandon Casey
349532d0b1 examples/network/git2.c: exit with proper status, and avoid segfault
This function should exit after printing usage information if too few
arguments were specified.

Additionally, it should exit with a failure status if the first argument
supplied is not one in the internal command list.
2011-11-06 19:44:29 -06:00
Brandon Casey
983562e475 examples/network/git2.c: add newline to usage message 2011-11-06 19:43:44 -06:00
Brandon Casey
faeebd06e4 examples/network/fetch.c: revert overzealous conversion of free to git__free
Since git__free is not exported (it's actually a macro), it should not be
used in client programs.  Change this call to 'git__free' back to 'free'.
2011-11-06 19:35:35 -06:00
Vicent Marti
62dd6d1637 reflog: Do not free references before time 2011-11-06 03:15:38 +01:00
Vicent Marti
d4a0b124d0 refs: Partial rewrite for read-only refs
This new version of the references code is significantly faster and
hopefully easier to read.

External API stays the same. A new method `git_reference_reload()` has
been added to force updating a memory reference from disk. In-memory
references are no longer updated automagically -- this was killing us.

If a reference is deleted externally and the user doesn't reload the
memory object, nothing critical happens: any functions using that
reference should fail gracefully (e.g. deletion, renaming, and so on).

All generated references from the API are read only and must be free'd
by the user. There is no reference counting and no traces of generated
references are kept in the library.

There is no longer an internal representation for references. There is
only one reference struct `git_reference`, and symbolic/oid targets are
stored inside an union.

Packfile references are stored using an optimized struct with flex array
for reference names. This should significantly reduce the memory cost of
loading the packfile from disk.
2011-11-06 03:15:34 +01:00
schu
549bbd1342 git_reference_rename: cleanup reference renaming
git_reference_rename() didn't properly cleanup old references given by
the user to not break some ugly old tests. Since references don't point
to libgit's internal cache anymore we can cleanup git_reference_rename()
to be somewhat less messy.

Signed-off-by: schu <schu-github@schulog.org>
2011-11-06 03:15:30 +01:00
schu
75abd2b924 Free all used references in the source tree
Since references are not owned by the repository anymore we have to free
them manually now.

Signed-off-by: schu <schu-github@schulog.org>
2011-11-06 03:15:26 +01:00
schu
4fd89fa039 refs: add test case checking "immutable" references
Signed-off-by: schu <schu-github@schulog.org>
2011-11-06 03:15:22 +01:00
schu
a46ec45746 refs: split internal and external references
Currently libgit2 shares pointers to its internal reference cache with
the user. This leads to several problems like invalidation of reference
pointers when reordering the cache or manipulation of the cache from
user side.

Give each user its own git_reference instead of leaking the internal
representation (struct reference).

Add the following new API functions:

	* git_reference_free
	* git_reference_is_packed

Signed-off-by: schu <schu-github@schulog.org>
2011-11-06 03:15:19 +01:00