<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/dir.c, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-06-08T21:27:50Z</updated>
<entry>
<title>Merge branch 'js/ci-gcc-12-fixes' into maint</title>
<updated>2022-06-08T21:27:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-06-08T21:27:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=596838d2c564f3fea30315d4bd6633c32f70bfed'/>
<id>urn:sha1:596838d2c564f3fea30315d4bd6633c32f70bfed</id>
<content type='text'>
Fixes real problems noticed by gcc 12 and works around false
positives.
source: &lt;pull.1238.git.1653351786.gitgitgadget@gmail.com&gt;

* js/ci-gcc-12-fixes:
  dir.c: avoid "exceeds maximum object size" error with GCC v12.x
  nedmalloc: avoid new compile error
  compat/win32/syslog: fix use-after-realloc
</content>
</entry>
<entry>
<title>dir.c: avoid "exceeds maximum object size" error with GCC v12.x</title>
<updated>2022-05-24T22:58:41Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-05-24T00:23:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2acf4cf0010379f10b39eba1fb4e0868a5ba4114'/>
<id>urn:sha1:2acf4cf0010379f10b39eba1fb4e0868a5ba4114</id>
<content type='text'>
Technically, the pointer difference `end - start` _could_ be negative,
and when cast to an (unsigned) `size_t` that would cause problems. In
this instance, the symptom is:

dir.c: In function 'git_url_basename':
dir.c:3087:13: error: 'memchr' specified bound [9223372036854775808, 0]
       exceeds maximum object size 9223372036854775807
       [-Werror=stringop-overread]
    CC ewah/bitmap.o
 3087 |         if (memchr(start, '/', end - start) == NULL
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

While it is a bit far-fetched to think that `end` (which is defined as
`repo + strlen(repo)`) and `start` (which starts at `repo` and never
steps beyond the NUL terminator) could result in such a negative
difference, GCC has no way of knowing that.

See also https://gcc.gnu.org/bugzilla//show_bug.cgi?id=85783.

Let's just add a safety check, primarily for GCC's benefit.

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>Merge branch 'vd/sparse-read-tree'</title>
<updated>2022-03-17T00:53:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-17T00:53:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=190f9bf62a17ca6f97dee3f3818450ab2927215b'/>
<id>urn:sha1:190f9bf62a17ca6f97dee3f3818450ab2927215b</id>
<content type='text'>
"git read-tree" has been made to be aware of the sparse-index
feature.

* vd/sparse-read-tree:
  read-tree: make three-way merge sparse-aware
  read-tree: make two-way merge sparse-aware
  read-tree: narrow scope of index expansion for '--prefix'
  read-tree: integrate with sparse index
  read-tree: expand sparse checkout test coverage
  read-tree: explicitly disallow prefixes with a leading '/'
  status: fix nested sparse directory diff in sparse index
  sparse-index: prevent repo root from becoming sparse
</content>
</entry>
<entry>
<title>Merge branch 'ab/object-file-api-updates'</title>
<updated>2022-03-17T00:53:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-17T00:53:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=430883a70c79614e52279f2800a9a383ffc68fe5'/>
<id>urn:sha1:430883a70c79614e52279f2800a9a383ffc68fe5</id>
<content type='text'>
Object-file API shuffling.

* ab/object-file-api-updates:
  object-file API: pass an enum to read_object_with_reference()
  object-file.c: add a literal version of write_object_file_prepare()
  object-file API: have hash_object_file() take "enum object_type"
  object API: rename hash_object_file_literally() to write_*()
  object-file API: split up and simplify check_object_signature()
  object API users + docs: check &lt;0, not !0 with check_object_signature()
  object API docs: move check_object_signature() docs to cache.h
  object API: correct "buf" v.s. "map" mismatch in *.c and *.h
  object-file API: have write_object_file() take "enum object_type"
  object-file API: add a format_object_header() function
  object-file API: return "void", not "int" from hash_object_file()
  object-file.c: split up declaration of unrelated variables
</content>
</entry>
<entry>
<title>Merge branch 'tk/empty-untracked-cache'</title>
<updated>2022-03-17T00:53:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-03-17T00:53:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=47e0380289b4d60c6fc6a86935686233113aa001'/>
<id>urn:sha1:47e0380289b4d60c6fc6a86935686233113aa001</id>
<content type='text'>
The untracked cache newly computed weren't written back to the
on-disk index file when there is no other change to the index,
which has been corrected.

* tk/empty-untracked-cache:
  untracked-cache: write index when populating empty untracked cache
  t7519: populate untracked cache before test
  t7519: avoid file to index mtime race for untracked cache
</content>
</entry>
<entry>
<title>sparse-index: prevent repo root from becoming sparse</title>
<updated>2022-03-01T20:36:00Z</updated>
<author>
<name>Victoria Dye</name>
<email>vdye@github.com</email>
</author>
<published>2022-03-01T20:24:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=287fd17e3a1daec2b0d0d8e26d2b2318511ec153'/>
<id>urn:sha1:287fd17e3a1daec2b0d0d8e26d2b2318511ec153</id>
<content type='text'>
Prevent the repository root from being collapsed into a sparse directory by
treating an empty path as "inside the sparse-checkout". When collapsing a
sparse index (e.g. in 'git sparse-checkout reapply'), the root directory
typically could not become a sparse directory due to the presence of in-cone
root-level files and directories. However, if no such in-cone files or
directories were present, there was no explicit check signaling that the
"repository root path" (an empty string, in the case of
'convert_to_sparse(...)') was in-cone, and a sparse directory index entry
would be created from the repository root directory.

The documentation in Documentation/git-sparse-checkout.txt explicitly states
that the files in the root directory are expected to be in-cone for a
cone-mode sparse-checkout. Collapsing the root into a sparse directory entry
violates that assumption, as sparse directory entries are expected to be
outside the sparse cone and have SKIP_WORKTREE enabled. This invalid state
in turn causes issues with commands that interact with the index, e.g.
'git status'.

Treating an empty (root) path as in-cone prevents the creation of a root
sparse directory in 'convert_to_sparse(...)'. Because the repository root is
otherwise never compared with sparse patterns (in both cone-mode and
non-cone sparse-checkouts), the new check does not cause additional changes
to how sparse patterns are applied.

Helped-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Victoria Dye &lt;vdye@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>untracked-cache: write index when populating empty untracked cache</title>
<updated>2022-02-28T18:02:18Z</updated>
<author>
<name>Tao Klerks</name>
<email>tao@klerks.biz</email>
</author>
<published>2022-02-27T21:57:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=317956d91239e86b26ce95735451698b042dbe5d'/>
<id>urn:sha1:317956d91239e86b26ce95735451698b042dbe5d</id>
<content type='text'>
It is expected that an empty/unpopulated untracked cache structure can
be written to the index - by update-index, or by a "git status" call
that sees the untracked cache should be enabled and is not, but is
running with options that make the untracked cache non-applicable in
that run (eg a pathspec).

Currently, if that happens, then subsequent "git status" calls end up
populating the untracked cache, but not writing the index (not saving
their work) - so the performance outcome is almost identical to the
cache being altogether disabled.

This continues until the index gets written with the untracked cache
populated, for some *other* reason, such as a working tree change.

Detect the condition where an empty untracked cache exists in the
index and we will collect the list of untracked paths, and queue an
index write under that condition, so that the collected untracked
paths can be written out to the untracked cache extension in the
index.

This change depends on previous fixes to t7519 for the "ignore .git
changes when invalidating UNTR" test case to pass - before this fix,
the test never actually did anything as it was not set up correctly.

Signed-off-by: Tao Klerks &lt;tao@klerks.biz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object-file API: have hash_object_file() take "enum object_type"</title>
<updated>2022-02-26T01:16:32Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-02-04T23:48:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=44439c1c5827480f68b37c3cc38f257eaeb3ed2c'/>
<id>urn:sha1:44439c1c5827480f68b37c3cc38f257eaeb3ed2c</id>
<content type='text'>
Change the hash_object_file() function to take an "enum
object_type".

Since a preceding commit all of its callers are passing either
"{commit,tree,blob,tag}_type", or the result of a call to type_name(),
the parse_object() caller that would pass NULL is now using
stream_object_signature().

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>dir: force untracked cache with core.untrackedCache</title>
<updated>2022-02-17T22:47:13Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-02-17T21:00:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26b89464219d3cfb0af7dc2274751eff641dea8d'/>
<id>urn:sha1:26b89464219d3cfb0af7dc2274751eff641dea8d</id>
<content type='text'>
The GIT_FORCE_UNTRACKED_CACHE environment variable writes the untracked
cache more frequently than the core.untrackedCache config variable. This
is due to how read_directory() handles the creation of an untracked
cache.

Before this change, Git would not create the untracked cache extension
for an index that did not already have one. Users would need to run a
command such as 'git update-index --untracked-cache' before the index
would actually contain an untracked cache.

In particular, users noticed that the untracked cache would not appear
even with core.untrackedCache=true. Some users reported setting
GIT_FORCE_UNTRACKED_CACHE=1 in their engineering system environment to
ensure the untracked cache would be created.

The decision to not write the untracked cache without an environment
variable tracks back to fc9ecbeb9 (dir.c: don't flag the index as dirty
for changes to the untracked cache, 2018-02-05). The motivation of that
change is that writing the index is expensive, and if the untracked
cache is the only thing that needs to be written, then it is more
expensive than the benefit of the cache. However, this also means that
the untracked cache never gets populated, so the user who enabled it via
config does not actually get the extension until running 'git
update-index --untracked-cache' manually or using the environment
variable.

We have had a version of this change in the microsoft/git fork for a few
major releases now. It has been working well to get users into a good
state. Yes, that first index write is slow, but the remaining index
writes are much faster than they would be without this change.

Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/sparse-checkout-malformed-pattern-fix'</title>
<updated>2022-01-10T19:52:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-01-10T19:52:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=09481fec21f339d980fca369be3936964003d38b'/>
<id>urn:sha1:09481fec21f339d980fca369be3936964003d38b</id>
<content type='text'>
Certain sparse-checkout patterns that are valid in non-cone mode
led to segfault in cone mode, which has been corrected.

* ds/sparse-checkout-malformed-pattern-fix:
  sparse-checkout: refuse to add to bad patterns
  sparse-checkout: fix OOM error with mixed patterns
  sparse-checkout: fix segfault on malformed patterns
</content>
</entry>
</feed>
