Commit Graph

8781 Commits

Author SHA1 Message Date
Edward Thomson
81aaf3704a mkdir: chmod existing paths with GIT_MKDIR_CHMOD 2015-09-17 11:26:38 -04:00
Edward Thomson
e24c60dba4 mkdir: find component paths for mkdir_relative
`git_futils_mkdir` does not blindly call `git_futils_mkdir_relative`.

`git_futils_mkdir_relative` is used when you have some base directory
and want to create some path inside of it, potentially removing blocking
symlinks and files in the process.  This is not suitable for a general
recursive mkdir within the filesystem.

Instead, when `mkdir` is being recursive, locate the first existent
parent directory and use that as the base for `mkdir_relative`.
2015-09-17 10:11:56 -04:00
Edward Thomson
0862ec2eb9 core::mkdir tests: ensure we don't stomp symlinks in mkdir
In `mkdir` and `mkdir_r`, ensure that we don't try to remove symlinks
that are in our way.
2015-09-17 10:11:38 -04:00
Edward Thomson
08df66301e core::mkdir tests: include absolute mkdirs 2015-09-17 10:00:35 -04:00
Edward Thomson
ac2fba0ecd git_futils_mkdir_*: make a relative-to-base mkdir
Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
assumes that we own everything beneath the base, as if it were
being called with a base of the repository or working directory,
and is tailored towards checkout and ensuring that there is no
bogosity beneath the base that must be cleaned up.

This is (at best) slow and (at worst) unsafe in the larger context
of a filesystem where we do not own things and cannot do things like
unlink symlinks that are in our way.
2015-09-17 10:00:35 -04:00
Carlos Martín Nieto
add0378d8e Merge pull request #3429 from ethomson/checkout_chmod
Checkout: handle mode changes
2015-09-16 17:46:24 +02:00
Edward Thomson
eea7c85024 checkout: overwrite files with differing modes
When a file exists on disk and we're checking out a file that differs
in executableness, remove the old file.  This allows us to recreate the
new file with p_open, which will take the new mode into account and
handle setting the umask properly.

Remove any notion of chmod'ing existing files, since it is now handled
by the aforementioned removal and was incorrect, as it did not take
umask into account.
2015-09-16 10:33:59 -04:00
Edward Thomson
6fe322843b checkout::tree tests: don't use hardcoded mode 2015-09-16 10:33:53 -04:00
Edward Thomson
b4d183a77a checkout::tree tests: don't use static buffer 2015-09-16 04:12:47 +00:00
Matti Virolainen
33cad99589 Check that checkout preserves filemode in working directory. 2015-09-16 04:07:48 +00:00
Matti Virolainen
6124d983b6 Check that an executable in index is not an executable after checkout. 2015-09-16 04:07:43 +00:00
Edward Thomson
b1f6c0b6fa Merge pull request #3428 from ethomson/clone_test_buffer
Clone test buffer
2015-09-14 14:58:54 -04:00
Edward Thomson
8452fecc8f cl_git_path_url: assert sane static buffer size 2015-09-14 14:05:01 -04:00
Edward Thomson
4cc355c97b clone::nonetwork: don't use fixed size buffer 2015-09-14 13:58:38 -04:00
Carlos Martín Nieto
b0885675f7 Merge pull request #3425 from ethomson/diriter_root
Handle `git_path_diriter` instances at the drive root on Windows
2015-09-13 23:21:14 +02:00
Carlos Martín Nieto
ceb01c091b Merge pull request #3426 from ethomson/fs_iterator
iterator: loop fs_iterator advance (don't recurse)
2015-09-13 22:31:08 +02:00
Edward Thomson
9d905541bf diriter: don't double '/' on posix
The canonical directory path of the root directory of a volume on
POSIX already ends in a slash (eg, `/`).  This is true only at the
root.  Do not add a slash to paths in this case.
2015-09-13 14:18:08 -04:00
Edward Thomson
26d7cf6e57 iterator: loop fs_iterator advance (don't recurse) 2015-09-13 14:07:54 -04:00
Edward Thomson
5a466befaf diriter: don't double '/' on Windows
The canonical directory path of the root directory of a volume on
windows already ends in a slash (eg, `c:/`).  This is true only
at the volume root.  Do not add a slash to paths in this case.
2015-09-13 13:59:41 -04:00
Edward Thomson
2cde210d47 diriter: test we can iterate root
Ensure that we can iterate the filesystem root and that paths come
back well-formed, not with an additional '/'.  (eg, when iterating
`c:/`, expect that we do not get some path like `c://autoexec.bat`).
2015-09-13 13:52:23 -04:00
Carlos Martín Nieto
f2b25261cf Merge pull request #3423 from libgit2/cmn/push-tests-inline-oid
push: put the git_oid inline in the test structure
2015-09-13 19:43:55 +02:00
Carlos Martín Nieto
e78aeefa18 Merge pull request #3420 from ethomson/iterator
iterator: advance the tree iterator smartly
2015-09-13 19:43:39 +02:00
Carlos Martín Nieto
9562ebcd6b Merge pull request #3424 from arthurschreiber/arthur/transaction-dont-free-config
Don't free config in `git_transaction_commit`.
2015-09-13 17:33:26 +02:00
Arthur Schreiber
548cb33434 Don't free config in git_transaction_commit.
The config is not owned by the transaction, so please don’t free it.
2015-09-13 16:32:24 +02:00
Carlos Martín Nieto
1e80bf27ea Merge branch 'cmn/ignore-dir-check' 2015-09-13 06:21:18 +02:00
Carlos Martín Nieto
657afd359e ignore: add test and adjust style and comment for dir with wildmatch
The previous commit left the comment referencing the earlier state of
the code, change it to explain the current logic. While here, change the
logic to avoid repeating the copy of the base pattern.
2015-09-13 06:18:49 +02:00
Carlos Martín Nieto
305407e1bb Merge pull request #3370 from libgit2/cmn/submodule-refactor
submodule: refactor to be more explicit in the search
2015-09-13 06:03:12 +02:00
Carlos Martín Nieto
1af5aecb96 push: put the git_oid inline in the test structure
These are small pieces of data, so there is no advantage to allocating
them separately. Include the two ids inline in the struct we use to
check that the expected and actual ids match.
2015-09-13 05:38:29 +02:00
Carlos Martín Nieto
dc5b678fda Merge pull request #3422 from ethomson/workdir_diff
diff: examine pathlist on non-files
2015-09-12 22:49:23 +02:00
Edward Thomson
8ab4d0e1e1 diff: check pathspec on non-files
When we're not doing pathspec matching, we let the iterator handle
file matching for us.  However, we can only trust the iterator to
return *files* that match the pattern, because the iterator must
return directories that are not strictly in the pathlist, but that
are the parents of files that match the pattern, so that diff can
later recurse into them.

Thus, diff must examine non-files explicitly before including them
in the delta list.
2015-09-12 15:32:18 -04:00
Edward Thomson
92f7d32b59 diff::workdir: ensure ignored files are not returned
Ensure that a diff with the workdir is not erroneously returning
directories.
2015-09-12 13:46:22 -04:00
Carlos Martín Nieto
049dbf42f5 Merge pull request #3421 from ethomson/mempack-fix
Mempack fix
2015-09-12 04:00:34 +02:00
Edward Thomson
220d6f8a10 mempack: expose clear function 2015-09-11 20:06:14 -04:00
Bryan Woods
707f65372b Removing memory leak in mempack's free
It calls git_mempack_reset which reallocates the object array. git_oidmap_free is now called on it explicitly.
2015-09-11 16:35:14 -07:00
Edward Thomson
a1859e21f3 iterator: advance the tree iterator smartly
While advancing the tree iterator, if we advance over things that
we aren't interested in, then call `current`.  Which may *itself*
call advance.

While advancing the tree iterator, if we advance over things that
we aren't interested in, then call `current`.  Which may *itself*
call advance.

While advancing the tree iterator, if we advance over things that
we aren't interested in, then call `current`.  Which may *itself*
call advance.

While advancing the tree iterator, if we advance over things that
we aren't interested in, then call `current`.  Which may *itself*
call advance.

While advancing the tree iterator, if we advance over things that
we aren't interested in, then call `current`.  Which may *itself*
call advance.

Error: stack overflow.
2015-09-11 17:38:28 -04:00
Bryan Woods
8e177b2bb8 Fixing dangling pointers in git_mempack_reset
git_mempack_reset was leaving free'd pointers in the oidmap.
2015-09-10 14:44:52 -07:00
Carlos Martín Nieto
a3b9731ff8 submodule: add a test for a renamed submdoule dir 2015-09-10 21:23:03 +02:00
Carlos Martín Nieto
f17525b0ff submodule: refactor to be more explicit in the search
When searching for information about a submdoule, let's be more explicit
in what we expect to find. We currently insert a submodule into the map
and change certain parameters when the config callback gets called.

Switch to asking for the configuration we're interested in, rather than
taking it in an arbitrary order.
2015-09-10 20:36:02 +02:00
Matt Burke
d29c5412aa Avoid segfault when opts == NULL 2015-09-10 14:16:39 -04:00
Matt Burke
3245896bb7 Add a test for custom header validation
Also, *some* custom headers actually are valid.
2015-09-10 13:18:26 -04:00
Matt Burke
66d90e7098 More specific names 2015-09-10 09:14:20 -04:00
Matt Burke
8c876fa91d Validate custom http headers 2015-09-10 09:11:16 -04:00
Matt Burke
35969c6839 Ignore NULL headers 2015-09-10 08:58:23 -04:00
Matt Burke
c49126c87f Accept custom headers for fetch too 2015-09-10 08:34:35 -04:00
Carlos Martín Nieto
6c21211c38 Merge pull request #3379 from theseion/additional_libssh2_error_reporting
report libssh2 error if list of authentication methods can't be retrieved
2015-09-09 13:59:38 +02:00
Carlos Martín Nieto
53ba8c9e8b Merge pull request #3415 from ethomson/lock_hidden
filebuf: ensure we can lock a hidden file
2015-09-09 01:37:06 +02:00
Edward Thomson
8e736a73ca futils: ensure we can write a hidden file 2015-09-08 15:56:50 -04:00
Edward Thomson
ea3f2c296a filebuf: ensure we can lock a hidden file 2015-09-08 15:56:35 -04:00
Matt Burke
c82c2ba60f o i 2015-09-08 14:17:59 -04:00
Matt Burke
5d7cd57f99 Update another call to git_remote_connect 2015-09-08 14:15:29 -04:00