|
0dd98b69
|
2016-04-03T17:22:07
|
|
Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars
git_repository_open_ext provides parameters for the start path, whether
to search across filesystems, and what ceiling directories to stop at.
git commands have standard environment variables and defaults for each
of those, as well as various other parameters of the repository. To
avoid duplicate environment variable handling in users of libgit2, add a
GIT_REPOSITORY_OPEN_FROM_ENV flag, which makes git_repository_open_ext
automatically handle the appropriate environment variables. Commands
that intend to act just like those built into git itself can use this
flag to get the expected default behavior.
git_repository_open_ext with the GIT_REPOSITORY_OPEN_FROM_ENV flag
respects $GIT_DIR, $GIT_DISCOVERY_ACROSS_FILESYSTEM,
$GIT_CEILING_DIRECTORIES, $GIT_INDEX_FILE, $GIT_NAMESPACE,
$GIT_OBJECT_DIRECTORY, and $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the
future, when libgit2 gets worktree support, git_repository_open_env will
also respect $GIT_WORK_TREE and $GIT_COMMON_DIR; until then,
git_repository_open_ext with this flag will error out if either
$GIT_WORK_TREE or $GIT_COMMON_DIR is set.
|
|
ed577134
|
2016-04-03T19:24:15
|
|
Fix repository discovery with ceiling_dirs at current directory
git only checks ceiling directories when its search ascends to a parent
directory. A ceiling directory matching the starting directory will not
prevent git from finding a repository in the starting directory or a
parent directory. libgit2 handled the former case correctly, but
differed from git in the latter case: given a ceiling directory matching
the starting directory, but no repository at the starting directory,
libgit2 would stop the search at that point rather than finding a
repository in a parent directory.
Test case using git command-line tools:
/tmp$ git init x
Initialized empty Git repository in /tmp/x/.git/
/tmp$ cd x/
/tmp/x$ mkdir subdir
/tmp/x$ cd subdir/
/tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x git rev-parse --git-dir
fatal: Not a git repository (or any of the parent directories): .git
/tmp/x/subdir$ GIT_CEILING_DIRECTORIES=/tmp/x/subdir git rev-parse --git-dir
/tmp/x/.git
Fix the testsuite to test this case (in one case fixing a test that
depended on the current behavior), and then fix find_repo to handle this
case correctly.
In the process, simplify and document the logic in find_repo():
- Separate the concepts of "currently checking a .git directory" and
"number of iterations left before going further counts as a search"
into two separate variables, in_dot_git and min_iterations.
- Move the logic to handle in_dot_git and append /.git to the top of the
loop.
- Only search ceiling_dirs and find ceiling_offset after running out of
min_iterations; since ceiling_offset only tracks the longest matching
ceiling directory, if ceiling_dirs contained both the current
directory and a parent directory, this change makes find_repo stop the
search at the parent directory.
|
|
39c6fca3
|
2016-04-03T16:01:01
|
|
Add GIT_REPOSITORY_OPEN_NO_DOTGIT flag to avoid appending /.git
GIT_REPOSITORY_OPEN_NO_SEARCH does not search up through parent
directories, but still tries the specified path both directly and with
/.git appended. GIT_REPOSITORY_OPEN_BARE avoids appending /.git, but
opens the repository in bare mode even if it has a working directory.
To support the semantics git uses when given $GIT_DIR in the
environment, provide a new GIT_REPOSITORY_OPEN_NO_DOTGIT flag to not try
appending /.git.
|
|
8fd74c08
|
2016-02-09T12:18:28
|
|
Avoid old-style function definitions
Avoid declaring old-style functions without any parameters.
Functions not accepting any parameters should be declared with
`void fn(void)`. See ISO C89 $3.5.4.3.
|
|
fe345c73
|
2016-02-09T12:29:31
|
|
Remove unused static functions
|
|
faebc1c6
|
2016-06-20T17:44:04
|
|
threads: split up OS-dependent thread code
|
|
bb0bd71a
|
2016-06-15T15:47:28
|
|
checkout: use empty baseline when no index
When no index file exists and a baseline is not explicitly provided, use
an empty baseline instead of trying to load `HEAD`.
|
|
292c6027
|
2016-06-07T12:29:16
|
|
tests: fix memory leaks in checkout::typechange
|
|
5acf18ac
|
2016-06-02T01:58:25
|
|
rebase: test rebasing a new commit with subfolder
Test a rebase (both a merge rebase and an inmemory rebase) with a new
commit that adds files underneath a new subfolder.
|
|
91fbf9d8
|
2016-06-01T22:31:16
|
|
test: ensure we can round-trip a written tree
Read a tree into an index, write the index, then re-open the index and
ensure that we are treesame to the original.
|
|
5baa20b8
|
2016-06-01T14:52:25
|
|
round-trip trees through index_read_index
Read a tree into an index using `git_index_read_index` (by reading
a tree into a new index, then reading that index into the current
index), then write the index back out, ensuring that our new index
is treesame to the tree that we read.
|
|
c2f18b9b
|
2016-05-26T10:51:16
|
|
cleanup: unused warning
|
|
e102daa4
|
2016-05-26T10:25:40
|
|
Merge pull request #3798 from mmuman/stat-test-fix
test: Fix stat() test to mask out unwanted bits
|
|
afab1fff
|
2016-02-16T21:02:41
|
|
checkout: handle dirty submodules correctly
Don't generate conflicts when checking out a modified submodule and the
submodule is dirty or modified in the workdir.
|
|
407f2e9f
|
2016-05-24T19:07:09
|
|
test: Fix stat() test to mask out unwanted bits
Haiku and Hurd both pass extra bits in struct stat::st_mode.
|
|
a2cb4713
|
2016-05-24T14:30:43
|
|
tree: handle removal of all entries in the updater
When we remove all entries in a tree, we should remove that tree from
its parent rather than include the empty tree.
|
|
53412305
|
2016-05-19T15:29:53
|
|
tree: plug leaks in the tree updater
|
|
92249656
|
2016-05-19T15:21:26
|
|
tree: use testrepo2 for the tree updater tests
This gives us trees with subdirectories, which the new test needs.
|
|
9464f9eb
|
2016-05-02T17:36:58
|
|
Introduce a function to create a tree based on a different one
Instead of going through the usual steps of reading a tree recursively
into an index, modifying it and writing it back out as a tree, introduce
a function to perform simple updates more efficiently.
`git_tree_create_updated` avoids reading trees which are not modified
and supports upsert and delete operations. It is not as versatile as
modifying the index, but it makes some common operations much more
efficient.
|
|
17a93afa
|
2016-05-06T18:44:37
|
|
Merge pull request #3757 from johnhaley81/jh/fix-create-initial-commit
Fix `git_commit_create` for an initial commit
|
|
5785ae9b
|
2016-05-04T11:14:17
|
|
Fix initial commit test
`test_commit_commit__create_initial_commit_parent_not_current` was not correctly
testing that `HEAD` was not changed. Now we grab the oid that it was pointing to
before the call to `git_commit_create` and the oid that it's pointing to afterwards
and compare those.
|
|
4f22ccb9
|
2016-05-03T13:32:22
|
|
Add tests for creating an initial commit
|
|
c7b4bbff
|
2016-05-03T15:22:22
|
|
rebase: test rebase (merge) w/ no common ancestor
|
|
d383c39b
|
2016-04-28T12:47:14
|
|
Introduce `git_signature_from_buffer`
Allow users to construct a signature from the type of signature
lines that actually appear in commits.
|
|
b3ffd8f6
|
2016-04-26T11:48:11
|
|
rebase::abort: test we can abort rebase by revspec
Test that we can properly abort a rebase when it is initialized by a
revspec. This ensures that we do not conflate revspecs and refnames.
|
|
9068704b
|
2016-04-26T11:02:45
|
|
Merge pull request #3749 from arthurschreiber/arthur/add-git-reference-dup
Allow creating copies of `git_reference` objects.
|
|
c30955e0
|
2016-04-26T11:02:05
|
|
Merge pull request #3748 from libgit2/ethomson/rebase_detached
Rebase improvements with IDs
|
|
eb39284b
|
2016-04-25T12:16:05
|
|
tag: ignore extra header fields
While no extra header fields are defined for tags, git accepts them by
ignoring them and continuing the search for the message. There are a few
tags like this in the wild which git parses just fine, so we should do
the same.
|
|
908f24fd
|
2016-04-22T10:34:17
|
|
Allow creating copies of `git_reference` objects.
|
|
1f84caf0
|
2016-04-21T18:16:37
|
|
rebase: correctly finish rebasing detached heads
When rebasing with IDs, we do not return to the `branch`,
we remain in a detached HEAD state.
|
|
320f53cd
|
2016-04-21T17:03:21
|
|
rebase: test abort immediately after init
Instead of `open`ing a rebase and `abort`ing that, test that we can
`abort` a rebase that has just begun with `init`.
|
|
0bd77401
|
2016-04-21T11:05:21
|
|
clone test: annotate unused vars
|
|
1dc44910
|
2016-04-19T19:48:52
|
|
Merge pull request #3110 from libgit2/cmn/proxy-config
Proxy configuration
|
|
1c3018eb
|
2016-04-18T13:34:18
|
|
ignore: fix directory limits when searching for star-star
In order to match the star-star, we disable the flag that's looking for
a single path element, but that leads to searching for the pattern in
the middle of elements in the input string.
Mark when we're handing a star-star so we jump over the elements in our
attempt to match the part of the pattern that comes after the star-star.
While here, tighten up the check so we don't allow invalid rules
through.
|
|
4e017413
|
2015-09-21T21:11:02
|
|
netops: make the path optional in URLs
When we're dealing with proxy addresses, we only want a hostname and
port, and the user would not provide a path, so make it optional so we
can use this same function to parse git as well as proxy URLs.
|
|
b117721d
|
2015-07-29T21:23:56
|
|
proxy: use poxy to test our Windows proxy support
|
|
07bd3e57
|
2015-05-07T12:57:56
|
|
proxy: ask the user for credentials if necessary
|
|
0d72f67f
|
2016-03-14T17:36:04
|
|
proxy: don't specify the protocol in the type
We leave this up to the scheme in the url field. The type should only
tell us about whether we want a proxy and whether we want to auto-detect
it.
|
|
0f362716
|
2016-03-31T17:38:40
|
|
Add more tests for path matching with globs and path delimiters
|
|
bbd65ad2
|
2016-04-11T13:39:31
|
|
tests: skip the unreadable file tests as root
When running as root, skip the unreadable file tests, because, well,
they're probably _not_ unreadable to root unless you've got some
crazy NSA clearance-level honoring operating system shit going on.
|
|
0e00eecf
|
2016-04-11T13:29:54
|
|
Merge pull request #3736 from libgit2/cmn/dwim-general-message
refs: provide a more general error message for dwim
|
|
d22a8b95
|
2016-04-11T11:50:11
|
|
refs::create: strict object creation on by default
When we turned strict object creation validation on by default, we
forgot to inform the refs::create tests of this. They, in fact,
believed that strict object creation was off by default. As a result,
their cleanup function went and turned strict object creation off for
the remaining tests.
|
|
6d22ef7a
|
2016-04-11T11:37:02
|
|
reset: use real ids for the tests
This lets us run with strict object creation on.
|
|
77965c68
|
2016-04-11T17:43:07
|
|
refs: provide a more general error message for dwim
If we cannot dwim the input, set the error message to be explicit about
that. Otherwise we leave the error for the last failed lookup, which
can be rather unexpected as it mentions a remote when the user thought
they were trying to look up a branch.
|
|
04f47a43
|
2016-04-06T10:37:30
|
|
tests: fix core/stream test when built with openssl off
When passing -DUSE_OPENSSL:BOOL=OFF to cmake the testsuite will
fail with the following error:
core::stream::register_tls [/tmp/libgit2/tests/core/stream.c:40]
Function call failed: (error)
error -1 - <no message>
Fix test to assume failure for tls when built without openssl.
While at it also fix GIT_WIN32 cpp to check if it's defined
or not.
|
|
381caf56
|
2016-04-02T22:19:42
|
|
Merge pull request #3724 from ethomson/submodule_start_supports_silly_slashes
iterator/diff: allow trailing `/` on start/end paths to match submodules
|
|
d47f7e1c
|
2016-04-02T13:03:09
|
|
iterator: support trailing `/` in start for submod
Allow callers to specify a start path with a trailing slash to match
a submodule, instead of just a directory. This is for some legacy
behavior that's sort of dumb, but there it is.
|
|
2e0391f4
|
2016-04-02T11:33:00
|
|
diff: test submodules are found with trailing `/`
Test that submodules are found when the are included in a pathspec
but have a trailing slash.
|
|
d364dc8b
|
2016-04-01T14:33:42
|
|
ignore: don't use realpath to canonicalize path
If we're looking for a symlink, realpath will give us the resolved path,
which is not what we're after, but a canonicalized version of the path
the user asked for.
|
|
1cac688d
|
2016-04-01T00:29:51
|
|
Merge pull request #3719 from libgit2/ethomson/submodule_status
WD iterator: properly identify submodules
|
|
74ab5f2c
|
2016-03-31T17:33:44
|
|
status: test submodules with mixed case
|
|
17442b28
|
2016-03-30T17:47:05
|
|
leaks: fix some leaks in the tests
|
|
f5c874a4
|
2016-03-29T14:47:31
|
|
Plug a few leaks
|
|
2f0450f4
|
2016-03-29T03:26:43
|
|
Merge pull request #3712 from ethomson/config_duplicate_section
config: don't write duplicate section
|
|
b085ecbe
|
2016-03-28T13:51:21
|
|
Merge pull request #3703 from libgit2/cmn/multivar-set-locked
config: don't special-case multivars that don't exist yet
|
|
76e1a679
|
2016-03-28T08:56:13
|
|
config::write::repeated: init our buffer
|
|
3e95bd36
|
2016-03-04T14:51:16
|
|
config: show we write a spurious duplicated section header
We should notice that we are in the correct section to add. This is a
cosmetic bug, since replacing any of these settings does work.
|
|
c017c183
|
2016-03-22T10:29:12
|
|
iterator: new workdir-iterator test for pathlist + includings trees
|
|
09064f15
|
2016-03-22T10:28:50
|
|
iterator: new index-iterator test for pathlist + includings trees
|
|
8152a748
|
2016-03-22T10:27:50
|
|
iterator: more pathlist-related tests should test actual paths
|
|
d712c2b2
|
2016-03-21T18:30:21
|
|
iterator: don't run the gunk test by default on CI
(It's slow!)
|
|
0ef0b71c
|
2016-03-21T12:54:47
|
|
iterator: refactor index iterator
|
|
ba6f86eb
|
2016-03-18T17:33:46
|
|
Introduce `git_path_common_dirlen`
|
|
de034cd2
|
2016-03-18T10:59:38
|
|
iterator: give the tests a proper hierarchy
Iterator tests were split over repo::iterator and diff::iterator,
with duplication between the two. Move them to iterator::index,
iterator::tree, and iterator::workdir.
|
|
df25daef
|
2016-01-04T12:12:24
|
|
Added clar test for #3568
|
|
6cd9573f
|
2016-03-17T15:09:38
|
|
iterator: test that we can `advance_into` empty dirs
Prior iterator implementations returned `GIT_ENOTFOUND` when
trying to advance into empty directories. Ensure that we no longer
do that and simply handle them gracefully.
|
|
b6204260
|
2016-02-10T13:46:14
|
|
Failing test.
|
|
ae86aa5a
|
2016-03-16T11:38:02
|
|
iterator: test pathlist handling for directories
tree_iterator was only working properly for a pathlist containing
file paths. In case of directory paths, it didn't match children
which contradicts GIT_DIFF_DISABLE_PATHSPEC_MATCH and
is different from index_iterator and fs_iterator.
As a consequence head-to-index status reporting for a specific
directory did not work properly -- all files have been reported
as added.
Include additional tests.
|
|
6bcddf88
|
2016-03-16T17:14:36
|
|
iterator: test `advance_over` with a pathlist
|
|
9fb2527f
|
2016-03-16T16:29:38
|
|
iterator: add tests for advance_over
`git_iterator_advance_over` is a gnarly bit of code with no actual
tests.
|
|
85541f43
|
2016-03-16T13:31:35
|
|
iterator: test workdir pathlist with deep paths
In the workdir iterator we do some tricky things to step down into
directories to look for things that are in our pathlist. Make sure
that we don't confuse between folders that we're definitely going to
return everything in and folders that we're only stepping down into
to keep looking for matches.
|
|
908d8de8
|
2016-03-16T12:15:55
|
|
iterator: workdir tests with submodules
Ensure that when specifying start/end paths, or pathlists, that we
deal correctly with submodules.
|
|
c3d195f1
|
2016-03-16T11:45:44
|
|
iterator: expand workdir tests with pathlist
Expand the workdir tests to validate the paths in case sensitive
and insensitive tests.
|
|
4c88198a
|
2016-03-16T10:17:20
|
|
iterator: test that we're at the end of iteration
Ensure that we have hit the end of iteration; previously we tested
that we saw all the values that we expected to see. We did not
then ensure that we were at the end of the iteration (and that there
were subsequently values in the iteration that we did *not* expect.)
|
|
d051de24
|
2016-03-10T12:54:33
|
|
iterator: test fs iterator w/ many nested empty dirs
|
|
a4f520a6
|
2016-03-10T11:07:13
|
|
iterator: skip unreadable directories in fs iterator
Do not abort iteration in the middle when encountering an unreadable
directory. Instead, skip it, as if it didn't exist.
|
|
be30387e
|
2016-02-25T16:05:18
|
|
iterators: refactored tree iterator
Refactored the tree iterator to never recurse; simply process the
next entry in order in `advance`. Additionally, reduce the number of
allocations and sorting as much as possible to provide a ~30% speedup
on case-sensitive iteration. (The gains for case-insensitive iteration
are less majestic.)
|
|
277c85eb
|
2016-03-02T15:38:13
|
|
repo::iterator: don't go out of bounds
|
|
684b35c4
|
2016-02-25T15:11:14
|
|
iterator: disambiguate reset and reset_range
Disambiguate the reset and reset_range functions. Now reset_range
with a NULL path will clear the start or end; reset will leave the
existing start and end unchanged.
|
|
8a5a2e2f
|
2016-03-17T00:47:50
|
|
status: update test to include valid OID
|
|
661db4f4
|
2016-03-23T03:45:53
|
|
Merge pull request #3704 from ethomson/tree-reuse
tree: drop the now-unnecessary entries vector
|
|
6669e3e8
|
2015-11-08T04:28:08
|
|
blob: remove _fromchunks()
The callback mechanism makes it awkward to write data from an IO
source; move to `_fromstream()` which lets the caller remain in control,
in the same vein as we prefer iterators over foreach callbacks.
|
|
35e68606
|
2015-11-04T10:36:50
|
|
blob: fix fromchunks iteration counter
By returning when the count goes to zero rather than below it, setting
`howmany` to 7 in fact writes out the string 6 times.
Correct the termination condition to write out the string the amount of
times we specify.
|
|
0a5c6028
|
2015-11-04T10:30:48
|
|
blob: introduce creating a blob by writing into a stream
The pair of `git_blob_create_frombuffer()` and
`git_blob_create_frombuffer_commit()` is meant to replace
`git_blob_create_fromchunks()` by providing a way for a user to write a
new blob when they want filtering or they do not know the size.
This approach allows the caller to retain control over when to add data
to this buffer and a more natural fit into higher-level language's own
stream abstractions instead of having to handle IO wait in the callback.
The in-memory buffer size of 2MB is chosen somewhat arbitrarily to be a
round multiple of usual page sizes and a value where most blobs seem
likely to be either going to be way below or way over that size. It's
also a round number of pages.
This implementation re-uses the helper we have from `_fromchunks()` so
we end up writing everything to disk, but hopefully more efficiently
than with a default filebuf. A later optimisation can be to avoid
writing the in-memory contents to disk, with some extra complexity.
|
|
e2e4bae9
|
2016-03-22T00:18:44
|
|
tree: drop the now-unnecessary entries vector
Remove the now-unnecessary entries vector. Add `git_array_search`
to binary search through an array to accomplish this.
|
|
6f09911c
|
2016-03-21T21:10:26
|
|
config: don't special-case multivars that don't exist yet
This special-casing ignores that we might have a locked file, so the
hashtable does not represent the contents of the file we want to
write. This causes multivar writes to overwrite entries instead of add
to them when under lock.
There is no need for this as the normal code-path will write to the file
just fine, so simply get rid of it.
|
|
60a194aa
|
2016-03-20T11:00:12
|
|
tree: re-use the id and filename in the odb object
Instead of copying over the data into the individual entries, point to
the originals, which are already in a format we can use.
|
|
d953c450
|
2016-02-28T21:30:00
|
|
merge drivers: handle configured but not found driver
|
|
6d8b2cdb
|
2016-02-28T09:34:11
|
|
merge driver: remove `check` callback
Since the `apply` callback can defer, the `check` callback is not
necessary. Removing the `check` callback further makes the `payload`
unnecessary along with the `cleanup` callback.
|
|
58d33126
|
2015-12-26T19:47:17
|
|
merge driver: tests for set and unset merge attribute
Ensure that setting the merge attribute forces the built-in default
`text` driver and does *not* honor the `merge.default` configuration
option. Further ensure that unsetting the merge attribute forces
a conflict (the `binary` driver).
|
|
d3f0875a
|
2015-12-25T00:34:39
|
|
merge driver: tests for custom default merge drivers
|
|
7d307c1e
|
2015-12-23T23:52:02
|
|
merge driver: test GIT_EMERGECONFLICT
When a `check` or `apply` callback function returns `GIT_EMERGECONFLICT`
stop and product a conflict.
|
|
59f29314
|
2015-12-23T23:44:58
|
|
merge driver: test GIT_PASSTHROUGH
When a `check` or `apply` callback function returns `GIT_PASSTHROUGH`,
move on to the default merge driver.
|
|
3f04219f
|
2015-12-23T10:23:08
|
|
merge driver: introduce custom merge drivers
Consumers can now register custom merged drivers with
`git_merge_driver_register`. This allows consumers to support the
merge drivers, as configured in `.gitattributes`. Consumers will be
asked to perform the file-level merge when a custom driver is
configured.
|
|
7a74590d
|
2015-12-03T09:57:56
|
|
Fix rebase bug and include test for merge=union
|
|
ba349322
|
2016-03-17T06:57:56
|
|
Merge pull request #3673 from libgit2/cmn/commit-with-signature
commit: add function to attach a signature to a commit
|
|
a151eb54
|
2016-03-17T06:55:24
|
|
Merge pull request #3685 from pks-t/pks/memleaks
Test memleaks
|
|
bf804d40
|
2016-03-17T10:45:22
|
|
commit: fix extraction of single-line signatures
The function to extract signatures suffers from a similar bug to the
header field finding one by having an unecessary line feed check as a
break condition of its loop.
Fix that and add a test for this single-line signature situation.
|
|
02d61a3b
|
2016-03-10T10:53:20
|
|
commit: add function to attach a signature to a commit
In combination with the function which creates a commit into a buffer,
this allows us to more easily create signed commits.
|
|
c577efbb
|
2016-03-14T12:41:41
|
|
Use general cl_git_fail because the error is generic
|