Commit Graph

1915 Commits

Author SHA1 Message Date
Edward Thomson
f0848dd7e0 worktree: upgrade lock to an int 2017-06-04 22:44:30 +01:00
Patrick Steinhardt
883eeb5f90 worktree: switch over worktree pruning to an opts structure
The current signature of `git_worktree_prune` accepts a flags field to
alter its behavior. This is not as flexible as we'd like it to be when
we want to enable passing additional options in the future. As the
function has not been part of any release yet, we are still free to
alter its current signature. This commit does so by using our usual
pattern of an options structure, which is easily extendable without
breaking the API.
2017-05-05 15:39:25 +02:00
Patrick Steinhardt
8264a30f4f worktree: support creating locked worktrees
When creating a new worktree, we do have a potential race with us
creating the worktree and another process trying to delete the same
worktree as it is being created. As such, the upstream git project has
introduced a flag `git worktree add --locked`, which will cause the
newly created worktree to be locked immediately after its creation. This
mitigates the race condition.

We want to be able to mirror the same behavior. As such, a new flag
`locked` is added to the options structure of `git_worktree_add` which
allows the user to enable this behavior.
2017-05-05 15:39:25 +02:00
Patrick Steinhardt
a7aa73a535 worktree: introduce git_worktree_add options
The `git_worktree_add` function currently accepts only a path and name
for the new work tree. As we may want to expand these parameters in
future versions without adding additional parameters to the function for
every option, this commit introduces our typical pattern of an options
struct. Right now, this structure is still empty, which will change with
the next commit.
2017-05-02 12:39:29 +02:00
Patrick Steinhardt
f4d1592c2f global: fix typo in git_libgit2_init description 2017-04-21 07:48:30 +00:00
Carlos Martín Nieto
8d89e40961 Merge pull request #4192 from libgit2/ethomson/win32_posix
Refactor some of the win32 POSIX emulation
2017-04-17 17:19:03 +02:00
Sven Strickroth
d5e6ca1e4a Allow to configure default file share mode for opening files
This can prevent FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache and FILE_SHARE_DELETE, because files can be opened w/o being locked any more.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2017-04-03 23:13:00 +01:00
Remy Suen
a12796dd72 Correct typos that reference a non-existing file
There are references to odb_backends.h when the file is actually named
odb_backend.h and in the sys folder.
2017-04-03 21:25:53 +09:00
Edward Thomson
cc8d9a29e7 win32: introduce do_with_retries macro
Provide a macro that will allow us to run a function with posix-like
return values multiple times in a retry loop, with an optional cleanup
function called between invocations.
2017-04-01 10:47:30 +01:00
Edward Thomson
f623cf894a Merge pull request #4163 from pks-t/pks/submodules-with-worktrees
Worktree fixes
2017-03-22 20:32:55 +00:00
Edward Thomson
6fd6c67824 Merge pull request #4030 from libgit2/ethomson/fsync
fsync all the things
2017-03-22 20:29:22 +00:00
Remy Suen
84b4e5733d Use proper documentation tags
git_cred_acquire_cb isn't using the standard @param and @return tags.
This is causing the generated documentation to not be formatted
properly.
2017-03-22 06:08:24 +09:00
Remy Suen
12b7394cdd Fix typo in remote.h API 2017-03-20 22:30:37 +09:00
Patrick Steinhardt
3017ba94a3 worktree: implement git_worktree_open_from_repository
While we already provide functionality to look up a worktree from a
repository, we cannot do so the other way round. That is given a
repository, we want to look up its worktree if it actually exists.
Getting the worktree of a repository is useful when we want to get
certain meta information like the parent's location, getting the locked
status, etc.
2017-03-17 09:26:13 +01:00
Patrick Steinhardt
bb342159d8 merge_driver: fix const-correctness for source getters 2017-03-15 11:46:15 +01:00
Edward Thomson
2dfd1294f7 hash: include sha1collisiondetection
Include the SHA1 collision attack detection library from
https://github.com/cr-marcstevens/sha1collisiondetection
2017-03-03 10:50:27 +00:00
Edward Thomson
2a5ad7d0f2 fsync: call it "synchronous" object writing
Rename `GIT_OPT_ENABLE_SYNCHRONIZED_OBJECT_CREATION` ->
`GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION`.
2017-02-28 13:29:01 +00:00
Edward Thomson
6d3ad7e09e Add ENABLE_SYNCHRONIZED_OBJECT_CREATION option
Allow users to enable `SYNCHRONIZED_OBJECT_CREATION` with a setting.
2017-02-28 13:27:49 +00:00
Edward Thomson
fc27fe213c odb_loose: actually honor the fsync option
We've had an fsync option for a long time, but it was "ignored".
Stop ignoring it.
2017-02-28 13:27:49 +00:00
David Catmull
19874e2934 Minor comment fix 2017-02-16 08:40:49 -07:00
Edward Thomson
a59545de5e Merge pull request #4122 from pks-t/pks/signature-dbl-free
Signature cleanups
2017-02-13 14:38:12 +00:00
Patrick Steinhardt
dc851d9eae commit: clear user-provided buffers
The functions `git_commit_header_field` and
`git_commit_extract_signature` both receive buffers used to hand back
the results to the user. While these functions called `git_buf_sanitize`
on these buffers, this is not the right thing to do, as it will simply
initialize or zero-terminate passed buffers. As we want to overwrite
contents, we instead have to call `git_buf_clear` to completely reset
them.
2017-02-13 13:50:52 +01:00
Edward Thomson
c576d4fff2 Merge pull request #4115 from gsaralms/users/gsaral/optionalOfsDelta
Changes to provide option to turn off/on ofs_delta
2017-02-13 12:46:00 +00:00
Patrick Steinhardt
1ba242c9ab worktree: extract git_worktree_is_prunable 2017-02-13 11:13:08 +01:00
Patrick Steinhardt
e3acd37b70 branch: implement git_branch_is_checked_out
Implement a new function that is able to determine if a branch is
checked out in any repository connected to the current
repository. In particular, this is required to check if for a
given repository and branch, there exists any working tree
connected to that repository that is referencing this branch.
2017-02-13 11:04:57 +01:00
Patrick Steinhardt
04fb12abb2 worktree: implement functions reading HEAD
Implement `git_repository_head_for_worktree` and
`git_repository_head_detached_for_worktree` for directly accessing a
worktree's HEAD without opening it as a `git_repository` first.
2017-02-13 11:03:01 +01:00
Patrick Steinhardt
f0cfc34105 worktree: implement git_worktree_prune
Implement the `git_worktree_prune` function. This function can be
used to delete working trees from a repository. According to the
flags passed to it, it can either delete the working tree's
gitdir only or both gitdir and the working directory.
2017-02-13 11:02:03 +01:00
Patrick Steinhardt
2a503485fa worktree: implement locking mechanisms
Working trees support locking by creating a file `locked` inside
the tree's gitdir with an optional reason inside. Support this
feature by adding functions to get and set the locking status.
2017-02-13 11:01:09 +01:00
Patrick Steinhardt
dea7488e93 worktree: implement git_worktree_add
Implement the `git_worktree_add` function which can be used to create
new working trees for a given repository.
2017-02-13 11:00:17 +01:00
Patrick Steinhardt
372dc9ff6a worktree: implement git_worktree_validate
Add a new function that checks wether a given `struct
git_worktree` is valid. The validation includes checking if the
gitdir, parent directory and common directory are present.
2017-02-13 10:59:16 +01:00
Patrick Steinhardt
8c8d726ef7 worktree: implement git_repository_open_from_worktree
Add function `git_repository_open_from_worktree`, which allows to open a
`git_worktree` as repository.
2017-02-13 10:59:04 +01:00
Patrick Steinhardt
d3bc09e816 worktree: introduce struct git_worktree
Introduce a new `struct git_worktree`, which holds information
about a possible working tree connected to a repository.
Introduce functions to allow opening working trees for a
repository.
2017-02-13 10:28:15 +01:00
Patrick Steinhardt
45f2b7a43f worktree: implement git_worktree_list
Add new module for working trees with the `git_worktree_list`
function. The function lists names for all working trees of a
certain repository.
2017-02-13 10:28:15 +01:00
Patrick Steinhardt
79ab3ef69f repository: introduce is_worktree variable 2017-02-13 10:28:15 +01:00
Patrick Steinhardt
cb3269c970 repository: add function to retrieve paths for repo items 2017-02-13 10:28:15 +01:00
Patrick Steinhardt
c09fd54e2e repository: introduce commondir variable
The commondir variable stores the path to the common directory.
The common directory is used to store objects and references
shared across multiple repositories. A current use case is the
newly introduced `git worktree` feature, which sets up a separate
working copy, where the backing git object store and references
are pointed to by the common directory.
2017-02-13 10:13:02 +01:00
Gaurav Saral
61acc9fade Changes to provide option to turn off/on ofs_delta
This change provides an option in git_libgit2_opt_t which can be used in git_libgit2_opts to turn off/on ofs_delta capability in libGit2
2017-02-10 15:22:00 +05:30
Remy Suen
93e2c74493 Flag optional parameters for apply and pop
The options parameter in both git_stash_apply and git_stash_pop can
be NULL. They should be flagged as such in the documentation.
2017-02-09 19:12:31 +09:00
Remy Suen
3a13365269 Flag checkout_opts in git_reset as optional
The check_outs argument can be NULL and should be flagged accordingly
in the header file.
2017-02-05 07:12:32 +09:00
Remy Suen
21d4a3783e Flag given_opts in git_revert as optional
The given_opts argument can actually be NULL and thus should be
flagged accordingly in the header file.
2017-02-04 17:24:31 +09:00
Matthew Plough
921493cc94 Update docs for git_oid_fromstrn and p 2017-01-27 14:37:16 -05:00
Etienne Samson
7414acf5f9 parameter 'id' not found in the function declaration 2017-01-23 13:32:34 +01:00
Edward Thomson
8d3b39a6ad Merge branch 'pr/3912' 2017-01-21 23:50:38 +00:00
Edward Thomson
28d0ba0ba5 symbolic ref target validation: fixups
Fixups requested in #3912.
2017-01-21 23:45:23 +00:00
Edward Thomson
44e8af8f29 Merge pull request #3892 from mitesch/shared_buffer
Use a shared buffer in calls of git_treebuilder_write to avoid heap contention
2017-01-21 22:51:50 +00:00
Edward Thomson
9e78b7279d Merge branch 'master' into pr/3938 2017-01-21 22:39:59 +00:00
Brock Peabody
4d99c4cfc6 Allow for caching of submodules.
Added `git_repository_submodule_cache_all` to initialze a cache of
submodules on the repository so that operations looking up N
submodules are O(N) and not O(N^2).  Added a
`git_repository_submodule_cache_clear` function to remove the cache.

Also optimized the function that loads all submodules as it was itself
O(N^2) w.r.t the number of submodules, having to loop through the
`.gitmodules` file once per submodule.  I changed it to process the
`.gitmodules` file once, into a map.

Signed-off-by: David Turner <dturner@twosigma.com>
2017-01-20 17:33:56 -05:00
Edward Thomson
19ed4d0ca3 merge: set default rename threshold
When `GIT_MERGE_FIND_RENAMES` is set, provide a default for
`rename_threshold` when it is unset.
2017-01-01 22:34:43 +00:00
Carlos Martín Nieto
75db289a04 Merge pull request #3980 from tiennou/doc-fixes
Documentation fixes
2016-12-20 19:14:20 +00:00
Carlos Martín Nieto
77e4623257 settings: clarify what each value means
Most importantly, clarify what it means for HTTPS and SSH to be supported.
2016-12-17 14:31:36 +00:00