Commit Graph

948 Commits

Author SHA1 Message Date
Vicent Marti
29e1789b34 Fix the git_tree_write implementation 2011-04-04 12:14:43 +03:00
Sarath Lakshman
47d8ec56e9 New external API method: git_tree_create
Creates a tree by scanning the index file. The method handles recursive
creation of trees for subdirectories and adds them to the parent tree.
2011-04-03 17:18:56 +05:30
Vicent Marti
3e3e4631a0 Merge branch 'tagging' of https://github.com/nulltoken/libgit2 into development
Conflicts:
	include/git2/tag.h
	src/tag.c
2011-04-02 12:50:25 +03:00
Vicent Marti
720d5472f8 Change parse methods to const buffer
Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-04-02 12:42:04 +03:00
Vicent Marti
d8ad64d366 Merge branch 'parse-tag-buffer' of https://github.com/carlosmn/libgit2 into development 2011-04-02 12:28:35 +03:00
Olivier Ramonat
ccfce5f30f Update README after sqlite option change
To build libgit2 with sqlite support, waf configure should be run
with --with-sqlite
2011-04-02 12:23:09 +03:00
Carlos Martín Nieto
f026f2b9ee Merge upstream/development
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:29:13 +02:00
Carlos Martín Nieto
11d0e70578 Add support for subsections
A variable name is stored internally with its section the way it
appeared in the configuration file in order to have the information
about what parts are case-sensitive inline.

Really implement parse_section_header_ext and move the assignment of
variables to config_parse.

The variable name matching is now done in a case-away way by
cvar_name_match and cvar_section_match. Before the user sees it, it's
normalized to the two- or three-dot version.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:21:54 +02:00
Carlos Martín Nieto
6482929b5f move build_varname above parse_section 2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
d7354d70b0 build_varname: lowercase the variable name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
0bbaf9aaef config_parse: no need to check if current_section is non-null
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
923fe4557f Add strtolower and strntolower functions
As parts of variable names are case-sensitive, we need these functions.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
df22949a35 config_set: really replace the value on overwrite
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
ba84cad380 wscript: Use -O0 on debug
If we want debugging symbols, we most likely want them to point to the
right place. With -O2, gdb or valgrind may give wrong information.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:02:24 +02:00
nulltoken
ac26e2454e Rename git_tag_create_o_f() to git_tag_create_fo() 2011-03-30 23:46:54 +02:00
nulltoken
9e680bcc00 Add git_tag_delete() 2011-03-30 23:26:36 +02:00
nulltoken
a50c145855 Add git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag reference, if any 2011-03-30 23:16:30 +02:00
nulltoken
74e50a2d3e Fix memory leak in tag releated tests 2011-03-30 22:46:52 +02:00
nulltoken
bf4c39f929 Prevent tag_create() from creating a conflicting reference 2011-03-30 22:30:55 +02:00
nulltoken
6d3160148b Add test demonstrating that one can create a tag pointing at a non existent target 2011-03-30 22:26:53 +02:00
nulltoken
8e9a3d4217 Enforce the testing of the correct creation of a tag 2011-03-30 21:46:19 +02:00
nulltoken
673de2cf59 Fix misleading comments 2011-03-30 21:29:10 +02:00
Carlos Martín Nieto
8ecc5ae5cb git_config_set_int: use the right buffer
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 16:50:28 +02:00
Carlos Martín Nieto
e21881d1db git_config: reorder fields according to use
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 15:44:23 +02:00
Carlos Martín Nieto
dadc0158fb config: use a singly-linked list instead of a hash table
Such a list preserves the order the variables were first read in which
will be useful later for merging different data-sets. Furthermore,
reading and writing out the same configuration should not reorganize
the variables, which could happen when iterating through all the items
in a hash table.

A hash table is overkill for this small a data-set anyway.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 15:44:23 +02:00
Carlos Martín Nieto
d28830c255 Store the parsed variables
Store the key-value pair as strings.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 13:43:01 +02:00
Carlos Martín Nieto
934fcf78f2 Initialise the config reader in config_parse
git_config_open shouldn't have to initialise variables that are only
used inside config_parse and its callees.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 13:42:25 +02:00
Carlos Martín Nieto
2974aa94c3 Determine variable type at runtime
Config variables should be interpreted at run-time, as we don't know if a
zero means false or zero, or if yes means true or "yes".

As a variable has no intrinsic type, git_cvtype is gone and the public
API takes care of enforcing a few rules.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 13:42:24 +02:00
Carlos Martín Nieto
2e445cacd2 build_varname: allocate memory
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 11:34:04 +02:00
nulltoken
2b9b99b6ed Add test ensuring one can not create an oid reference which targets at an unknown id 2011-03-29 21:29:30 +02:00
nulltoken
4d00dfd438 Replace gitfo_unlink() calls with git_reference_delete() in refs related tests 2011-03-29 21:21:47 +02:00
Olivier Ramonat
a796d24cf6 Fix help message for waf configure --with-sqlite 2011-03-29 20:16:17 +03:00
Carlos Martín Nieto
553fbd640f Check for looser reference names
res/dummy/a and refs/stash must pass. The other rules are already
tested by the rest of the checks.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
83c95128d9 normalize_name: allow more references under refs/
Allow any well-formed reference name to live under refs/ removing the
condition that they be under refs/{heads,tags,remotes}/ as was the
design of git.

An exception is made for HEAD which is allowed to contain an OID
reference in detached HEAD state.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Vicent Marti
9a53df7e0a refs: Don't allow references to inexistent OIDs 2011-03-29 19:58:19 +03: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
fc1eeb9dfc Make overwrite test more comprehensive
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
ec99193655 force-rename test: check for the right name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
dad4a4d582 rename: don't return early if the target ref exists
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
591a9423f5 Add tests covering overwriting references
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +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
c7db45e862 Match the comment with the error string
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
Carlos Martín Nieto
baad182cbc Add GIT_EEXISTS error code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
9a3c5e55fd Expose config API for setters, getters and foreach
These functions can be used to query or modify the variables in a
given configuration. No sanity checking is done on the variable names.

This is mostly meant as an API preview.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 18:13:47 +02:00
Carlos Martín Nieto
26faa3668f Add build_varname to make a full var name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 18:13:47 +02:00
Carlos Martín Nieto
e15afc8e7c cvar_free: also free the config var's name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 18:07:01 +02:00
Carlos Martín Nieto
6d7bb4e039 Move git_cvar_type to include/git2/config.h
Include it in src/config.h and fix the header name #define.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 17:35:02 +02:00
Carlos Martín Nieto
3d23b74af7 Free the config var hash contents in git_config_free
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 13:50:37 +02:00
Carlos Martín Nieto
238df5590c Rename git_config_{type,var} to git_cvar{_type,}
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 12:48:47 +02:00