<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/object-name.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-04-26T20:56:39Z</updated>
<entry>
<title>object-name: diagnose trees in index properly</title>
<updated>2022-04-26T20:56:39Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-04-26T20:43:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4925adb4dac1f794cc5d5c82dee49e2f5f47560f'/>
<id>urn:sha1:4925adb4dac1f794cc5d5c82dee49e2f5f47560f</id>
<content type='text'>
When running 'git show :&lt;path&gt;' where '&lt;path&gt;' is a directory, then
there is a subtle difference between a full checkout and a sparse
checkout. The error message from diagnose_invalid_index_path() reports
whether the path is on disk or not. The full checkout will have the
directory on disk, but the path will not be in the index. The sparse
checkout could have the directory not exist, specifically when that
directory is outside of the sparse-checkout cone.

In the case of a sparse index, we have yet another state: the path can
be a sparse directory in the index. In this case, the error message from
diagnose_invalid_index_path() would erroneously say "path '&lt;path&gt;' is in
the index, but not at stage 0", which is false.

Add special casing around sparse directory entries so we get to the
correct error message. This requires two checks in order to get parity
with the normal sparse-checkout case.

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>object-name: reject trees found in the index</title>
<updated>2022-04-26T20:56:38Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-04-26T20:43:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=561287d342cc55205b6cac33415ed96a6f112558'/>
<id>urn:sha1:561287d342cc55205b6cac33415ed96a6f112558</id>
<content type='text'>
The get_oid_with_context_1() method is used when parsing revision
arguments. One particular case is to take a ":&lt;path&gt;" string and search
the index for the given path.

In the case of a sparse index, this might find a sparse directory entry,
in which case the contained object is a tree. In the case of a full
index, this search within the index would fail.

In order to maintain identical return state as in a full index, inspect
the discovered cache entry to see if it is a sparse directory and reject
it. This requires being careful around the only_to_die option to be sure
we die only at the correct time.

This changes the behavior of 'git show :&lt;sparse-dir&gt;', but does not
bring it entirely into alignment with a full index case. It specifically
hits the wrong error message within diagnose_invalid_index_path(). That
error message will be corrected in a future 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 'ab/date-mode-release'</title>
<updated>2022-02-25T23:47:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-25T23:47:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0a01df08c03fe707e22795de7bd1d763ed02e9e1'/>
<id>urn:sha1:0a01df08c03fe707e22795de7bd1d763ed02e9e1</id>
<content type='text'>
Plug (some) memory leaks around parse_date_format().

* ab/date-mode-release:
  date API: add and use a date_mode_release()
  date API: add basic API docs
  date API: provide and use a DATE_MODE_INIT
  date API: create a date.h, split from cache.h
  cache.h: remove always unused show_date_human() declaration
</content>
</entry>
<entry>
<title>Merge branch 'ab/ambiguous-object-name'</title>
<updated>2022-02-25T23:47:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-25T23:47:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=268e6b8d4d95d9ade705666e152a4c054da32a47'/>
<id>urn:sha1:268e6b8d4d95d9ade705666e152a4c054da32a47</id>
<content type='text'>
Error output given in response to an ambiguous object name has been
improved.

* ab/ambiguous-object-name:
  object-name: re-use "struct strbuf" in show_ambiguous_object()
  object-name: iterate ambiguous objects before showing header
  object-name: show date for ambiguous tag objects
  object-name: make ambiguous object output translatable
  object-name: explicitly handle bad tags in show_ambiguous_object()
  object-name: explicitly handle OBJ_BAD in show_ambiguous_object()
  object-name tests: add tests for ambiguous object blind spots
</content>
</entry>
<entry>
<title>date API: create a date.h, split from cache.h</title>
<updated>2022-02-16T17:40:00Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-02-16T08:14:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88c7b4c3c8d51510d20ebb9990750ad0e97afbfb'/>
<id>urn:sha1:88c7b4c3c8d51510d20ebb9990750ad0e97afbfb</id>
<content type='text'>
Move the declaration of the date.c functions from cache.h, and adjust
the relevant users to include the new date.h header.

The show_ident_date() function belonged in pretty.h (it's defined in
pretty.c), its two users outside of pretty.c didn't strictly need to
include pretty.h, as they get it indirectly, but let's add it to them
anyway.

Similarly, the change to "builtin/{fast-import,show-branch,tag}.c"
isn't needed as far as the compiler is concerned, but since they all
use the "DATE_MODE()" macro we now define in date.h, let's have them
include it.

We could simply include this new header in "cache.h", but as this
change shows these functions weren't common enough to warrant
including in it in the first place. By moving them out of cache.h
changes to this API will no longer cause a (mostly) full re-build of
the project when "make" is run.

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>object-name: re-use "struct strbuf" in show_ambiguous_object()</title>
<updated>2022-01-27T20:09:34Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-01-27T05:26:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3a73c1dfafcc53831a252fc3aededeb59be476f1'/>
<id>urn:sha1:3a73c1dfafcc53831a252fc3aededeb59be476f1</id>
<content type='text'>
Reduce the allocations done by show_ambiguous_object() by moving the
"desc" strbuf into the "struct ambiguous_output" introduced in the
preceding commit.

This doesn't matter for optimization purposes, but since we're
accumulating a "struct strbuf advice" anyway let's follow that pattern
and add a "struct strbuf sb", we can then strbuf_reset() it rather
than calling strbuf_release() for each call to
show_ambiguous_object().

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>object-name: iterate ambiguous objects before showing header</title>
<updated>2022-01-27T20:09:34Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-01-27T05:26:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d2ef3cb7e29c35362125a61f1d96576c200076f6'/>
<id>urn:sha1:d2ef3cb7e29c35362125a61f1d96576c200076f6</id>
<content type='text'>
Change the "The candidates are" header that's shown for ambiguous
objects to be shown after we've iterated over all of the objects.

If we get any errors while doing so we don't want to split up the the
header and the list as a result. The two will now be printed together,
as shown in the updated testcase.

As we're accumulating the lines into as "struct strbuf" before
emitting them we need to add a trailing newline to the call in
show_ambiguous_object(). This and the change from "The candidates
are:" to "The candidates are:\n%s" helps to give translators more
context.

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>object-name: show date for ambiguous tag objects</title>
<updated>2022-01-27T20:09:33Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-01-27T05:26:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=851b3d7671778b74e40bf155c49f6b045f5eb4df'/>
<id>urn:sha1:851b3d7671778b74e40bf155c49f6b045f5eb4df</id>
<content type='text'>
Make the ambiguous tag object output nicer in the case of tag objects
such as ebf3c04b262 (Git 2.32, 2021-06-06) by including the date in
the "tagger" header. I.e.:

    $ git rev-parse b7e68
    error: short object ID b7e68 is ambiguous
    hint: The candidates are:
    hint:   b7e68c41d92 tag 2021-06-06 - v2.32.0
    hint:   b7e68ae18e0 commit 2019-12-23 - bisect: use the standard 'if (!var)' way to check for 0
    hint:   b7e68f6b413 tree
    hint:   b7e68490b97 blob
    b7e68
    [...]

Before this we'd emit a "tag" line without a date, e.g.:

    hint:   b7e68c41d92 tag v2.32.0

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>object-name: make ambiguous object output translatable</title>
<updated>2022-01-27T20:09:33Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-01-27T05:26:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ba5e8a0eb8011f7ffb246804e91c9ba0db3befe4'/>
<id>urn:sha1:ba5e8a0eb8011f7ffb246804e91c9ba0db3befe4</id>
<content type='text'>
Change the output of show_ambiguous_object() added in [1] and last
tweaked in [2] and the preceding commit to be more friendly to
translators.

By being able to customize the "&lt;SP&gt;&lt;SP&gt;%s\n" format we're even ready
for RTL languages, who'd presumably like to change that to
"%s&lt;SP&gt;&lt;SP&gt;\n".

In the case of the existing "tag [tag could not be parsed]" output
we'll now instead emit "[bad tag, could not parse it]". This is
consistent with the "[bad object]" output. Rephrasing the message like
this is possible because we're not unconditionally adding the
type_name() at the beginning.

1. 1ffa26c461 (get_short_sha1: list ambiguous objects on error,
   2016-09-26)
2. 5cc044e0257 (get_short_oid: sort ambiguous objects by type,
   then SHA-1, 2018-05-10)

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>object-name: explicitly handle bad tags in show_ambiguous_object()</title>
<updated>2022-01-27T20:09:33Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-01-27T05:26:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=667a560be7ae977e61d81ca4bcb95ded1cdacc9c'/>
<id>urn:sha1:667a560be7ae977e61d81ca4bcb95ded1cdacc9c</id>
<content type='text'>
Follow-up the handling of OBJ_BAD in the preceding commit and
explicitly handle those cases where parse_tag() fails, or we don't end
up with a non-NULL pointer in in tag-&gt;tag.

If we run into such a tag we'd previously be silent about it. We
really should also be handling these batter in parse_tag_buffer() by
being more eager to emit an error(), instead of silently aborting with
"return -1;".

One example of such a tag is the one that's tested for in
"t3800-mktag.sh", where the code takes the "size &lt;
the_hash_algo-&gt;hexsz + 24" branch.

But in lieu of earlier missing "error" output let's show the user
something to indicate why we're not showing a tag message in these
cases, now instead of showing:

    hint:   deadbeef tag

We'll instead display:

    hint:   deadbeef tag [tag could not be parsed]

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>
</feed>
