<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/path.c, branch v2.0.5</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.5</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.5'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-12-17T19:28:54Z</updated>
<entry>
<title>Sync with v1.9.5</title>
<updated>2014-12-17T19:28:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-17T19:28:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5e519fb8b09378342e23bd8c075cfb4b8e7b0e4f'/>
<id>urn:sha1:5e519fb8b09378342e23bd8c075cfb4b8e7b0e4f</id>
<content type='text'>
* maint-1.9:
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
</content>
</entry>
<entry>
<title>Sync with v1.8.5.6</title>
<updated>2014-12-17T19:20:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-17T19:20:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6898b797218ca1f25818d813318b387d965dc1bb'/>
<id>urn:sha1:6898b797218ca1f25818d813318b387d965dc1bb</id>
<content type='text'>
* maint-1.8.5:
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index
</content>
</entry>
<entry>
<title>path: add is_ntfs_dotgit() helper</title>
<updated>2014-12-17T19:04:45Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2014-12-16T22:31:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1d1d69bc52dcc7def5b2edbd165cc0a4e3911c8e'/>
<id>urn:sha1:1d1d69bc52dcc7def5b2edbd165cc0a4e3911c8e</id>
<content type='text'>
We do not allow paths with a ".git" component to be added to
the index, as that would mean repository contents could
overwrite our repository files. However, asking "is this
path the same as .git" is not as simple as strcmp() on some
filesystems.

On NTFS (and FAT32), there exist so-called "short names" for
backwards-compatibility: 8.3 compliant names that refer to the same files
as their long names. As ".git" is not an 8.3 compliant name, a short name
is generated automatically, typically "git~1".

Depending on the Windows version, any combination of trailing spaces and
periods are ignored, too, so that both "git~1." and ".git." still refer
to the Git directory. The reason is that 8.3 stores file names shorter
than 8 characters with trailing spaces. So literally, it does not matter
for the short name whether it is padded with spaces or whether it is
shorter than 8 characters, it is considered to be the exact same.

The period is the separator between file name and file extension, and
again, an empty extension consists just of spaces in 8.3 format. So
technically, we would need only take care of the equivalent of this
regex:
        (\.git {0,4}|git~1 {0,3})\. {0,3}

However, there are indications that at least some Windows versions might
be more lenient and accept arbitrary combinations of trailing spaces and
periods and strip them out. So we're playing it real safe here. Besides,
there can be little doubt about the intention behind using file names
matching even the more lenient pattern specified above, therefore we
should be fine with disallowing such patterns.

Extra care is taken to catch names such as '.\\.git\\booh' because the
backslash is marked as a directory separator only on Windows, and we want
to use this new helper function also in fsck on other platforms.

A big thank you goes to Ed Thomson and an unnamed Microsoft engineer for
the detailed analysis performed to come up with the corresponding fixes
for libgit2.

This commit adds a function to detect whether a given file name can refer
to the Git directory by mistake.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use xmemdupz() to allocate copies of strings given by start and length</title>
<updated>2014-07-21T17:37:02Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-07-19T15:35:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5c0b13f85ab3a5326508b854768eb70c8829cda4'/>
<id>urn:sha1:5c0b13f85ab3a5326508b854768eb70c8829cda4</id>
<content type='text'>
Use xmemdupz() to allocate the memory, copy the data and make sure to
NUL-terminate the result, all in one step.  The resulting code is
shorter, doesn't contain the constants 1 and '\0', and avoids
duplicating function parameters.

For blame, the last copied byte (o-&gt;file.ptr[o-&gt;file.size]) is always
set to NUL by fake_working_tree_commit() or read_sha1_file(), so no
information is lost by the conversion to using xmemdupz().

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/config-path-include-fix' into maint</title>
<updated>2014-03-18T21:00:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-18T21:00:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f0166771aadeb069b8952255414d67b643db1bf'/>
<id>urn:sha1:6f0166771aadeb069b8952255414d67b643db1bf</id>
<content type='text'>
include.path variable (or any variable that expects a path that can
use ~username expansion) in the configuration file is not a boolean,
but the code failed to check it.

* jk/config-path-include-fix:
  handle_path_include: don't look at NULL value
  expand_user_path: do not look at NULL path
</content>
</entry>
<entry>
<title>Merge branch 'jk/config-path-include-fix'</title>
<updated>2014-02-27T22:01:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-02-27T22:01:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bfef492d769cbea25c3cd951fe452be85402b160'/>
<id>urn:sha1:bfef492d769cbea25c3cd951fe452be85402b160</id>
<content type='text'>
include.path variable (or any variable that expects a path that can
use ~username expansion) in the configuration file is not a
boolean, but the code failed to check it.

* jk/config-path-include-fix:
  handle_path_include: don't look at NULL value
  expand_user_path: do not look at NULL path
</content>
</entry>
<entry>
<title>expand_user_path: do not look at NULL path</title>
<updated>2014-01-28T19:59:47Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-01-28T01:36:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=53ec551c87c731c5c4171e943842998bdfb5548e'/>
<id>urn:sha1:53ec551c87c731c5c4171e943842998bdfb5548e</id>
<content type='text'>
We explicitly check for and handle the case that the
incoming "path" variable is NULL, but before doing so we
call strchrnul on it, leading to a potential segfault.

We can fix this simply by moving the strchrnul call down; as
a bonus, we can tighten the scope on the associated
variable.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jx/relative-path-regression-fix'</title>
<updated>2013-10-28T17:42:30Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-10-28T17:42:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e22c1c7f19914aa0dc1b6fe65bbfafed265d6e7f'/>
<id>urn:sha1:e22c1c7f19914aa0dc1b6fe65bbfafed265d6e7f</id>
<content type='text'>
* jx/relative-path-regression-fix:
  Use simpler relative_path when set_git_dir
  relative_path should honor dos-drive-prefix
  test: use unambigous leading path (/foo) for MSYS
</content>
</entry>
<entry>
<title>Use simpler relative_path when set_git_dir</title>
<updated>2013-10-14T14:00:33Z</updated>
<author>
<name>Jiang Xin</name>
<email>worldhello.net@gmail.com</email>
</author>
<published>2013-10-14T02:29:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=41894ae3a315f75ebc924881c6ce9a69d70ce9c0'/>
<id>urn:sha1:41894ae3a315f75ebc924881c6ce9a69d70ce9c0</id>
<content type='text'>
Using a relative_path as git_dir first appears in v1.5.6-1-g044bbbc.
It will make git_dir shorter only if git_dir is inside work_tree,
and this will increase performance. But my last refactor effort on
relative_path function (commit v1.8.3-rc2-12-ge02ca72) changed that.
Always use relative_path as git_dir may bring troubles like
$gmane/234434.

Because new relative_path is a combination of original relative_path
from path.c and original path_relative from quote.c, so in order to
restore the origin implementation, save the original relative_path
as remove_leading_path, and call it in setup.c.

Suggested-by: Karsten Blees &lt;karsten.blees@gmail.com&gt;
Signed-off-by: Jiang Xin &lt;worldhello.net@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
</content>
</entry>
<entry>
<title>relative_path should honor dos-drive-prefix</title>
<updated>2013-10-14T14:00:26Z</updated>
<author>
<name>Jiang Xin</name>
<email>worldhello.net@gmail.com</email>
</author>
<published>2013-10-14T02:29:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7fbd422162f2b49bc06a29a063f519450165dc86'/>
<id>urn:sha1:7fbd422162f2b49bc06a29a063f519450165dc86</id>
<content type='text'>
Tvangeste found that the "relative_path" function could not work
properly on Windows if "in" and "prefix" have DOS drive prefix
(such as "C:/windows"). ($gmane/234434)

E.g., When execute: test-path-utils relative_path "C:/a/b" "D:/x/y",
should return "C:/a/b", but returns "../../C:/a/b", which is wrong.

So make relative_path honor DOS drive prefix, and add test cases
for it in t0060.

Reported-by: Tvangeste &lt;i.4m.l33t@yandex.ru&gt;
Helped-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Jiang Xin &lt;worldhello.net@gmail.com&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
</content>
</entry>
</feed>
