<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/subtree, branch v2.45.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-03-16T18:08:55Z</updated>
<entry>
<title>contrib/subtree/t: avoid redundant use of cat</title>
<updated>2024-03-16T18:08:55Z</updated>
<author>
<name>Beat Bolli</name>
<email>bb@drbeat.li</email>
</author>
<published>2024-03-15T19:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2fbd3ac8e6786a12a15e1c1f396789651ad52f06'/>
<id>urn:sha1:2fbd3ac8e6786a12a15e1c1f396789651ad52f06</id>
<content type='text'>
Signed-off-by: Beat Bolli &lt;dev+git@drbeat.li&gt;
Acked-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>subtree: fix split processing with multiple subtrees present</title>
<updated>2024-01-25T18:56:34Z</updated>
<author>
<name>Zach FettersMoore</name>
<email>zach.fetters@apollographql.com</email>
</author>
<published>2023-12-01T14:54:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=98ba49ccc247c3521659aa3d43c970e8978922c5'/>
<id>urn:sha1:98ba49ccc247c3521659aa3d43c970e8978922c5</id>
<content type='text'>
When there are multiple subtrees present in a repository and they are
all using 'git subtree split', the 'split' command can take a
significant (and constantly growing) amount of time to run even when
using the '--rejoin' flag. This is due to the fact that when processing
commits to determine the last known split to start from when looking
for changes, if there has been a split/merge done from another subtree
there will be 2 split commits, one mainline and one subtree, for the
second subtree that are part of the processing. The non-mainline
subtree split commit will cause the processing to always need to search
the entire history of the given subtree as part of its processing even
though those commits are totally irrelevant to the current subtree
split being run.

To see this in practice you can use the open source GitHub repo
'apollo-ios-dev' and do the following in order:

-Make a changes to a file in 'apollo-ios' and 'apollo-ios-codegen'
 directories
-Create a commit containing these changes
-Do a split on apollo-ios-codegen
   - Do a fetch on the subtree repo
      - git fetch git@github.com:apollographql/apollo-ios-codegen.git
   - git subtree split --prefix=apollo-ios-codegen --squash --rejoin
   - Depending on the current state of the 'apollo-ios-dev' repo
     you may see the issue at this point if the last split was on
     apollo-ios
-Do a split on apollo-ios
   - Do a fetch on the subtree repo
      - git fetch git@github.com:apollographql/apollo-ios.git
   - git subtree split --prefix=apollo-ios --squash --rejoin
-Make changes to a file in apollo-ios-codegen
-Create a commit containing the change(s)
-Do a split on apollo-ios-codegen
   - git subtree split --prefix=apollo-ios-codegen --squash --rejoin
-To see that the patch fixes the issue you can use the custom subtree
 script in the repo so following the same steps as above, except
 instead of using 'git subtree ...' for the commands use
 'git-subtree.sh ...' for the commands

You will see that the final split is looking for the last split
on apollo-ios-codegen to use as it's starting point to process
commits. Since there is a split commit from apollo-ios in between the
2 splits run on apollo-ios-codegen, the processing ends up traversing
the entire history of apollo-ios which increases the time it takes to
do a split based on how long of a history apollo-ios has, while none
of these commits are relevant to the split being done on
apollo-ios-codegen.

So this commit makes a change to the processing of commits for the
split command in order to ignore non-mainline commits from other
subtrees such as apollo-ios in the above breakdown by adding a new
function 'should_ignore_subtree_commit' which is called during
'process_split_commit'. This allows the split/rejoin processing to
still function as expected but removes all of the unnecessary
processing that takes place currently which greatly inflates the
processing time. In the above example, previously the final split
would take ~10-12 minutes, while after this fix it takes seconds.

Added a test to validate that the proposed fix
solves the issue.

The test accomplishes this by checking the output
of the split command to ensure the output from
the progress of 'process_split_commit' function
that represents the 'extracount' of commits
processed remains at 0, meaning none of the commits
from the second subtree were processed.

This was tested against the original functionality
to show the test failed, and then with this fix
to show the test passes.

This illustrated that when using multiple subtrees,
A and B, when doing a split on subtree B, the
processing does not traverse the entire history
of subtree A which is unnecessary and would cause
the 'extracount' of processed commits to climb
based on the number of commits in the history of
subtree A.

Signed-off-by: Zach FettersMoore &lt;zach.fetters@apollographql.com&gt;
Reviewed-by: Christian Couder &lt;christian.couder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: convert subtree type check to use case statement</title>
<updated>2023-11-11T00:21:00Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2023-11-10T10:01:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=47c39c28bc1a0001e4341ae70629adcb10f425cc'/>
<id>urn:sha1:47c39c28bc1a0001e4341ae70629adcb10f425cc</id>
<content type='text'>
The `subtree_for_commit ()` helper function asserts that the subtree
identified by its parameters are either a commit or tree. This is done
via the `-o` parameter of test, which is discouraged.

Refactor the code to instead use a switch statement over the type.
Despite being aligned with our coding guidelines, the resulting code is
arguably also easier to read.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>contrib/subtree: stop using `-o` to test for number of args</title>
<updated>2023-11-11T00:21:00Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2023-11-10T10:01:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88983946fa00ebea8b346acab46e19bceeed427d'/>
<id>urn:sha1:88983946fa00ebea8b346acab46e19bceeed427d</id>
<content type='text'>
Functions in git-subtree.sh all assert that they are being passed the
correct number of arguments. In cases where we accept a variable number
of arguments we assert this via a single call to `test` with `-o`, which
is discouraged by our coding guidelines.

Convert these cases to stop doing so. This requires us to decompose
assertions of the style `assert test $# = 2 -o $# = 3` into two calls
because we have no easy way to logically chain statements passed to the
assert function.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: convert trivial usages of `test &lt;expr&gt; -a/-o &lt;expr&gt;`</title>
<updated>2023-11-11T00:21:00Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2023-11-10T10:01:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13420028e5b119d27277d521f4d267212c5ca21c'/>
<id>urn:sha1:13420028e5b119d27277d521f4d267212c5ca21c</id>
<content type='text'>
Our coding guidelines say to not use `test` with `-a` and `-o` because
it can easily lead to bugs. Convert trivial cases where we still use
these to instead instead concatenate multiple invocations of `test` via
`&amp;&amp;` and `||`, respectively.

While not all of the converted instances can cause ambiguity, it is
worth getting rid of all of them regardless:

    - It becomes easier to reason about the code as we do not have to
      argue why one use of `-a`/`-o` is okay while another one isn't.

    - We don't encourage people to use these expressions.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse-options: show negatability of options in short help</title>
<updated>2023-08-07T00:16:50Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2023-08-05T14:40:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e8e5d294dc6e3b6b32132cc8018d01ce35ad0af0'/>
<id>urn:sha1:e8e5d294dc6e3b6b32132cc8018d01ce35ad0af0</id>
<content type='text'>
Add a "[no-]" prefix to options without the flag PARSE_OPT_NONEG to
document the fact that you can negate them.

This looks a bit strange for options that already start with "no-", e.g.
for the option --no-name of git show-branch:

    --[no-]no-name        suppress naming strings

You can actually use --no-no-name as an alias of --name, so the short
help is not wrong.  If we strip off any of the "no-"s, we lose either
the ability to see if the remaining one belongs to the documented
variant or to see if it can be negated.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>subtree: disallow --no-{help,quiet,debug,branch,message}</title>
<updated>2023-08-07T00:16:49Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2023-08-05T14:37:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d716512870317692129b2b4d706a82b393ffbe6e'/>
<id>urn:sha1:d716512870317692129b2b4d706a82b393ffbe6e</id>
<content type='text'>
"git subtree" only handles the negated variant of the options annotate,
prefix, onto, rejoin, ignore-joins and squash explicitly.  help is
handled by "git rev-parse --parseopt" implicitly, but not its negated
form.  Disable negation for it and the for the rest of the options to
get a helpful error message when trying them.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>subtree: support long global flags</title>
<updated>2023-05-08T14:58:27Z</updated>
<author>
<name>Josh Soref</name>
<email>jsoref@gmail.com</email>
</author>
<published>2023-05-07T03:09:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b4de9239bfbc402738a5755d75a8b90a25c5cfdf'/>
<id>urn:sha1:b4de9239bfbc402738a5755d75a8b90a25c5cfdf</id>
<content type='text'>
The documentation at e75d1da38a claimed support, but it was never present

Signed-off-by: Josh Soref &lt;jsoref@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>test: don't print aggregate-results command</title>
<updated>2023-03-09T22:57:57Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2023-03-09T17:30:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=90ff7c9898f6dfd76aae39ad06b1d0e746a615b8'/>
<id>urn:sha1:90ff7c9898f6dfd76aae39ad06b1d0e746a615b8</id>
<content type='text'>
There's no value in it.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>test: simplify counts aggregation</title>
<updated>2023-03-09T22:57:55Z</updated>
<author>
<name>Felipe Contreras</name>
<email>felipe.contreras@gmail.com</email>
</author>
<published>2023-03-09T17:30:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d1d62e87540fd43bb16b123c9c73b022cc463e2'/>
<id>urn:sha1:5d1d62e87540fd43bb16b123c9c73b022cc463e2</id>
<content type='text'>
When the list of files as input was implemented in 6508eedf67
(t/aggregate-results: accomodate systems with small max argument list
length, 2010-06-01), a much simpler solution wasn't considered.

Let's just pass the directory as an argument.

Signed-off-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
