<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/commit-graph.c, branch v2.28.0</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=v2.28.0</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=v2.28.0'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2020-07-15T23:29:43Z</updated>
<entry>
<title>Merge branch 'sg/commit-graph-progress-fix' into master</title>
<updated>2020-07-15T23:29:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-07-15T23:29:43Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=12f5eb9f082d7f4cb083a11aa59ac8bbd5e1589a'/>
<id>urn:sha1:12f5eb9f082d7f4cb083a11aa59ac8bbd5e1589a</id>
<content type='text'>
The code to produce progress output from "git commit-graph --write"
had a few breakages, which have been fixed.

* sg/commit-graph-progress-fix:
  commit-graph: fix "Writing out commit graph" progress counter
  commit-graph: fix progress of reachable commits
</content>
</entry>
<entry>
<title>Merge branch 'tb/fix-persistent-shallow' into master</title>
<updated>2020-07-09T21:00:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-07-09T21:00:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=24ecfdf206ee0e9e01f86d333d90d281fdfd12d0'/>
<id>urn:sha1:24ecfdf206ee0e9e01f86d333d90d281fdfd12d0</id>
<content type='text'>
When "fetch.writeCommitGraph" configuration is set in a shallow
repository and a fetch moves the shallow boundary, we wrote out
broken commit-graph files that do not match the reality, which has
been corrected.

* tb/fix-persistent-shallow:
  commit.c: don't persist substituted parents when unshallowing
</content>
</entry>
<entry>
<title>commit-graph: fix "Writing out commit graph" progress counter</title>
<updated>2020-07-09T17:28:49Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2020-07-09T17:00:03Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=150cd3b61d55bedd275e0ed36a6f674dcd34ae25'/>
<id>urn:sha1:150cd3b61d55bedd275e0ed36a6f674dcd34ae25</id>
<content type='text'>
76ffbca71a (commit-graph: write Bloom filters to commit graph file,
2020-04-06) added two delayed progress lines to writing the Bloom
filter index and data chunk.  This is wrong, because a single common
progress is used while writing all chunks, which is not updated while
writing these two new chunks, resulting in incomplete-looking "done"
lines:

  Expanding reachable commits in commit graph: 888679, done.
  Computing commit changed paths Bloom filters: 100% (888678/888678), done.
  Writing out commit graph in 6 passes:  66% (3554712/5332068), done.

Use the common 'struct progress' instance while writing the Bloom
filter chunks as well.

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>commit-graph: fix progress of reachable commits</title>
<updated>2020-07-09T17:27:23Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2020-07-09T16:54:32Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=6f9d5f2fda1f94cf1539d3e0529c2b2e7ee7eebb'/>
<id>urn:sha1:6f9d5f2fda1f94cf1539d3e0529c2b2e7ee7eebb</id>
<content type='text'>
To display a progress line while iterating over all refs,
d335ce8f24 (commit-graph.c: show progress of finding reachable
commits, 2020-05-13) should have added a pair of
start_delayed_progress() and stop_progress() calls around a
for_each_ref() invocation.  Alas, the stop_progress() call ended up at
the wrong place, after write_commit_graph(), which does all the
commit-graph computation and writing, and has several progress lines
of its own.  Consequently, that new

  Collecting referenced commits: 123

progress line is overwritten by the first progress line shown by
write_commit_graph(), and its final "done" line is shown last, after
everything is finished:

  Expanding reachable commits in commit graph: 344786, done.
  Computing commit changed paths Bloom filters: 100% (344786/344786), done.
  Collecting referenced commits: 154, done.

Move that stop_progress() call to the right place.

While at it, drop the unnecessary 'if (data.progress)' condition
protecting the stop_progress() call, because that function is prepared
to handle a NULL progress struct.

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>commit.c: don't persist substituted parents when unshallowing</title>
<updated>2020-07-08T23:13:46Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-07-08T21:10:53Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=ce16364e897e70a17bd1864b6007719eeec959f3'/>
<id>urn:sha1:ce16364e897e70a17bd1864b6007719eeec959f3</id>
<content type='text'>
Since 37b9dcabfc (shallow.c: use '{commit,rollback}_shallow_file',
2020-04-22), Git knows how to reset stat-validity checks for the
$GIT_DIR/shallow file, allowing it to change between a shallow and
non-shallow state in the same process (e.g., in the case of 'git fetch
--unshallow').

However, when $GIT_DIR/shallow changes, Git does not alter or remove any
grafts (nor substituted parents) in memory.

This comes up in a "git fetch --unshallow" with fetch.writeCommitGraph
set to true. Ordinarily in a shallow repository (and before 37b9dcabfc,
even in this case), commit_graph_compatible() would return false,
indicating that the repository should not be used to write a
commit-graphs (since commit-graph files cannot represent a shallow
history). But since 37b9dcabfc, in an --unshallow operation that check
succeeds.

Thus even though the repository isn't shallow any longer (that is, we
have all of the objects), the in-core representation of those objects
still has munged parents at the shallow boundaries.  When the
commit-graph write proceeds, we use the incorrect parentage, producing
wrong results.

There are two ways for a user to work around this: either (1) set
'fetch.writeCommitGraph' to 'false', or (2) drop the commit-graph after
unshallowing.

One way to fix this would be to reset the parsed object pool entirely
(flushing the cache and thus preventing subsequent reads from modifying
their parents) after unshallowing. That would produce a problem when
callers have a now-stale reference to the old pool, and so this patch
implements a different approach. Instead, attach a new bit to the pool,
'substituted_parent', which indicates if the repository *ever* stored a
commit which had its parents modified (i.e., the shallow boundary
prior to unshallowing).

This bit needs to be sticky because all reads subsequent to modifying a
commit's parents are unreliable when unshallowing. Modify the check in
'commit_graph_compatible' to take this bit into account, and correctly
avoid generating commit-graphs in this case, thus solving the bug.

Helped-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Helped-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Reported-by: Jay Conrod &lt;jayconrod@google.com&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
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: minimize commit_graph_data_slab access</title>
<updated>2020-06-17T21:37:52Z</updated>
<author>
<name>Abhishek Kumar</name>
<email>abhishekkumar8222@gmail.com</email>
</author>
<published>2020-06-17T09:14:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c752ad09c4ea479e8d54d08637cc0e5709723208'/>
<id>urn:sha1:c752ad09c4ea479e8d54d08637cc0e5709723208</id>
<content type='text'>
In an earlier patch, multiple struct acccesses to `graph_pos` and
`generation` were auto-converted to multiple method calls.

Since the values are fixed and commit-slab access costly, we would be
better off with storing the values as a local variable and reusing it.

Signed-off-by: Abhishek Kumar &lt;abhishekkumar8222@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit: move members graph_pos, generation to a slab</title>
<updated>2020-06-17T21:37:30Z</updated>
<author>
<name>Abhishek Kumar</name>
<email>abhishekkumar8222@gmail.com</email>
</author>
<published>2020-06-17T09:14:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c49c82aa4c1036ba1629f73223cff53230e695f3'/>
<id>urn:sha1:c49c82aa4c1036ba1629f73223cff53230e695f3</id>
<content type='text'>
We remove members `graph_pos` and `generation` from the struct commit.
The default assignments in init_commit_node() are no longer valid,
which is fine as the slab helpers return appropriate default values and
the assignments are removed.

We will replace existing use of commit-&gt;generation and commit-&gt;graph_pos
by commit_graph_data_slab helpers using
`contrib/coccinelle/commit.cocci'.

Signed-off-by: Abhishek Kumar &lt;abhishekkumar8222@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-graph: introduce commit_graph_data_slab</title>
<updated>2020-06-17T21:37:23Z</updated>
<author>
<name>Abhishek Kumar</name>
<email>abhishekkumar8222@gmail.com</email>
</author>
<published>2020-06-17T09:14:09Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=4844812b9ec9bc6ffdc2da2c54d9146ff4c97d94'/>
<id>urn:sha1:4844812b9ec9bc6ffdc2da2c54d9146ff4c97d94</id>
<content type='text'>
The struct commit is used in many contexts. However, members
`generation` and `graph_pos` are only used for commit-graph related
operations and otherwise waste memory.

This wastage would have been more pronounced as we transition to
generation number v2, which uses 64-bit generation number instead of
current 32-bits.

As they are often accessed together, let's introduce struct
commit_graph_data and move them to a commit_graph_data slab.

While the overall test suite runs just as fast as master,
(series: 26m48s, master: 27m34s, faster by 2.87%), certain commands
like `git merge-base --is-ancestor` were slowed by 40% as discovered
by Szeder Gábor [1]. After minimizing commit-slab access, the slow down
persists but is closer to 20%.

Derrick Stolee believes the slow down is attributable to the underlying
algorithm rather than the slowness of commit-slab access [2] and we will
follow-up in a later series.

[1]: https://lore.kernel.org/git/20200607195347.GA8232@szeder.dev/
[2]: https://lore.kernel.org/git/13db757a-9412-7f1e-805c-8a028c4ab2b1@gmail.com/

Signed-off-by: Abhishek Kumar &lt;abhishekkumar8222@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tb/commit-graph-no-check-oids'</title>
<updated>2020-06-09T01:06:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-06-09T01:06:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=dc57a9be5ee2f9c719965a9e6c7a2ed97af180a1'/>
<id>urn:sha1:dc57a9be5ee2f9c719965a9e6c7a2ed97af180a1</id>
<content type='text'>
Clean-up the commit-graph codepath.

* tb/commit-graph-no-check-oids:
  commit-graph: drop COMMIT_GRAPH_WRITE_CHECK_OIDS flag
  t5318: reorder test below 'graph_read_expect'
  commit-graph.c: simplify 'fill_oids_from_commits'
  builtin/commit-graph.c: dereference tags in builtin
  builtin/commit-graph.c: extract 'read_one_commit()'
  commit-graph.c: peel refs in 'add_ref_to_set'
  commit-graph.c: show progress of finding reachable commits
  commit-graph.c: extract 'refs_cb_data'
</content>
</entry>
<entry>
<title>commit-graph: drop COMMIT_GRAPH_WRITE_CHECK_OIDS flag</title>
<updated>2020-05-18T19:51:11Z</updated>
<author>
<name>Taylor Blau</name>
<email>me@ttaylorr.com</email>
</author>
<published>2020-05-13T21:59:55Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2f00c355cb79ee86bddc9f2fef91ac380a6023fc'/>
<id>urn:sha1:2f00c355cb79ee86bddc9f2fef91ac380a6023fc</id>
<content type='text'>
Since 7c5c9b9c57 (commit-graph: error out on invalid commit oids in
'write --stdin-commits', 2019-08-05), the commit-graph builtin dies on
receiving non-commit OIDs as input to '--stdin-commits'.

This behavior can be cumbersome to work around in, say, the case of
piping 'git for-each-ref' to 'git commit-graph write --stdin-commits' if
the caller does not want to cull out non-commits themselves. In this
situation, it would be ideal if 'git commit-graph write' wrote the graph
containing the inputs that did pertain to commits, and silently ignored
the remainder of the input.

Some options have been proposed to the effect of '--[no-]check-oids'
which would allow callers to have the commit-graph builtin do just that.
After some discussion, it is difficult to imagine a caller who wouldn't
want to pass '--no-check-oids', suggesting that we should get rid of the
behavior of complaining about non-commit inputs altogether.

If callers do wish to retain this behavior, they can easily work around
this change by doing the following:

     git for-each-ref --format='%(objectname) %(objecttype) %(*objecttype)' |
     awk '
       !/commit/ { print "not-a-commit:"$1 }
        /commit/ { print $1 }
     ' |
     git commit-graph write --stdin-commits

To make it so that valid OIDs that refer to non-existent objects are
indeed an error after loosening the error handling, perform an extra
lookup to make sure that object indeed exists before sending it to the
commit-graph internals.

Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
