Commit Graph

15 Commits

Author SHA1 Message Date
Edward Thomson
6278fbc5dd patch parsing: squash some memory leaks 2016-05-26 13:01:07 -05:00
Edward Thomson
5b78dbdbf3 git_buf: decode base85 inputs 2016-05-26 13:01:04 -05: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
a65992355d buffer: make use of EINVALID for growing a borrowed buffer
This explains more closely what happens. While here, set an error
message.
2015-06-24 23:49:10 +02:00
Carlos Martín Nieto
caab22c0d4 buffer: don't allow growing borrowed buffers
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.
2015-06-24 23:49:10 +02:00
Edward Thomson
8293c8f9a3 git_buf_text_lf_to_crlf: allow mixed line endings
Allow files to have mixed line endings instead of skipping processing
on them.
2015-06-22 12:00:23 -04:00
Sven Strickroth
0161e096a3 Make binary detection work similar to vanilla git
Main change: Don't treat chars > 128 as non-printable (common in UTF-8 files)

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2015-01-20 16:17:37 -06:00
Vicent Marti
92e0b67930 buffer: Do not put anything if len is 0 2014-11-21 17:21:33 +01:00
Vicent Marti
737b505116 hashsig: Export as a sys header 2014-10-01 12:03:24 +02:00
Edward Thomson
e003f83a58 Introduce git_buf_decode_base64
Decode base64-encoded text into a git_buf
2014-08-15 11:12:42 -04:00
Carlos Martín Nieto
5a76ad35aa crlf: pass-through mixed EOL buffers from LF->CRLF
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.
2014-06-23 22:27:12 +02:00
Edward Thomson
e349ed500b patch: emit binary patches (optionally) 2014-04-22 19:08:21 -05:00
Russell Belfer
18234b14ad Add efficient git_buf join3 API
There are a few places where we need to join three strings to
assemble a path.  This adds a simple join3 function to avoid the
comparatively expensive join_n (which calls strlen on each string
twice).
2014-04-01 09:45:20 -07:00
Patrick Reynolds
abdaf93662 add unit tests for git_buf_join corner cases 2014-01-20 11:42:12 -06:00
Ben Straub
1782038144 Rename tests-clar to tests 2013-11-14 14:05:52 -08:00