libgit2/tests
John Fultz d3282680ed Fix index-adding functions to know when to trust filemodes.
The idea...sometimes, a filemode is user-specified via an
explicit git_index_entry.  In this case, believe the user, always.

Sometimes, it is instead built up by statting the file system.  In
those cases, go with the existing logic we have to determine
whether the file system supports all filemodes and symlinks, and
make the best guess.

On file systems which have full filemode and symlink support, this
commit should make no difference.  On others (most notably Windows),
this will fix problems things like:
* git_index_add and git_index_add_frombuffer() should be believed.
* As a consequence, git_checkout_tree should make the filemodes in
the index match the ones in the tree.
* And diffs with GIT_DIFF_UPDATE_INDEX don't write the wrong filemodes.
* And merges, and probably other downstream stuff now fixed, too.

This makes my previous changes to checkout.c unnecessary,
so they are now reverted.

Also, added a test for index_entry permissions from git_index_add
and git_index_add_frombuffer, both of which failed before these changes.
2015-04-21 02:17:23 -05:00
..
attr attr: Add an extra test for files under a subfolder 2014-09-17 15:08:16 +02:00
blame Factor 40 and 41 constants from source. 2014-09-16 13:07:04 +02:00
buf buf test: cleanup memory leak 2015-02-13 09:28:12 -05:00
checkout Fix git_checkout_tree() to do index filemodes correctly on Windows. 2015-04-06 18:22:17 -05:00
cherrypick Renamed git_merge_options 'flags' to 'tree_flags' 2015-03-16 09:53:27 +02:00
clar clar: use a custom temp directory name 2014-10-24 10:50:57 -04:00
clone config: borrow refcounted references 2015-03-03 18:35:12 +01:00
commit Remove the signature from ref-modifying functions 2015-03-03 14:40:50 +01:00
config Plug a few leaks 2015-03-04 00:29:37 +01:00
core Fix p_ftruncate to handle big files for git_clone 2015-03-03 08:47:44 -05:00
date Added RFC2822 date format test cases 2014-04-11 21:55:36 +02:00
describe Remove the signature from ref-modifying functions 2015-03-03 14:40:50 +01:00
diff diff_tform: account for whitespace options 2015-03-04 00:01:34 -05:00
fetchhead Remove the signature from ref-modifying functions 2015-03-03 14:40:50 +01:00
filter squash some leaks 2015-03-24 20:58:00 +00:00
graph Added a no path test for git_graph_descendant_of 2014-04-08 16:32:06 +02:00
index Fix index-adding functions to know when to trust filemodes. 2015-04-21 02:17:23 -05:00
merge Collapse whitespace flags into git_merge_file_flags_t 2015-03-16 09:53:27 +02:00
network config: borrow refcounted references 2015-03-03 18:35:12 +01:00
notes note: use a git_buf to return the default namespace 2015-03-17 20:50:02 +01:00
object Plug a couple of leaks 2015-01-04 17:39:43 +00:00
odb odb: git_odb_object contents are never NULL 2014-11-21 14:09:53 +01:00
online Add failing test for cert callback with non-ecrypted stream 2015-03-16 19:39:05 +01:00
pack Silence unused return value warning 2014-09-26 12:12:09 +02:00
path win32: further cleanups for 8.3 disabling 2015-02-03 20:01:24 -05:00
perf repository: remove log message override for switching the active branch 2015-03-03 14:40:50 +01:00
rebase repository: remove log message override for switching the active branch 2015-03-03 14:40:50 +01:00
refs Add tests for the annotated versions of ref-modifying functions 2015-03-16 16:57:30 +01:00
repo Merge remote-tracking branch 'ethomson/submodule_8dot3' 2015-03-18 04:59:16 +01:00
reset Add tests for the annotated versions of ref-modifying functions 2015-03-16 16:57:30 +01:00
resources Illustrate bad checkout on Windows 2015-03-25 10:20:47 -04:00
revert Renamed git_merge_options 'flags' to 'tree_flags' 2015-03-16 09:53:27 +02:00
revwalk tests: update for new test data 2015-02-02 22:46:43 -05:00
stash Merge pull request #2913 from ethomson/stash_fixup 2015-03-03 10:08:28 -05:00
status repository: remove log message override for switching the active branch 2015-03-03 14:40:50 +01:00
stress Use p_snprintf also in tests 2014-08-05 20:51:59 +02:00
submodule Fix git_submodule_sync writing URL to wrong key. 2015-03-12 16:05:07 +01:00
threads Remove the signature from ref-modifying functions 2015-03-03 14:40:50 +01:00
trace Provide mechanism to let CLAR globally setup git_trace() 2015-03-02 08:20:27 -05:00
transport Clean up some leaks in the test suite 2014-09-17 03:19:40 +02: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 Added cl_perf_timer. Updated global trace to include timers. 2015-03-02 09:21:55 -05: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 win32: further cleanups for 8.3 disabling 2015-02-03 20:01:24 -05:00
clar_libgit2.h win32: further cleanups for 8.3 disabling 2015-02-03 20:01:24 -05:00
clar.c clar: update to 08f434d 2015-03-17 19:04:48 -04:00
clar.h Update to clar 2b73f5e 2015-02-27 00:30:50 -05:00
generate.py Update clar to e3985dd 2014-12-07 22:09:00 +08:00
main.c libgit2_shutdown: clear err message on shutdown 2015-03-04 14:48:46 +01: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.