Commit Graph

2119 Commits

Author SHA1 Message Date
Russell Belfer
26515e73a1 Rename to git_reference_name_to_oid 2012-04-23 10:06:31 -07:00
Russell Belfer
44ef8b1b30 Fix warnings on 64-bit windows builds
This fixes all the warnings on win64 except those in deps, which
come from the regex code.
2012-04-17 10:47:39 -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
Russell Belfer
1a6e8f8a54 Update clar and remove old helpers
This updates to the latest clar which includes the helpers
`cl_assert_equal_s` and `cl_assert_equal_i`.  Convert the code
over to use those and remove the old libgit2-only helpers.
2012-04-17 10:35:11 -07:00
Russell Belfer
dbeca79698 Remove old status implementation
This removes the code for the old status implementation.
2012-04-17 10:35:11 -07:00
Russell Belfer
e8c3774f9b Merge pull request #599 from carlosmn/config-quotes
Support config value quoting
2012-04-16 10:10:05 -07:00
Carlos Martín Nieto
2c1075d65a config: parse quoted values
Variable values may be quoted to include newlines, literal quotes and
other characters. Add support for these and test it.
2012-04-16 10:25:52 +02:00
schu
3fa1ec4af6 tests-clar/repo: fix unused warning
ifdef GIT_WIN32 helper unposix_path() to avoid unused-function warning
on non-Windows systems.

Signed-off-by: schu <schu-github@schulog.org>
2012-04-15 20:30:12 +02:00
Carlos Martín Nieto
146f5c75d7 repo: plug a couple of leaks 2012-04-14 15:09:29 +02:00
Vicent Martí
e77e53edb3 Merge pull request #627 from arrbee/diff-with-pathspec
Diff with pathspec
2012-04-13 20:06:49 -07:00
Russell Belfer
14a513e058 Add support for pathspec to diff and status
This adds preliminary support for pathspecs to diff and status.
The implementation is not very optimized (it still looks at
every single file and evaluated the the pathspec match against
them), but it works.
2012-04-13 15:00:29 -07:00
Vicent Martí
d1f331564d Merge remote-tracking branch 'carlosmn/revwalk-merge-base' into new-error-handling 2012-04-13 20:41:06 +02:00
Vicent Martí
fcb2164ff1 Merge pull request #623 from arrbee/refactor-open
Update git_repository_open
2012-04-13 10:51:58 -07:00
Carlos Martín Nieto
6a62543597 branch: simplify error handling for git_branch_move()
The cleanup needs to happen anyway, so set the error code and jump
there instead of copying the code.
2012-04-12 23:40:41 +02:00
Vicent Martí
bf63cd0bd2 Merge pull request #625 from carlosmn/valgrind
Plug a few leaks
2012-04-12 14:28:15 -07:00
Carlos Martín Nieto
a15156930b local transport: plug leak 2012-04-12 20:54:55 +02:00
Carlos Martín Nieto
6a8bcfa48e branch: plug leaks in git_branch_move() and _delete() 2012-04-12 20:47:46 +02:00
Carlos Martín Nieto
eb8117b841 error-handling: revwalk 2012-04-12 20:27:17 +02:00
Carlos Martín Nieto
bf787bd87c Move git_merge_base() to is own header and document it 2012-04-12 20:25:25 +02:00
Carlos Martín Nieto
f9e4bfa39b revwalk: use a priority queue for calculating merge bases
As parents are older than their children, we're appending to the
commit list most of the time, which makes an ordered linked list quite
inefficient.

While we're there, don't sort the results list in the main loop, as
we're sorting them afterwards and it creates extra work.
2012-04-12 20:25:25 +02:00
Carlos Martín Nieto
5cf7bccd2b revwalk: add test hiding a commit without a merge base
Nothing should be hidden and this shouldn't bother the merge base
calculation.
2012-04-12 20:25:25 +02:00
Carlos Martín Nieto
2c4ef1dd0d revwalk: use merge bases to speed up processing
There is no need walk down the parents of a merge base to mark them as
uninteresting because we'll never see them. Calculate the merge bases
in prepare_walk() so mark_uninteresting() can stop at a merge base
instead of walking all the way to the root.
2012-04-12 20:25:25 +02:00
Carlos Martín Nieto
de7ab85dc6 Implement git_merge_base()
It's implemented in revwalk.c so it has access to the revision
walker's commit cache and related functions. The algorithm is the one
used by git, modified so it fits better with the library's functions.
2012-04-12 20:25:24 +02:00
Carlos Martín Nieto
06b9d91590 revwalk: allow pushing/hiding a reference by name
The code was already there, so factor it out and let users push an OID
by giving it a reference name. Only refs to commits are
supported. Annotated tags will throw an error.
2012-04-12 20:25:24 +02:00
Carlos Martín Nieto
081d229106 revwalk: don't assume malloc succeeds 2012-04-12 20:25:24 +02:00
Russell Belfer
7784bcbbee Refactor git_repository_open with new options
Add a new command `git_repository_open_ext` with extended options
that control how searching for a repository will be done.  The
existing `git_repository_open` and `git_repository_discover` are
reimplemented on top of it.  We may want to change the default
behavior of `git_repository_open` but this commit does not do that.

Improve support for "gitdir" files where the work dir is separate
from the repo and support for the "separate-git-dir" config.  Also,
add support for opening repos created with `git-new-workdir` script
(although I have only confirmed that they can be opened, not that
all functions work correctly).

There are also a few minor changes that came up:

- Fix `git_path_prettify` to allow in-place prettifying.

- Fix `git_path_root` to support backslashes on Win32.  This fix
  should help many repo open/discover scenarios - it is the one
  function called when opening before prettifying the path.

- Tweak `git_config_get_string` to set the "out" pointer to NULL
  if the config value is not found.  Allows some other cleanup.

- Fix a couple places that should have been calling
  `git_repository_config__weakptr` and were not.

- Fix `cl_git_sandbox_init` clar helper to support bare repos.
2012-04-11 12:11:35 -07:00
Russell Belfer
1de77cd314 Cannot set workdir to a nonexistent dir 2012-04-11 12:10:14 -07:00
Vicent Martí
64b402f856 status: Remove status_old
This is Git yo. You can fetch stuff from the history if you need it.
2012-04-11 19:19:12 +02:00
Vicent Martí
e1f6f94a92 tests: Remove unused file 2012-04-11 19:17:21 +02:00
Carlos Martín Nieto
a62053a050 error-handling local transport 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
5eb8affb38 error-handling: fetch 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
fc1cc2051e Use new error handling in the example network code 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
bd6585a7f5 netops: show winsock error messages on Windows 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
56b7df108c error-handling: netops 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
25530fca3b error-handling: http 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
2b386acdb3 error-handling: git transport 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
84d250bfeb error-handling: protocol, pkt 2012-04-11 19:16:10 +02:00
Carlos Martín Nieto
4376f7f6f4 error-handling: remote, transport 2012-04-11 19:16:10 +02:00
nulltoken
d4d648b042 Fix compilation errors and warnings 2012-04-11 15:30:56 +02:00
Carlos Martín Nieto
1a2b87257d Typedefs don't have enum in front 2012-04-11 14:27:40 +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
b78fb64d2f repository: make git_repository_set_workdir() prettify the path it is being passed 2012-04-11 12:40:21 +02:00
Vicent Martí
dcfdb958e2 Merge branch 'new-error-handling' of github.com:libgit2/libgit2 into new-error-handling 2012-04-11 12:38:45 +02:00
nulltoken
4615f0f71b branch: add git_branch_move() 2012-04-10 21:39:06 +02:00
nulltoken
555aa453ba fileops: Make git_futils_mkdir_r() able to skip non-empty directories 2012-04-10 21:39:05 +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
nulltoken
79fd42301e transport/local: Fix peeling of nested tags 2012-04-10 21:39:01 +02:00
nulltoken
3f46f313cb tag: Add git_tag_peel() which recursively peel a tag until a non tag git_object is met 2012-04-10 21:38:49 +02:00
Vicent Martí
efef3795a2 Merge pull request #618 from nulltoken/fix/warning
Fix compilation warning
2012-04-04 10:37:25 -07:00
nulltoken
17bd6de3fb Fix MSVC "unreferenced local variable" compilation warning. 2012-04-04 13:59:58 +02:00