Commit Graph

229 Commits

Author SHA1 Message Date
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
Sascha Cunz
7604ddbf70 Tests: Add 3 tags to resources/testrepo.
Adjusts refs::list test (including the comments)
Adjusts objects::tags::list test
2012-09-23 01:02:07 +02:00
nulltoken
c2948c7754 refs: prevent locked refs from being enumerated
Fix #936
2012-09-14 21:56:14 +02:00
nulltoken
e16fc07f7e refspec: No remote tracking ref from a fetchspec-less remote 2012-09-13 22:31:29 +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
Vicent Martí
b9d283d14a Merge pull request #897 from nulltoken/topic/git_reference_check_format
refs: expose git_reference_normalize_name()
2012-08-27 13:39:17 -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
Vicent Martí
8238401ccb Merge pull request #896 from ben/revparse-ambiguous
Revparse: GIT_EAMBIGUOUS
2012-08-25 11:37:23 -07:00
Ben Straub
c9de8611d6 Revparse: GIT_EAMBIGUOUS
Revparse now returns EAMBIGUOUS if the the spec
doesn't match any refs/tags, and is <4 characters.
2012-08-25 09:56:20 -07:00
Russell Belfer
e9ca852e4d Fix warnings and merge issues on Win64 2012-08-23 09:20:17 -07:00
Vicent Martí
f98c32f3fe Merge pull request #778 from ben/clone
Clone
2012-08-19 01:26:06 -07:00
Joshua Peek
e60af90498 Test trailing space after ref oid 2012-08-09 14:39:43 -05:00
Joshua Peek
6ab6829097 Parse ref oids without trailing newline 2012-08-09 12:39:09 -05: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
Ben Straub
32beb2ecfe Fix testrepo ref count to include new branch. 2012-07-27 20:36:12 -07:00
Ben Straub
a4827a5b5c Merge remote-tracking branch 'upstream/development' into test-merge 2012-07-27 11:17:21 -07:00
Vicent Marti
f0244463ad branch: Add repository argument to create
Yes, we can get the repository from the owner of the object, but having
it marked explicitly makes the API more consistent.
2012-07-27 18:49:37 +02:00
Vicent Marti
b41a30bdbb Merge remote-tracking branch 'nulltoken/topic/branch-rework' into development 2012-07-27 18:45:55 +02:00
Vicent Marti
b84f75c357 reflog: Rename entry_drop to drop 2012-07-27 18:43:02 +02:00
nulltoken
c3be5c5af0 reflog: keep the reflog name in sync with the reference name 2012-07-25 08:01:13 +02:00
nulltoken
40c75652d0 reflog: prevent git_reflog_append() from persisting the reflog back to disk 2012-07-25 07:53:32 +02:00
nulltoken
bd72425d16 reflog: introduce git_reflog_write() 2012-07-25 07:53:30 +02:00
nulltoken
d284b3de63 reflog: rename git_reflog_write() to git_reflog_append() 2012-07-25 07:53:30 +02:00
nulltoken
59341a5d59 reflog: introduce git_reflog_entry_drop() 2012-07-25 07:53:29 +02:00
nulltoken
7c458e3aee reflog: add GIT_OID_HEX_ZERO constant 2012-07-25 07:53:27 +02:00
nulltoken
1cb157184b tests: reorganize reflog tests 2012-07-25 07:53:27 +02:00
nulltoken
ef4d795ec5 refs: drop git_reference_remote_tracking_from_branch() 2012-07-24 16:09:49 +02:00
nulltoken
fb910281d6 branch: introduce git_branch_tracking() 2012-07-24 16:09:48 +02:00
nulltoken
bf9e8cc86b branch: make git_branch_move() reference based 2012-07-24 16:09:47 +02:00
nulltoken
88bcd5153f branch: introduce git_reference_is_branch() 2012-07-24 16:09:45 +02:00
nulltoken
eed378b669 branch: introduce git_branch_lookup() 2012-07-24 16:09:44 +02:00
nulltoken
b308c11e4e branch: change git_branch_create() to make it return a reference 2012-07-24 16:09:43 +02:00
nulltoken
326ca710a0 branch: remove useless header 2012-07-24 16:09:42 +02:00
Carlos Martín Nieto
279b45b05b revparse: don't allow an empty string
Asking the library for "" used to give HEAD, but that's trying to
impose a default at the wrong layer. Make it fail.
2012-07-23 21:32:45 +02:00
Ben Straub
3e026f1b45 Update master-tip to fix unit test. 2012-07-17 09:00:38 -07:00
nulltoken
d448392e5d revparse: extend test coverage 2012-07-15 18:41:55 +02:00
nulltoken
d1b7921a48 revparse: fix disambiguation of refs and abbrev oids 2012-07-12 22:30:00 +02:00
nulltoken
bb89cf9478 revparse: simplify handling of the colon syntax 2012-07-12 22:29:58 +02:00
Vicent Martí
0cf6b2f29e Merge pull request #805 from nulltoken/fix/revwalk-email-parsing
Fix revwalk email parsing
2012-07-12 09:37:09 -07:00
nulltoken
84f18e3587 refs: introduce git_reference_remote_tracking_from_branch() 2012-07-12 01:06:13 +02:00
nulltoken
874303d468 refs: readonly tests don't need a sandboxed repo 2012-07-12 01:06:12 +02:00
nulltoken
5b07111529 tests: add test commit with angle brackets in the author name 2012-07-11 20:40:12 +02:00
nulltoken
3e82d6c6f0 revparse: unfound reference return ENOTFOUND 2012-07-07 12:16:15 +02:00
nulltoken
ce9e8e11ca revparse: fix invalid test reference name 2012-07-07 12:16:14 +02:00
nulltoken
b8460c2015 revparse: do not segfault when retrieving the last entry 2012-07-07 12:16:14 +02:00
nulltoken
3d78ab6427 revparse: split reflog test per feature 2012-07-07 12:16:12 +02:00
nulltoken
3cd90893a0 revparse: enhance upstream reflog test coverage 2012-07-07 12:16:11 +02:00
nulltoken
35bed94fd5 revparse: enhance refs/<name> coverage 2012-07-07 12:16:10 +02:00
nulltoken
cab65c2b23 revparse: detect incorrect "refname@{-n}" syntax 2012-07-07 12:16:08 +02:00
nulltoken
1decf88bc1 revparse: slightly improve readability of tests 2012-07-07 12:16:08 +02:00
nulltoken
34922eeeed revparse: readonly tests don't need a sandboxed repo 2012-07-07 12:16:07 +02:00
nulltoken
d0a920a6fd refs: deep unfound ref returns ENOTFOUND 2012-07-07 12:15:30 +02:00
nulltoken
75261421ec refs: add git_reference_has_log() 2012-07-07 12:15:28 +02:00
nulltoken
b6bfd96fdd refs: fix moving of the reflog when renaming a ref 2012-07-07 12:15:28 +02:00
nulltoken
494ae940a0 revparse: fix parsing of date specifiers 2012-07-02 19:56:41 +02:00
nulltoken
52b938d55a revparse: unfound reflog entry returns ENOTFOUND 2012-06-29 17:23:18 +02:00
nulltoken
08ac23a5fd revparse: unfound reflog ref returns ENOTFOUND 2012-06-29 17:23:10 +02:00
nulltoken
4de89ce72a revparse: unfound partially-named ref returns ENOTFOUND 2012-06-29 17:22:43 +02:00
nulltoken
0e7af9e758 revparse: unfound nth parent returns ENOTFOUND 2012-06-28 19:12:42 +02:00
nulltoken
0d23c62c48 revparse: handle specs with caret and colon 2012-06-28 19:12:41 +02:00
nulltoken
5b68ba7e15 revparse: unfound treepath returns ENOTFOUND 2012-06-28 19:12:40 +02:00
nulltoken
faaa7c517c revparse: return trees through the "colon" syntax 2012-06-28 19:12:40 +02:00
nulltoken
e28dd29b6e revparse: replace spaces with tabs 2012-06-28 19:12:39 +02:00
nulltoken
527ed55448 references: introduce git_reference_foreach_glob() 2012-06-22 21:40:24 +02:00
nulltoken
d046945cef Fix MSVC compilation errors 2012-06-22 16:42:37 +03:00
Michael Schubert
f7292a990c tests-clar: mark unused variables 2012-06-22 10:13:50 +02:00
nulltoken
d4827081ea branch: drop git_branch_list() 2012-06-21 18:51:32 +02:00
nulltoken
a8fd805e2f branch: add git_branch_foreach() 2012-06-21 18:51:27 +02:00
Ben Straub
eb6bc45f6d Avoid uninitialized variable error. 2012-06-19 21:11:48 -07:00
Ben Straub
2c90145aad Fix potential segfault in revparse. 2012-06-19 09:25:55 -07:00
Frederick Ros
fa45d25f38 Fix issue #763 2012-06-13 17:35:13 +02:00
Ben Straub
e272efcb20 Tests: wrap 'getenv' and friends for Win32 tests. 2012-06-08 11:24:37 -07:00
Ben Straub
763b838152 Fixing rev-parse-induced Travis errors. 2012-06-07 13:22:50 -07:00
Ben Straub
56a5000d58 Merge branch 'development' into rev-parse
Conflicts:
	src/util.h
	tests-clar/refs/branches/listall.c
2012-06-05 12:52:44 -07:00
Ben Straub
734efe4b8e Rev-parse: implement ":/foo" syntax. 2012-06-01 14:18:52 -07:00
Ben Straub
2497106f91 Rev-parse: add test with deeper path. 2012-06-01 11:41:54 -07:00
Ben Straub
244d2f6b80 Rev-parse: add "tag:README" syntax. 2012-05-30 16:52:11 -07:00
Vicent Martí
59d91979d8 Merge pull request #710 from libgit2/breaking-changes
Break everything before the release
2012-05-18 13:53:38 -07:00
Vicent Martí
904b67e69f errors: Rename error codes 2012-05-18 01:48:50 +02: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
nulltoken
392eced6f0 branch: retrieve symbolic references when listing the branches 2012-05-18 00:26:04 +02:00
Vicent Martí
1c3a5a0302 Merge pull request #693 from nulltoken/topic/enhance_branch_move_test_coverage
branch: cover with test that moving a non existing branch returns ENOTFOUND
2012-05-14 11:25:55 -07:00
nulltoken
48ce97dd96 branch: cover with test that moving a non existing branch returns ENOTFOUND 2012-05-13 11:03:29 +02:00
nulltoken
341a7136f6 branch: make git_branch_delete() return GIT_ENOTFOUND when the branch doesn't exist 2012-05-13 10:30:13 +02:00
Ben Straub
7c22e72ba6 Removing test whose results are platform-dependent. 2012-05-11 12:21:58 -07:00
Ben Straub
72b86bae50 Rev-parse: better error handling for chaining.
Fixed an error where "nonexistant^N" or similar
would fall into an assert. This now properly returns
an error.
2012-05-11 11:58:02 -07:00
Ben Straub
92ad5a5cda Rebasing onto libgit2/development: cleanup. 2012-05-11 11:55:20 -07:00
Ben Straub
c8a33547a0 Rev-parse: now capturing and reporting regex errors. 2012-05-11 11:35:50 -07:00
Ben Straub
46c2ead05d Now properly handling branches with "-g" in their names. 2012-05-11 11:35:50 -07:00
Ben Straub
d13c1a8b60 Fixing broken tests. 2012-05-11 11:35:50 -07:00
Ben Straub
a346992f7e Rev-parse: @{time} syntax.
Ported date.c (for approxidate_careful) from git.git
revision aa39b85. Trimmed out the parts we're not
using.
2012-05-11 11:35:50 -07:00
Ben Straub
886f183ac3 Rev-parse: "ref^{/regex}" syntax. 2012-05-11 11:31:30 -07:00
Ben Straub
a6346302e6 Rev-parse: "ref@{upstream}" syntax.
Added tracking configuration to the test repo's
config to support unit tests.
2012-05-11 11:30:47 -07:00
Ben Straub
27ee848397 Rev-parse: plugging (most) memory leaks. 2012-05-11 11:30:46 -07:00
Ben Straub
5748fdee52 Rev-parse chaining: adding the longest chain
in the test repo.
2012-05-11 11:30:46 -07:00
Ben Straub
a51bdbcfa1 Implementing rev-parse's ref@{n} and @{-n} syntaxes.
Added some reflags to the test repo to support
unit tests.
2012-05-11 11:30:46 -07:00
Ben Straub
38533d5acf Implementing rev-parse's "ref~2" syntax.
Also extended the test suite to include chaining
operators, e.g. "master^2~3^4".
2012-05-11 11:30:46 -07:00
Ben Straub
7149a6252c Returning error if dereferencing operation fails. 2012-05-11 11:30:46 -07:00
Ben Straub
387d01b857 Implemented rev-parse "^{type}" syntax. 2012-05-11 11:30:45 -07:00
Ben Straub
9d7bdf7119 Implemented rev-parse's "^{}" syntax. 2012-05-11 11:30:45 -07:00
Ben Straub
f597ea8978 Implemented partial caret syntax for rev-parse.
Supported forms:
- "^n"
- "^0"
- "^"

Still missing: all of the "^{…}" variants.
2012-05-11 11:30:45 -07:00
Ben Straub
023c6f69ed Simpler states and initial structure.
New tests for "foo^2" syntax, but they don't pass
yet. Support for chaining these, i.e.
"foo^2~3^{u}~1' is starting to shape up.
2012-05-11 11:30:45 -07:00
Ben Straub
ac250c56c7 First stab at implementation of rev-parse.
This version supports refspecs of these kinds:
- Full & partial SHAs
- Output from "git describe"
- "/refs/heads/master" (full ref names)
- "master" (partial ref names)
- "FETCH_HEAD" (named heads)
2012-05-11 11:30:45 -07:00
Vicent Martí
b02bcd97f8 Boom 2012-05-02 16:57:16 -07:00
Vicent Martí
946a6dc4e6 Update test suite 2012-05-02 16:14:30 -07:00
Vicent Martí
40879facad Merge branch 'new-error-handling' into development
Conflicts:
	.travis.yml
	include/git2/diff.h
	src/config_file.c
	src/diff.c
	src/diff_output.c
	src/mwindow.c
	src/path.c
	tests-clar/clar_helpers.c
	tests-clar/object/tree/frompath.c
	tests/t00-core.c
	tests/t03-objwrite.c
	tests/t08-tag.c
	tests/t10-refs.c
	tests/t12-repo.c
	tests/t18-status.c
	tests/test_helpers.c
	tests/test_main.c
2012-05-02 15:59:02 -07: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
Vicent Martí
e1f6f94a92 tests: Remove unused file 2012-04-11 19:17:21 +02:00
Vicent Martí
0a20eee953 Merge pull request #619 from nulltoken/topic/branches
Basic branch management API
2012-04-11 03:43:30 -07:00
nulltoken
4615f0f71b branch: add git_branch_move() 2012-04-10 21:39:06 +02:00
nulltoken
731df57080 Add basic branch management API: git_branch_create(), git_branch_delete(), git_branch_list() 2012-04-10 21:39:03 +02:00
Carlos Martín Nieto
8e8b6b01f5 Clean up valgrind warnings 2012-04-04 13:13:43 +02:00
Vicent Martí
471bb8b120 tests: Cleanup & fix test suite 2012-04-03 04:52:52 +02:00
nulltoken
09719c500c reference: Fix creation of references with extended ASCII characters in their name 2012-04-01 14:33:32 +02:00
Ben Straub
b173121555 Simple readability fixes. 2012-03-31 20:12:29 -07:00
Ben Straub
20ec426dde Discovered cl_git_strequal! Mounted a crusade! 2012-03-31 19:47:59 -07:00
Ben Straub
270303ca7a Moved more assertions inside Clar test helpers. 2012-03-31 15:51:35 -07:00
Ben Straub
8e82600e67 Ref normalization test helpers now doing internal asserts. 2012-03-31 14:14:31 -07:00
Ben Straub
00a48934f1 t10-refs.c ported. 2012-03-30 12:05:42 -07:00
schu
90e6c6203d tests-clar: fix warning sign-compare
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 12:13:05 +01:00
nulltoken
99abb79d53 repository: ensure that the path to the .git directory ends with a forward slash when opening a repository through a working directory path
This fixes an issue which was detected while using one of the libgit2 bindings [0]. The lack of the trailing forward slash led the name of references returned by git_reference_listall() to be prefixed with a forward slash.

  [0]: https://github.com/libgit2/libgit2sharp/pull/108
2012-02-03 12:46:50 +01:00
Vicent Martí
3fd1520cd4 Rename the Clay test suite to Clar
Clay is the name of a programming language on the makings, and we want
to avoid confusions. Sorry for the huge diff!
2012-01-24 20:35:15 -08:00