<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/commit-graph.c, branch v2.26.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.26.1</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.26.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-02-04T19:36:51Z</updated>
<entry>
<title>commit-graph.h: use odb in 'load_commit_graph_one_fd_st'</title>
<updated>2020-02-04T19:36:51Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-02-03T21:18:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a7df60cac834cb7f91c3463205c2b6ba5e694200'/>
<id>urn:sha1:a7df60cac834cb7f91c3463205c2b6ba5e694200</id>
<content type='text'>
Apply a similar treatment as in the previous patch to pass a 'struct
object_directory *' through the 'load_commit_graph_one_fd_st'
initializer, too.

This prevents a potential bug where a pointer comparison is made to a
NULL 'g-&gt;odb', which would cause the commit-graph machinery to think
that a pair of commit-graphs belonged to different alternates when in
fact they do not (i.e., in the case of no '--object-dir').

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph.c: remove path normalization, comparison</title>
<updated>2020-02-04T19:36:51Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-02-03T21:18:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ad2dd5bb63b6c2da0091d63463e29ae27e47a893'/>
<id>urn:sha1:ad2dd5bb63b6c2da0091d63463e29ae27e47a893</id>
<content type='text'>
As of the previous patch, all calls to 'commit-graph.c' functions which
perform path normalization (for e.g., 'get_commit_graph_filename()') are
of the form 'ctx-&gt;odb-&gt;path', which is always in normalized form.

Now that there are no callers passing non-normalized paths to these
functions, ensure that future callers are bound by the same restrictions
by making these functions take a 'struct object_directory *' instead of
a 'const char *'. To match, replace all calls with arguments of the form
'ctx-&gt;odb-&gt;path' with 'ctx-&gt;odb' To recover the path, functions that
perform path manipulation simply use 'odb-&gt;path'.

Further, avoid string comparisons with arguments of the form
'odb-&gt;path', and instead prefer raw pointer comparisons, which
accomplish the same effect, but are far less brittle.

This has a pleasant side-effect of making these functions much more
robust to paths that cannot be normalized by 'normalize_path_copy()',
i.e., because they are outside of the current working directory.

For example, prior to this patch, Valgrind reports that the following
uninitialized memory read [1]:

  $ ( cd t &amp;&amp; GIT_DIR=../.git valgrind git rev-parse HEAD^ )

because 'normalize_path_copy()' can't normalize '../.git' (since it's
relative to but above of the current working directory) [2].

By using a 'struct object_directory *' directly,
'get_commit_graph_filename()' does not need to normalize, because all
paths are relative to the current working directory since they are
always read from the '-&gt;path' of an object directory.

[1]: https://lore.kernel.org/git/20191027042116.GA5801@sigill.intra.peff.net.
[2]: The bug here is that 'get_commit_graph_filename()' returns the
     result of 'normalize_path_copy()' without checking the return
     value.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph.h: store object directory in 'struct commit_graph'</title>
<updated>2020-02-04T19:36:51Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-02-03T21:18:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13c249924995d504001eb8083fac106041b32f98'/>
<id>urn:sha1:13c249924995d504001eb8083fac106041b32f98</id>
<content type='text'>
In a previous patch, the 'char *object_dir' in 'struct commit_graph' was
replaced with a 'struct object_directory'. This patch applies the same
treatment to 'struct commit_graph', which is another intermediate step
towards getting rid of all path normalization in 'commit-graph.c'.

Instead of taking a 'char *object_dir', functions that construct a
'struct commit_graph' now take a 'struct object_directory *'. Any code
that needs an object directory path use '-&gt;path' instead.

This ensures that all calls to functions that perform path normalization
are given arguments which do not themselves require normalization. This
prepares those functions to drop their normalization entirely, which
will occur in the subsequent patch.

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph.h: store an odb in 'struct write_commit_graph_context'</title>
<updated>2020-02-04T19:36:37Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-02-04T05:51:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0bd52e27e315a76d6950fa30ce602eef15d90571'/>
<id>urn:sha1:0bd52e27e315a76d6950fa30ce602eef15d90571</id>
<content type='text'>
There are lots of places in 'commit-graph.h' where a function either has
(or almost has) a full 'struct object_directory *', accesses '-&gt;path',
and then throws away the rest of the struct.

This can cause headaches when comparing the locations of object
directories across alternates (e.g., in the case of deciding if two
commit-graph layers can be merged). These paths are normalized with
'normalize_path_copy()' which mitigates some comparison issues, but not
all [1].

Replace usage of 'char *object_dir' with 'odb-&gt;path' by storing a
'struct object_directory *' in the 'write_commit_graph_context'
structure. This is an intermediate step towards getting rid of all path
normalization in 'commit-graph.c'.

Resolving a user-provided '--object-dir' argument now requires that we
compare it to the known alternates for equality.  Prior to this patch,
an unknown '--object-dir' argument would silently exit with status zero.

This can clearly lead to unintended behavior, such as verifying
commit-graphs that aren't in a repository's own object store (or one of
its alternates), or causing a typo to mask a legitimate commit-graph
verification failure. Make this error non-silent by 'die()'-ing when the
given '--object-dir' does not match any known alternate object store.

[1]: In my testing, for example, I can get one side of the commit-graph
code to fill object_dir with "./objects" and the other with just
"objects".

Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>test-tool: use 'read-graph' helper</title>
<updated>2019-11-13T02:14:16Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2019-11-12T16:58:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4bd0593e0f9149b0e72886c0a2d85bb22fc5404a'/>
<id>urn:sha1:4bd0593e0f9149b0e72886c0a2d85bb22fc5404a</id>
<content type='text'>
The 'git commit-graph read' subcommand is used in test scripts to check
that the commit-graph contents match the expected data. Mostly, this
helps check the header information and the list of chunks. Users do not
need this information, so move the functionality to a test helper.

Reported-by: Bryan Turner &lt;bturner@atlassian.com&gt;
Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sg/commit-graph-usage-fix'</title>
<updated>2019-11-10T09:02:15Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-11-10T09:02:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=14b58c62bcd60b7b5bfbb895eb869f7d1d64a9b7'/>
<id>urn:sha1:14b58c62bcd60b7b5bfbb895eb869f7d1d64a9b7</id>
<content type='text'>
Message fix.

* sg/commit-graph-usage-fix:
  builtin/commit-graph.c: remove subcommand-less usage string
</content>
</entry>
<entry>
<title>builtin/commit-graph.c: remove subcommand-less usage string</title>
<updated>2019-10-28T03:24:17Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2019-10-25T16:49:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8b656572ca1d5b4e917b7bf835c95ddb50a5282a'/>
<id>urn:sha1:8b656572ca1d5b4e917b7bf835c95ddb50a5282a</id>
<content type='text'>
The first line in 'git commit-graph's usage string indicates that this
command can be invoked without specifying a subcommand.  However, this
is not the case:

  $ git commit-graph
  usage: git commit-graph [--object-dir &lt;objdir&gt;]
     or: git commit-graph read [--object-dir &lt;objdir&gt;]
  [...]
  $ echo $?
  129

Remove this line from the usage string.

The synopsis in the manpage doesn't contain this line.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'gs/commit-graph-trace-with-cmd'</title>
<updated>2019-10-15T04:48:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-10-15T04:48:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ccc289915af00b44346cbf007f4f82ec2131f1a1'/>
<id>urn:sha1:ccc289915af00b44346cbf007f4f82ec2131f1a1</id>
<content type='text'>
Dev support.

* gs/commit-graph-trace-with-cmd:
  commit-graph: emit trace2 cmd_mode for each sub-command
</content>
</entry>
<entry>
<title>Merge branch 'gs/commit-graph-progress'</title>
<updated>2019-10-07T02:32:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-10-07T02:32:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=caf150ce7d60e4070292226ec208478b801b8d4b'/>
<id>urn:sha1:caf150ce7d60e4070292226ec208478b801b8d4b</id>
<content type='text'>
* gs/commit-graph-progress:
  commit-graph: add --[no-]progress to write and verify
</content>
</entry>
<entry>
<title>Merge branch 'jk/commit-graph-cleanup'</title>
<updated>2019-10-07T02:32:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-10-07T02:32:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cda8faa37e997f5db3458c1454ffe70f5c460d2a'/>
<id>urn:sha1:cda8faa37e997f5db3458c1454ffe70f5c460d2a</id>
<content type='text'>
A pair of small fixups to "git commit-graph" have been applied.

* jk/commit-graph-cleanup:
  commit-graph: turn off save_commit_buffer
  commit-graph: don't show progress percentages while expanding reachable commits
</content>
</entry>
</feed>
