Commit Graph

49 Commits

Author SHA1 Message Date
Edward Thomson
d00d54645d immutable references and a pluggable ref database 2013-03-07 11:01:52 -06:00
Michael Schubert
abeefbbe18 push: properly handle tags
Currently, push doesn't really handle tags when queueing objects. Fix
it.
2013-01-09 17:05:21 +01:00
Jameson Miller
087f64d3e3 Relax refspecs accepted by push 2013-01-09 16:15:58 +01:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Vicent Martí
e05ca13f1f Merge pull request #1115 from ben/struct-versions
Version info for public structs
2012-12-05 11:47:19 -08:00
nulltoken
bc05f30c47 object: refine git_object_peel() error report 2012-12-01 08:34:29 +01:00
nulltoken
80d9d1df14 refs: Deploy EINVALIDSPEC usage 2012-12-01 08:34:26 +01:00
Ben Straub
f4fc9fdba0 Cleanup nitpicky things 2012-11-30 13:12:10 -08:00
Russell Belfer
eecc805029 Update callback fn ptr for git_reference_foreach
As part of API review, use a typedef for the callback fn ptr.
2012-11-27 13:18:28 -08:00
Ben Straub
2508cc66eb Rename ref and reflog apis for consistency 2012-11-27 13:17:45 -08:00
Russell Belfer
b90500f03d Improve docs, examples, warnings
This improves docs in some of the public header files, cleans
up and improves some of the example code, and fixes a couple
of pedantic warnings in places.
2012-11-01 14:08:30 -07:00
Paul Thompson
b46708aaf9 Separated git_strarray from common.h. Added doxy comments. 2012-10-11 23:04:08 +11:00
nulltoken
77e06d7e85 refs: introduce git_reference_is_valid_name() 2012-09-25 07:49:15 +02:00
nulltoken
c030ada7ff refs: make git_reference_normalize_name() accept refspec pattern 2012-09-25 07:49:14 +02:00
nulltoken
316659489a refs: introduce git_reference_peel()
Fix #530
2012-09-06 18:40:05 +02:00
Vicent Marti
62eafd0620 Merge branch 'branch-delete-ref' into development
Conflicts:
	include/git2/refs.h
2012-08-27 14:54:52 -07:00
nulltoken
2e0c881670 refs: expose git_reference_normalize_name() 2012-08-27 08:41:26 +02:00
Vicent Marti
1c947daa80 branch: Change git_branch_delete to take a ref 2012-08-26 18:00:10 -07:00
nulltoken
e0db9f1117 refs: fix missing parameter documentation 2012-08-15 17:54:05 +02:00
Vicent Marti
51e1d80846 Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development
Conflicts:
	src/notes.c
	src/transports/git.c
	src/transports/http.c
	src/transports/local.c
	tests-clar/odb/foreach.c
2012-08-06 12:41:08 +02:00
Russell Belfer
5dca201072 Update iterators for consistency across library
This updates all the `foreach()` type functions across the library
that take callbacks from the user to have a consistent behavior.
The rules are:

* A callback terminates the loop by returning any non-zero value
* Once the callback returns non-zero, it will not be called again
  (i.e. the loop stops all iteration regardless of state)
* If the callback returns non-zero, the parent fn returns GIT_EUSER
* Although the parent returns GIT_EUSER, no error will be set in
  the library and `giterr_last()` will return NULL if called.

This commit makes those changes across the library and adds tests
for most of the iteration APIs to make sure that they follow the
above rules.
2012-08-03 17:08:01 -07:00
nulltoken
ef4d795ec5 refs: drop git_reference_remote_tracking_from_branch() 2012-07-24 16:09:49 +02:00
nulltoken
88bcd5153f branch: introduce git_reference_is_branch() 2012-07-24 16:09:45 +02:00
nulltoken
84f18e3587 refs: introduce git_reference_remote_tracking_from_branch() 2012-07-12 01:06:13 +02:00
nulltoken
75261421ec refs: add git_reference_has_log() 2012-07-07 12:15:28 +02:00
nulltoken
527ed55448 references: introduce git_reference_foreach_glob() 2012-06-22 21:40:24 +02:00
Bruce Mitchener
d73c94b21c Fix spelling errors. 2012-05-19 20:26:52 +07:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Vicent Martí
2e2e97858d Properly tag all enums with a _t 2012-05-18 01:26:23 +02:00
Vicent Martí
4fbd1c007e refs: git_reference_listall -> git_reference_list 2012-05-18 01:26:16 +02:00
Russell Belfer
26515e73a1 Rename to git_reference_name_to_oid 2012-04-23 10:06:31 -07:00
Russell Belfer
f201d613a8 Add git_reference_lookup_oid and lookup_resolved
Adds a new public reference function `git_reference_lookup_oid`
that directly resolved a reference name to an OID without returning
the intermediate `git_reference` object (hence, no free needed).

Internally, this adds a `git_reference_lookup_resolved` function
that combines looking up and resolving a reference.  This allows
us to be more efficient with memory reallocation.

The existing `git_reference_lookup` and `git_reference_resolve`
are reimplmented on top of the new utility and a few places in the
code are changed to use one of the two new functions.
2012-04-17 10:44:50 -07:00
schu
5e0de32818 Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 17:11:09 +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
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
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
Vicent Marti
bb742ede3d Cleanup legal data
1. The license header is technically not valid if it doesn't have a
copyright signature.

2. The COPYING file has been updated with the different licenses used in
the project.

3. The full GPLv2 header in each file annoys me.
2011-09-19 01:54:32 +03:00
David Boyce
d911172255 Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or an error code". 2011-09-13 12:30:25 -04:00
Kirill A. Shutemov
932d1baf29 cleanup: remove trailing spaces
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-01 18:02:56 +02:00
Vicent Marti
7376ad9927 refs: Remove duplicate rename method
`git_reference_rename` now takes a `force` flag
2011-06-29 11:01:35 +02:00
Vicent Marti
d5afc0390c Remove redundant methods from the API
A bunch of redundant methods have been removed from the external API.

- All the reference/tag creation methods with `_f` are gone. The force
flag is now passed as an argument to the normal create methods.

- All the different commit creation methods are gone; commit creation
now always requires a `git_commit` pointer for parents and a `git_tree`
pointer for tree, to ensure that corrupted commits cannot be generated.

- All the different tag creation methods are gone; tag creation now
always requires a `git_object` pointer to ensure that tags are not
created to inexisting objects.
2011-06-28 19:36:27 +02:00
Vicent Marti
d144c569f3 Update documentation
Fix all the missmatched arguments in the docs
2011-06-16 03:06:22 +02:00
Vicent Marti
43521d0688 refs: Rename git_referece_listcb to _foreach
Same name as `git_config_foreach`
2011-06-16 02:27:43 +02:00
Vicent Marti
95cde17ca4 Enforce coding conventions in refs.c
Internal methods are static and without the git prefix.
'Force' methods have a `_f` prefix to match the other 'force' methods.
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
4cd6ed7566 Fix documentation copy error
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
fa20496200 Allow forcing the creation or renaming of references
Add internal reference create and rename functions which take a force
parameter, telling them to overwrite an existing reference if it
exists.

These functions try to update the reference if it's of the same type
as the one it's going to be replaced by. Otherwise the old reference
becomes invalid.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Vicent Marti
09e8de0f38 New external API method: git_reference_listcb
List all the references in the repository, calling a custom
callback for each one.

The listed references may be filtered by type, or using
a bitwise OR of several types. Use the magic value
`GIT_REF_LISTALL` to obtain all references, including
packed ones.

The `callback` function will be called for each of the references
in the repository, and will receive the name of the reference and
the `payload` value passed to this method.
2011-03-25 23:53:38 +02:00
Vicent Marti
0057182807 Add new method git_reference_listall
Lists all the references in a repository. Listing may be filtered by
reference type.

This should applease Lord Clem.
2011-03-14 23:52:32 +02:00
Vicent Marti
71d33382a7 Move the external includes folder from src to include
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-03 20:23:53 +02:00