<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/setup.c, branch v2.24.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.24.0</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.24.0'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2019-09-30T04:19:26Z</updated>
<entry>
<title>Merge branch 'js/gitdir-at-unc-root'</title>
<updated>2019-09-30T04:19:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-09-30T04:19:26Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b57a88a5f1555de6d34d162a1a5a8a6deda8018e'/>
<id>urn:sha1:b57a88a5f1555de6d34d162a1a5a8a6deda8018e</id>
<content type='text'>
On Windows, the root level of UNC share is now allowed to be used
just like any other directory.

* js/gitdir-at-unc-root:
  setup_git_directory(): handle UNC root paths correctly
  Fix .git/ discovery at the root of UNC shares
  setup_git_directory(): handle UNC paths correctly
</content>
</entry>
<entry>
<title>setup_git_directory(): handle UNC root paths correctly</title>
<updated>2019-08-26T17:03:41Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-08-24T22:10:46Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=5cf7b3b1acf2e603d92132906bc6929141172d4c'/>
<id>urn:sha1:5cf7b3b1acf2e603d92132906bc6929141172d4c</id>
<content type='text'>
When working in the root directory of a file share (this is only
possible in Git Bash and Powershell, but not in CMD), the current
directory is reported without a trailing slash.

This is different from Unix and standard Windows directories: both / and
C:\ are reported with a trailing slash as current directories.

If a Git worktree is located there, Git is not quite prepared for that:
while it does manage to find the .git directory/file, it returns as
length of the top-level directory's path *one more* than the length of
the current directory, and setup_git_directory_gently() would then
return an undefined string as prefix.

In practice, this undefined string usually points to NUL bytes, and does
not cause much harm. Under rare circumstances that are really involved
to reproduce (and not reliably so), the reported prefix could be a
suffix string of Git's exec path, though.

A careful analysis determined that this bug is unlikely to be
exploitable, therefore we mark this as a regular bug fix.

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>Fix .git/ discovery at the root of UNC shares</title>
<updated>2019-08-26T17:03:41Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-08-24T22:10:45Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e2683d51d96f5e95489d29ee6dfafdde790579e4'/>
<id>urn:sha1:e2683d51d96f5e95489d29ee6dfafdde790579e4</id>
<content type='text'>
A very common assumption in Git's source code base is that
offset_1st_component() returns either 0 for relative paths, or 1 for
absolute paths that start with a slash. In other words, the return value
is either 0 or points just after the dir separator.

This assumption is not fulfilled when calling offset_1st_component()
e.g. on UNC paths on Windows, e.g. "//my-server/my-share". In this case,
offset_1st_component() returns the length of the entire string (which is
correct, because stripping the last "component" would not result in a
valid directory), yet the return value still does not point just after a
dir separator.

This assumption is most prominently seen in the
setup_git_directory_gently_1() function, where we want to append a
".git" component and simply assume that there is already a dir
separator. In the UNC example given above, this assumption is incorrect.

As a consequence, Git will fail to handle a worktree at the top of a UNC
share correctly.

Let's fix this by adding a dir separator specifically for that case: we
found that there is no first component in the path and it does not end
in a dir separator? Then add it.

This fixes https://github.com/git-for-windows/git/issues/1320

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>setup_git_directory(): handle UNC paths correctly</title>
<updated>2019-08-26T17:03:41Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2019-08-24T22:10:44Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=d17f2124a7860c2f37eaba574a867dbb4f506c27'/>
<id>urn:sha1:d17f2124a7860c2f37eaba574a867dbb4f506c27</id>
<content type='text'>
The first offset in a UNC path is not the host name, but the folder name after that.

This fixes https://github.com/git-for-windows/git/issues/1181

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>Move repository_format_partial_clone to promisor-remote.c</title>
<updated>2019-06-25T21:05:38Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2019-06-25T13:40:38Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=60b7a92d846a6cc542f96fa0045735cc0b9265fd'/>
<id>urn:sha1:60b7a92d846a6cc542f96fa0045735cc0b9265fd</id>
<content type='text'>
Now that we have has_promisor_remote() and can use many
promisor remotes, let's hide repository_format_partial_clone
as a static in promisor-remote.c to avoid it being use
for anything other than managing backward compatibility.

Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name</title>
<updated>2019-04-16T09:56:53Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-04-16T09:33:39Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e270f42c4d26fca591ca89ea8ee08ff17a72c1b5'/>
<id>urn:sha1:e270f42c4d26fca591ca89ea8ee08ff17a72c1b5</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ma/clear-repository-format'</title>
<updated>2019-03-20T06:16:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-03-20T06:16:07Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=6b5688b760a11430586122173d96b15fd3204308'/>
<id>urn:sha1:6b5688b760a11430586122173d96b15fd3204308</id>
<content type='text'>
The setup code has been cleaned up to avoid leaks around the
repository_format structure.

* ma/clear-repository-format:
  setup: fix memory leaks with `struct repository_format`
  setup: free old value before setting `work_tree`
</content>
</entry>
<entry>
<title>setup: fix memory leaks with `struct repository_format`</title>
<updated>2019-02-28T23:52:00Z</updated>
<author>
<name>Martin Ågren</name>
<email>martin.agren@gmail.com</email>
</author>
<published>2019-02-28T20:36:28Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=e8805af1c33d79750a979014c021cd63d780c720'/>
<id>urn:sha1:e8805af1c33d79750a979014c021cd63d780c720</id>
<content type='text'>
After we set up a `struct repository_format`, it owns various pieces of
allocated memory. We then either use those members, because we decide we
want to use the "candidate" repository format, or we discard the
candidate / scratch space. In the first case, we transfer ownership of
the memory to a few global variables. In the latter case, we just
silently drop the struct and end up leaking memory.

Introduce an initialization macro `REPOSITORY_FORMAT_INIT` and a
function `clear_repository_format()`, to be used on each side of
`read_repository_format()`. To have a clear and simple memory ownership,
let all users of `struct repository_format` duplicate the strings that
they take from it, rather than stealing the pointers.

Call `clear_...()` at the start of `read_...()` instead of just zeroing
the struct, since we sometimes enter the function multiple times. Thus,
it is important to initialize the struct before calling `read_...()`, so
document that. It's also important because we might not even call
`read_...()` before we call `clear_...()`, see, e.g., builtin/init-db.c.

Teach `read_...()` to clear the struct on error, so that it is reset to
a safe state, and document this. (In `setup_git_directory_gently()`, we
look at `repo_fmt.hash_algo` even if `repo_fmt.version` is -1, which we
weren't actually supposed to do per the API. After this commit, that's
ok.)

We inherit the existing code's combining "error" and "no version found".
Both are signalled through `version == -1` and now both cause us to
clear any partial configuration we have picked up. For "extensions.*",
that's fine, since they require a positive version number. For
"core.bare" and "core.worktree", we're already verifying that we have a
non-negative version number before using them.

Signed-off-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'js/abspath-part-inside-repo'</title>
<updated>2019-02-05T22:26:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-02-05T22:26:15Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ff09c9e5bad8971d25e7e2039836c9d42797e30a'/>
<id>urn:sha1:ff09c9e5bad8971d25e7e2039836c9d42797e30a</id>
<content type='text'>
On a case-insensitive filesystem, we failed to compare the part of
the path that is above the worktree directory in an absolute
pathname, which has been corrected.

* js/abspath-part-inside-repo:
  abspath_part_inside_repo: respect core.ignoreCase
</content>
</entry>
<entry>
<title>setup: free old value before setting `work_tree`</title>
<updated>2019-01-23T21:15:58Z</updated>
<author>
<name>Martin Ågren</name>
<email>martin.agren@gmail.com</email>
</author>
<published>2019-01-22T21:45:47Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=13019979b811d26f4838d09331c7ddd8223d270d'/>
<id>urn:sha1:13019979b811d26f4838d09331c7ddd8223d270d</id>
<content type='text'>
Before assigning to `data-&gt;work_tree` in `read_worktree_config()`, free
any value we might already have picked up, so that we do not leak it.

Signed-off-by: Martin Ågren &lt;martin.agren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
