| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
`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`.
|
| |
|
|
|
| |
In `mkdir` and `mkdir_r`, ensure that we don't try to remove symlinks
that are in our way.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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`).
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
We create a lockfile to update files under GIT_DIR. Sometimes these
files are actually located elsewhere and a symlink takes their place. In
that case we should lock and update the file at its final location
rather than overwrite the symlink.
|
| |
|
|
|
| |
When an error state is an OOM, make sure that we treat is specially
and do not try to free it.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
When we have an error renaming the lockfile, we need to make sure
that we remove it upon cleanup. For this, we need to keep track of
whether we opened the file and whether the rename succeeded.
If we did create the lockfile but the rename did not succeed, we
remove the lockfile. This won't protect against all errors, but
the most common ones (target file is open) does get handled.
|
| |
|
|
|
| |
When we fail to rename, we currently leave the lockfile laying
around. This shows that behaviour.
|
| |
|
|
|
|
| |
Introduce `git__getenv` which is a UTF-8 aware `getenv` everywhere.
Make `cl_getenv` use this to keep consistent memory handling around
return values (free everywhere, as opposed to only some platforms).
|
| |
|
|
|
| |
This explains more closely what happens. While here, set an error
message.
|
| |
|
|
|
|
|
|
|
|
| |
When we don't own a buffer (asize=0) we currently allow the usage of
grow to copy the memory into a buffer we do own. This muddles the
meaning of grow, and lets us be a bit cavalier with ownership semantics.
Don't allow this any more. Usage of grow should be restricted to buffers
which we know own their own memory. If unsure, we must not attempt to
modify it.
|
| |
|
|
|
| |
Allow files to have mixed line endings instead of skipping processing
on them.
|
| |\
| |
| | |
Zero out racily-clean entries' file_size
|
| | |
| |
| |
| |
| |
| | |
Provide functionality to set the time on a filesystem entry,
using utimes or futimes on POSIX type systems or SetFileTime
on Win32.
|
| |/ |
|
| |\
| |
| | |
Downcase
|
| | | |
|
| | |
| |
| |
| |
| |
| | |
Treat input bytes as unsigned before doing arithmetic on them,
lest we look at some non-ASCII byte (like a UTF-8 character) as a
negative value and perform the comparison incorrectly.
|
| |/ |
|
| | |
|
| |
|
|
|
|
|
|
| |
The _next method shouldn't take a path pointer (and a path_len
pointer) as 100% of current users use the full path and ignore
the filename.
Plus let's add some docs and a unit test.
|
| |
|
|
|
| |
This is what it's meant all along, but now we actually have multiple
implementations, it's clearer to use the name of the library.
|
| |
|
|
|
| |
As an alternative to OpenSSL when we're on OS X. This one can actually
take advantage of stacking the streams.
|
| | |
|
| | |
|
| |
|
|
|
| |
Without this change, compiling with gcc and pedantic generates warning:
ISO C does not allow extra ‘;’ outside of a function.
|
| |
|
|
|
|
|
|
|
| |
Make our overflow checking look more like gcc and clang's, so that
we can substitute it out with the compiler instrinsics on platforms
that support it. This means dropping the ability to pass `NULL` as
an out parameter.
As a result, the macros also get updated to reflect this as well.
|
| |
|
|
|
|
| |
Have the ALLOC_OVERFLOW testing macros also simply set_oom in the
case where a computation would overflow, so that callers don't
need to.
|
| |
|
|
|
| |
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
|
| |
|
|
|
|
|
| |
`p_stat` calls `git_win32_path_from_utf8`, which canonicalizes the
path. Do not further try to modify the path, else we trim the
trailing slash from a root directory and try to access `C:` instead
of `C:/`.
|
| | |
|
| |
|
|
|
|
|
| |
The structinit tests don't make sense unless structure padding
is uniformly initialized, which is unlikely to happen on release
builds. Only enable them for DEBUG builds. Further, rename them
to core::structinit.
|
| |
|
|
|
|
| |
Main change: Don't treat chars > 128 as non-printable (common in UTF-8 files)
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When turning UTF-8 paths into UCS-2 paths for Windows, always use
the \\?\-prefixed paths. Because this bypasses the system's
path canonicalization, handle the canonicalization functions ourselves.
We must:
1. always use a backslash as a directory separator
2. only use a single backslash between directories
3. not rely on the system to translate "." and ".." in paths
4. remove trailing backslashes, except at the drive root (C:\)
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Our mkdir helper was failing is a parent directory was not
accessible even if the child directory could be created.
This changes the helper to keep trying child directories
even when the parent is unwritable.
|
| |
|
|
| |
Decode base64-encoded text into a git_buf
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
To make sure that items returned from pool allocations are aligned
on nice boundaries, this rounds up all pool allocation sizes to a
multiple of 8. This adds a small amount of overhead to each item.
The rounding up could be made optional with an extra parameter to
the pool initialization that turned on rounding only for pools
where item alignment actually matters, but I think for the extra
code and complexity that would be involved, that it makes sense
just to burn a little bit of extra memory and enable this all the
time.
|
| |
|
|
|
|
|
|
|
|
| |
When checking out files, we're performing conversion into the user's
native line endings, but we only want to do it for files which have
consistent line endings. Refuse to perform the conversion for mixed-EOL
files.
The CRLF->LF filter is left as-is, as that conversion is considered to be
normalization by git and should force a conversion of the line endings.
|
| |
|
|
|
| |
When passed the LINK_FILES flag, the recursive copy will hardlink files
instead of copying them.
|