Commit Graph

33 Commits

Author SHA1 Message Date
Russell Belfer
a7fcc44dcf Better macro name for is-exec-bit-set test 2013-09-05 16:14:32 -07:00
Russell Belfer
af22dabb43 GIT_MODE_TYPE should exclude setgid bits
The GIT_MODE_TYPE macro was looking at all bits above the
permissions, but it should really just look at the top bits so
that it will give the right results for a setgid or setuid entry.

Since we're now using these macros in the tests, this was causing
a test failure on platforms that don't support setgid.
2013-09-05 12:01:17 -07:00
Russell Belfer
c97d407d9c Fix tests of file modes
This fixes an issue checking file modes in the tests that
initialize a repo from a template directory when a symlink is
used in the template.  Also, this updates some other places where
we are examining file modes to use the new macros.
2013-09-05 11:45:29 -07:00
Russell Belfer
9ce4f7da4a Fix tests to use core.filemode correctly
Some windows tests were failing
2013-09-04 16:41:34 -07:00
Russell Belfer
2a54c7f447 _umask is function name on Windows 2013-09-04 16:24:36 -07:00
Russell Belfer
780f3e540f Make tests take umask into account
It seems that libgit2 is correctly applying the umask when
initializing a repository from a template and when creating new
directories during checkout, but the test suite is not accounting
for possible variations due to the umask.  This updates that so
that the test suite will work regardless of the umask.
2013-09-04 16:23:00 -07:00
Russell Belfer
0ea41445f4 Improve isolation of new test from user environs 2013-08-16 15:04:15 -07:00
Russell Belfer
579d87c5d3 New test that inits repo and make commit 2013-08-16 15:04:15 -07:00
Russell Belfer
1323c6d180 Add cl_repo_set_bool and cleanup tests
This adds a helper function for the cases where you want to
quickly set a single boolean config value for a repository.
This allowed me to remove a lot of code.
2013-03-22 14:27:56 -07:00
Russell Belfer
18f0826408 Make mode handling during init more like git
When creating files, instead of actually using GIT_FILEMODE_BLOB
and the other various constants that happen to correspond to
mode values, apparently I should be just using 0666 and 0777, and
relying on the umask to clear bits and make the value sane.

This fixes the rules for copying a template directory and fixes
the checks to match that new behavior.  (Further changes to the
checkout logic to follow separately.)
2013-02-27 13:44:15 -08:00
Russell Belfer
0d1b094b07 Fix portability issues on Windows
The new tests were not taking core.filemode into account when
testing file modes after repo initialization.  Fixed that and some
other Windows warnings that have crept in.
2013-02-26 13:15:06 -08:00
Russell Belfer
3c42e4ef74 Fix initialization of repo directories
When PR #1359 removed the hooks from the test resources/template
directory, it made me realize that the tests for
git_repository_init_ext using templates must be pretty shabby
because we could not have been testing if the hooks were getting
created correctly.

So, this started with me recreating a couple of hooks, including
a sample and symlink, and adding tests that they got created
correctly in the various circumstances, including with the SHARED
modes, etc.  Unfortunately this uncovered some issues with how
directories and symlinks were copied and chmod'ed.  Also, there
was a FIXME in the code related to the chmod behavior as well.

Going back over the directory creation logic for setting up a
repository, I found it was a little difficult to read and could
result in creating and/or chmod'ing directories that the user
almost certainly didn't intend.

So that let to this work which makes repo initialization much
more careful (and hopefully easier to follow).  It required a
couple of extensions / changes to core fileops utilities, but I
also think those are for the better, at least for git_futils_cp_r
in terms of being careful about what actions it takes.
2013-02-26 11:43:14 -08:00
Scott J. Goldman
f7b060188a tests: fix indentation in repo/init.c 2013-02-07 03:04:50 -08:00
Sebastian Bauer
5885ba112d Now checks in the template test whether the description file has
been properly copied.

This is a minimal effort to test whether the template really has
been used when creating an repo with external templates.
2013-01-13 12:26:52 +01:00
Sebastian Bauer
4a4aee1112 Added flag GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE to test_repo_init__extended_with_template().
Otherwise the template functionallity is not tested (as a TODO we
also shall test that the specified template really got copied).
2013-01-12 18:44:50 +01:00
Ben Straub
b4d136527c Deploy GIT_REPOSITORY_INIT_OPTIONS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
2508cc66eb Rename ref and reflog apis for consistency 2012-11-27 13:17:45 -08:00
Sascha Cunz
9094d30b93 Reset all static variables to NULL in clar's __cleanup
Without this change, any failed assertion in the second (or a later) test
inside a test suite has a chance of double deleting memory, resulting in
a heap corruption. See #1096 for details.

This leaves alone the test cases where we "just" use cl_git_sandbox_init()
and cl_git_sandbox_cleanup(). These methods already take good care to not
double delete a repository.

Fixes #1096
2012-11-23 11:41:56 +01:00
nulltoken
89cd5708d9 repository: make initialization cope with missing core.worktree 2012-08-29 19:56:55 +02:00
Russell Belfer
2eb4edf5f2 Fix errors on Win32 with new repo init 2012-08-24 10:48:48 -07:00
Russell Belfer
ca1b6e5409 Add template dir and set gid to repo init
This extends git_repository_init_ext further with support for
initializing the repository from an external template directory
and with support for the "create shared" type flags that make a
set GID repository directory.

This also adds tests for much of the new functionality to the
existing `repo/init.c` test suite.

Also, this adds a bunch of new utility functions including a
very general purpose `git_futils_mkdir` (with the ability to
make paths and to chmod the paths post-creation) and a file
tree copying function `git_futils_cp_r`.  Also, this includes
some new path functions that were useful to keep the code
simple.
2012-08-22 16:07:19 -07:00
Carlos Martín Nieto
973ed4c9f0 repo tests: do cleanup reinit tests 2012-07-03 12:11:19 +02:00
nulltoken
d6d8cc276d tests-clar: fix isolation of repo initialization tests 2012-06-22 13:42:35 +02:00
nulltoken
dbb24a3962 repository: enhance reinitialization test coverage 2012-06-22 11:32:50 +02:00
Carlos Martín Nieto
9311423c34 tests: plug a leak in the repo tests
The second call to assert_config_entry_on_init_bytype is cleaned up by
the main cleanup function, but that overwrites the first _repo. Make
sure that one doesn't leak.
2012-06-21 02:30:30 +02:00
nulltoken
7623b1b63f repository: make git_repository_init() value the core.logallrefupdates config entry 2012-06-12 06:42:46 +02:00
nulltoken
976b69bdbb repository: widen test coverage regarding initialization and configuration entries 2012-06-12 06:42:46 +02:00
nulltoken
693b23c09a repository: make git_repository_init() value the core.ignorecase config entry 2012-06-05 22:33:34 +02:00
nulltoken
fac66990b6 repository: make git_repository_init() value the core.filemode config entry 2012-06-05 14:01:44 +02:00
Russell Belfer
db62807215 Fixed leaks and added tests 2012-05-11 12:16:19 -07:00
nulltoken
5663e61a06 repository: add minimal reinitialization of repository
This currently only ensures that the version of the repository format isn't greater than zero.
2012-01-25 23:05:06 +01:00
nulltoken
9b84447a80 clay: migrate a test initializing a repository which path escapes the current working directory
A non migrated yet test has been removed as well as it's mostly redundant.
2012-01-25 23:02:08 +01:00
Vicent Martí
3fd1520cd4 Rename the Clay test suite to Clar
Clay is the name of a programming language on the makings, and we want
to avoid confusions. Sorry for the huge diff!
2012-01-24 20:35:15 -08:00