libgit2/tests
Josh Triplett 0dd98b6905 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.
2016-06-24 12:26:51 -07:00
..
attr ignore: fix directory limits when searching for star-star 2016-04-19 19:39:05 +02:00
blame blame: use size_t for line counts in git_blame_hunk 2015-12-01 09:02:47 +01:00
buf buf test: cleanup memory leak 2015-02-13 09:28:12 -05:00
checkout checkout: use empty baseline when no index 2016-06-15 15:47:28 -05:00
cherrypick merge: rename git_merge_tree_flags_t -> git_merge_flags_t 2015-11-25 15:37:05 -05:00
clar clar: test chdir 2015-06-29 22:13:40 +00:00
clone clone::nonetwork: don't use fixed size buffer 2015-09-14 13:58:38 -04:00
commit Fix initial commit test 2016-05-04 11:15:56 -07:00
config leaks: fix some leaks in the tests 2016-03-31 10:41:33 -04:00
core tests: fix core/stream test when built with openssl off 2016-04-06 15:00:32 +02:00
date Added RFC2822 date format test cases 2014-04-11 21:55:36 +02:00
describe describe: only abort without tags if fallback is not allowed. 2015-04-07 17:32:56 +02:00
diff diff: test submodules are found with trailing / 2016-04-02 13:02:41 -07:00
fetchhead index, iterator, fetchhead: plug leaks 2015-06-26 19:00:33 +02:00
filter wildcard filters: move CHANGELOG message to 0.23+1 2015-07-10 09:53:30 -05:00
graph Added a no path test for git_graph_descendant_of 2014-04-08 16:32:06 +02:00
index test: ensure we can round-trip a written tree 2016-06-02 02:37:04 -05:00
iterator tests: skip the unreadable file tests as root 2016-04-11 15:32:38 -04:00
merge merge drivers: handle configured but not found driver 2016-03-17 11:06:00 -04:00
network Remove unused static functions 2016-06-21 07:58:33 +02:00
notes note: use a git_buf to return the default namespace 2015-03-17 20:50:02 +01:00
object threads: split up OS-dependent thread code 2016-06-20 19:32:59 +02:00
odb odb: Handle corner cases in git_odb_expand_ids 2016-03-09 11:00:27 +01:00
online clone test: annotate unused vars 2016-04-21 11:05:21 -04:00
pack Silence unused return value warning 2014-09-26 12:12:09 +02:00
path index: allow read of index w/ illegal entries 2016-02-17 13:10:33 +00:00
perf repository: remove log message override for switching the active branch 2015-03-03 14:40:50 +01:00
rebase rebase: test rebasing a new commit with subfolder 2016-06-02 02:38:18 -05:00
refs Allow creating copies of git_reference objects. 2016-04-22 10:34:17 -07:00
remote remote: test insteadOf for anonymous remotes 2015-05-31 13:26:05 +02:00
repo Add GIT_REPOSITORY_OPEN_FROM_ENV flag to respect $GIT_* environment vars 2016-06-24 12:26:51 -07:00
reset reset: use real ids for the tests 2016-04-11 11:47:56 -04:00
resources rebase: test rebasing a new commit with subfolder 2016-06-02 02:38:18 -05:00
revert merge: rename git_merge_tree_flags_t -> git_merge_flags_t 2015-11-25 15:37:05 -05:00
revwalk merge: Fix memory leak in test 2015-11-02 13:47:04 +01:00
stash stash: const up conflict params 2015-06-29 21:23:09 +00:00
status tests: skip the unreadable file tests as root 2016-04-11 15:32:38 -04:00
stress diff: introduce binary diff callbacks 2015-06-12 09:39:20 -04:00
submodule status: test submodules with mixed case 2016-03-31 17:58:43 -04:00
threads threads: split up OS-dependent thread code 2016-06-20 19:32:59 +02:00
trace Include stacktrace summary in memory leak output. 2015-06-29 16:39:11 -04:00
transport tests: transport: fix memory leaks with registering transports 2016-03-11 11:06:42 +01:00
win32 Merge pull request #3613 from ethomson/fixups 2016-02-18 12:31:56 +01:00
clar_libgit2_timer.c Converted cl_perf_timer to use git__timer internally. 2015-03-03 09:57:50 -05:00
clar_libgit2_timer.h Converted cl_perf_timer to use git__timer internally. 2015-03-03 09:57:50 -05:00
clar_libgit2_trace.c Include stacktrace summary in memory leak output. 2015-06-29 16:39:11 -04:00
clar_libgit2_trace.h Provide mechanism to let CLAR globally setup git_trace() 2015-03-02 08:20:27 -05:00
clar_libgit2.c tests: use out-of-the-way config dir in sandbox 2015-11-17 11:22:01 -05:00
clar_libgit2.h git__getenv: utf-8 aware env reader 2015-07-02 16:35:43 +00:00
clar.c Avoid old-style function definitions 2016-06-21 07:58:33 +02:00
clar.h Update to clar 2b73f5e 2015-02-27 00:30:50 -05:00
generate_crlf.sh crlf: script to generate expected crlf data 2015-06-22 11:59:58 -04:00
generate.py Update clar to e3985dd 2014-12-07 22:09:00 +08:00
main.c Include stacktrace summary in memory leak output. 2015-06-29 16:39:11 -04:00
README.md Rename tests-clar to tests 2013-11-14 14:05:52 -08:00
valgrind-supp-mac.txt Test cancel from indexer progress callback 2013-12-11 15:02:20 -08:00

Writing Clar tests for libgit2

For information on the Clar testing framework and a detailed introduction please visit:

https://github.com/vmg/clar

  • Write your modules and tests. Use good, meaningful names.

  • Make sure you actually build the tests by setting:

      cmake -DBUILD_CLAR=ON build/
    
  • Test:

      ./build/libgit2_clar
    
  • Make sure everything is fine.

  • Send your pull request. That's it.