Commit Graph

10058 Commits

Author SHA1 Message Date
Patrick Steinhardt
b0c9bc920f submodule: resolve URLs relative to main worktree
It is possible to specify submodule URLs relative to the repository
location. E.g. having a submodule with URL "../submodule" will look for
the submodule at "repo/../submodule".

With the introduction of worktrees, though, we cannot simply resolve the
URL relative to the repository location itself. If the repository for
which a URL is to be resolved is a working tree, we have to resolve the
URL relative to the parent's repository path. Otherwise, the URL would
change depending on where the working tree is located.

Fix this by special-casing when we have a working tree while getting the
URL base.
2017-03-17 09:27:56 +01:00
Patrick Steinhardt
097f0105b4 refdb: create references in commondir
References for a repository are usually created inside of its gitdir.
When using worktrees, though, these references are not to be created
inside the worktree gitdir, but instead inside the gitdir of its parent
repository, which is the commondir. Like this, branches will still be
available after the worktree itself has been deleted.

The filesystem refdb currently still creates new references inside of
the gitdir. Fix this and have it create references in commondir.
2017-03-17 09:27:56 +01:00
Patrick Steinhardt
8f154be3eb worktree: write resolved paths into link files
The three link files "worktree/.git", ".git/worktrees/<name>/commondir"
and ".git/worktrees/<name>/gitdir" should always contain absolute and
resolved paths. Adjust the logic creating new worktrees to first use
`git_path_prettify_dir` before writing out these files, so that paths
are resolved first.
2017-03-17 09:27:56 +01:00
Patrick Steinhardt
7cf7a40749 worktree: rename variable in git_worktree_add 2017-03-17 09:27:56 +01:00
Patrick Steinhardt
9dcc79bc6a worktree: use fully qualified reference name for created HEAD
When creating a new worktree, we have to set up the initial data
structures. Next to others, this also includes the HEAD pseudo-ref.
We currently set it to the worktree respectively branch name, which is
actually not fully qualified.

Use the fully qualified branch name instead.
2017-03-17 09:27:55 +01:00
Patrick Steinhardt
20a368e2d7 worktree: parent path should point to the working dir
The working tree's parent path should not point to the parent's gitdir,
but to the parent's working directory. Pointing to the gitdir would not
make any sense, as the parent's working directory is actually equal to
both repository's common directory.

Fix the issue.
2017-03-17 09:27:55 +01: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
dfc9870647 worktree: split off function opening working directory
Separate the logic of finding the worktree directory of a repository and
actually opening the working tree's directory. This is a preparatory
step for opening the worktree structure of a repository itself.
2017-03-17 08:56:18 +01:00
Patrick Steinhardt
3e9c5d8a05 worktree: have is_worktree_dir accept a string instead of buffer
This will be used in later commits, where it becomes cumbersome to
always pass in a buffer.
2017-03-17 08:56:18 +01:00
Patrick Steinhardt
f3c3068670 tests: worktree: use joinpath instead of printf to join paths 2017-03-15 17:16:47 +01:00
Patrick Steinhardt
fdb3e24ac4 tests: worktree: unify init/cleanup in open tests 2017-03-15 14:24:45 +01:00
Patrick Steinhardt
548e5bdf1e tests: worktree: unify init/cleanup in submodule tests 2017-03-15 12:28:05 +01:00
Patrick Steinhardt
aa593a65df tests: worktree: move submodule tests into own suite 2017-03-15 12:01:02 +01:00
Patrick Steinhardt
8051b47f5b Merge branch 'gumenikav/merge_driver_source_info' 2017-03-15 08:20:26 +01:00
Gumenik Alexandr
0608d5df59 merge_driver: add unresolved getters for git_merge_driver_source 2017-03-15 08:19:48 +01:00
Patrick Steinhardt
13bf4d7f13 Merge pull request #4146 from pks-t/pks/winhttp-errors
winhttp: disambiguate error messages when sending requests
2017-03-14 15:04:18 +01:00
Carlos Martín Nieto
53454be87f Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting
Skip uninteresting commits in revwalk timesort iterator
2017-03-11 19:52:05 +01:00
Carlos Martín Nieto
0b3623ac47 Merge pull request #4156 from libgit2/ethomson/readbuffer_dont_hash
git_futils_readbuffer: don't compute sha-1
2017-03-11 19:09:27 +01:00
Edward Thomson
ffd4df6bf2 Merge pull request #4151 from novalis/dturner/rebase-submodule-untracked
rebase: ignore untracked files in submodules
2017-03-09 16:32:38 +00:00
Adam Niedzielski
c11c08a552 Skip uninteresting commits in revwalk timesort iterator
Fixes #4099
2017-03-09 14:01:10 +01:00
Edward Thomson
11c8e756ac git_futils_readbuffer: don't compute sha-1
Don't compute the sha-1 in `git_futils_readbuffer_updated` unless the
checksum was requested.  This means that `git_futils_readbuffer` will
not calculate the checksum unnecessarily.
2017-03-09 12:26:23 +00:00
Edward Thomson
b31b236004 Merge pull request #4154 from libgit2/ethomson/namespaces
Support namespaced references again
2017-03-06 15:53:57 +00:00
Edward Thomson
835805625a refdb_fs: honor the namespace 2017-03-06 14:20:12 +00:00
Edward Thomson
d24ae06d72 refs::namespace: add namespace tests
These simple tests only ensure that we enforce the existence of a
namespace; these mirror the rugged tests, they are not exhaustive.
2017-03-06 14:11:00 +00:00
David Turner
2270ca9f8f rebase: ignore untracked files in submodules
An untracked file in a submodule should not prevent a rebase from
starting.  Even if the submodule's SHA is changed, and that file would
conflict with a new tracked file, it's still OK to start the rebase
and discover the conflict later.

Signed-off-by: David Turner <dturner@twosigma.com>
2017-03-03 15:07:54 -05:00
Carlos Martín Nieto
467185ff13 Merge pull request #4150 from libgit2/ethomson/freshen_trees
git_commit_create: freshen tree objects in commit
2017-03-03 16:12:12 +01:00
Edward Thomson
52d03f37f7 git_commit_create: freshen tree objects in commit
Freshen the tree object that a commit points to during commit time.
2017-03-03 14:12:00 +00:00
Carlos Martín Nieto
3348570a0c Merge pull request #4136 from libgit2/ethomson/sha1dc
Introduce (optional) SHA1 collision attack detection
2017-03-03 12:36:36 +01:00
Edward Thomson
9f128d2a77 cmake: drop unset SHA1_TYPE
We never set `SHA1_TYPE` to `builtin`.  Don't bother testing for it.
2017-03-03 10:50:28 +00:00
Edward Thomson
d087c8f80e hash: test for sha1 collision attack detection 2017-03-03 10:50:28 +00: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
a371a8ae94 hash: rename implementation selection constants 2017-03-03 10:50:27 +00:00
Patrick Steinhardt
ba2bc4911d Merge pull request #4148 from pks-t/pks/fix-haiku-builds
cmake: only enable supported compiler warning flags
2017-03-01 14:51:39 +01:00
Patrick Steinhardt
a02e8a3882 cmake: only enable supported compiler warning flags
We currently unconditionally enable the "-Wall" and "-Wextra" flags.
Some platforms rely on compilers which do not support these flags,
though. One of these platforms is Haiku, which does not support
"-Wextra" due to being stuck on GCC version 2.

Fix builds on such platforms by adding these flags only if supported by
the compiler.
2017-03-01 13:58:15 +01:00
Patrick Steinhardt
a454641ee8 Merge pull request #4145 from pks-t/pks/refs-create-memleak
tests: refs::create: fix memory leak
2017-03-01 08:45:48 +01:00
Patrick Steinhardt
b65a5e9ba9 winhttp: disambiguate error messages when sending requests 2017-03-01 07:58:40 +01:00
Patrick Steinhardt
5aa1f12a81 tests: refs::create: fix memory leak 2017-03-01 07:45:14 +01:00
Patrick Steinhardt
cf8e9a3ad5 Merge pull request #4143 from richardipsum/issue-4094
Fix: make reflog include "(merge)" for merge commits
2017-03-01 07:35:44 +01:00
Richard Ipsum
397cf1a1f5 Add test for inclusion of (merge) in reflog
This test ensures that the string '(merge)' is included in the reflog
when a merge commit is made.
2017-02-28 22:32:21 +00:00
Richard Ipsum
1255a9ac0c Fix: make reflog include "(merge)" for merge commits
This fixes issue #4094
2017-02-27 23:53:12 +00:00
Edward Thomson
a4b5ac643c Merge pull request #4138 from richardipsum/symbolic-create-arbitrary-tgt-test
tests: Add create__symbolic_with_arbitrary_content
2017-02-26 16:12:30 +00:00
Edward Thomson
55d911d69a Merge pull request #4142 from pblesi/patch-1
Fix minor typos in CONVENTIONS.md
2017-02-26 16:08:00 +00:00
Edward Thomson
6313a20855 Merge pull request #4141 from kainjow/patch-2
Fix inet_pton tests triggering an assert in Haiku
2017-02-26 16:01:32 +00:00
Patrick Blesi
c1239e3327 Fix minor typos in CONVENTIONS.md 2017-02-25 23:09:42 -06:00
Kevin Wojniak
4017017740 Fix inet_pton tests triggering an assert in Haiku
Haiku will assert in a nightly build if the "dst" input to inet_pton() is NULL.
2017-02-25 10:21:59 -08:00
Richard Ipsum
b84e58f45d Whitespace and style fixes
Use C style comments as per style guide,
and fix mismatching indentation.
2017-02-25 14:18:16 +00:00
Richard Ipsum
d2b3a21f2b tests: Add create__symbolic_with_arbitrary_content
This test ensures that it's possible to create a symbolic ref that
has arbitrary data as its target. It also ensures it's possible
to obtain the target of that symbolic reference from the git_reference
object.
2017-02-25 14:18:16 +00:00
Edward Thomson
7143145f2f Merge pull request #4137 from libgit2/ethomson/appveyor
appveyor: don't rewrite the system mingw
2017-02-25 12:45:14 +00:00
Edward Thomson
408a7b7737 appveyor: don't rewrite system mingw
Download mingw-w64 into our build directory and execute it there, don't
try to overwrite the system's mingw.
2017-02-24 20:25:45 +00:00
Edward Thomson
c3abb1d261 appveyor: always build the 'appveyor' branch
The 'appveyor' branch is useful for testing AppVeyor builds.
2017-02-24 17:39:01 +00:00