Commit Graph

2276 Commits

Author SHA1 Message Date
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
Carlos Martín Nieto
1c9c081a6a indexer: add git_indexer_stream_free() and _hash() 2012-04-13 22:19:45 +02:00
Carlos Martín Nieto
907ebe8556 examples: stream indexer example 2012-04-13 22:19:45 +02:00
Carlos Martín Nieto
453ab98da0 indexer: Add git_indexer_stream_finalize()
Resolve any lingering deltas, write out the index file and rename the
packfile.
2012-04-13 22:19:45 +02:00
Carlos Martín Nieto
3f93e16cff indexer: start writing the stream indexer
This will allow us to index a packfile as soon as we receive it from
the network as well as storing it with its final name so we don't need
to pass temporary file names around.
2012-04-13 22:19:44 +02:00
Carlos Martín Nieto
fa679339c4 Add packfile_unpack_compressed() to the internal header 2012-04-13 22:16:48 +02:00
Carlos Martín Nieto
45d773efea pack: signal a short buffer when needed 2012-04-13 22:16:48 +02: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
4d53f3e214 filebuf: add option not to buffer the contents at all
The new indexer needs to be able to bypass any kind of buffering, as
it's trying to map data that it has just written to disk.
2012-04-13 09:50:41 +02: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
Carlos Martín Nieto
31e80290a1 mwindow: make sure the whole range is contained inside the same window
Looking through the open windows to check whether we can re-use an
open window should take into account whether both `offset` and `offset
+ extra` are contained within the same window. Failure to do so can
lead to invalid memory accesses. This closes #614.

While we're in the area remove an outdated assert.
2012-04-04 16:26:08 +02:00
nulltoken
17bd6de3fb Fix MSVC "unreferenced local variable" compilation warning. 2012-04-04 13:59:58 +02:00
Carlos Martín Nieto
8e8b6b01f5 Clean up valgrind warnings 2012-04-04 13:13:43 +02:00