<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/commit.c, branch v2.34.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.34.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.34.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-09-27T16:44:54Z</updated>
<entry>
<title>hook.c users: use "hook_exists()" instead of "find_hook()"</title>
<updated>2021-09-27T16:44:54Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-09-26T19:03:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=07a348e7461afe9411004a0501034cb3ff1cdee8'/>
<id>urn:sha1:07a348e7461afe9411004a0501034cb3ff1cdee8</id>
<content type='text'>
Use the new hook_exists() function instead of find_hook() where the
latter was called in boolean contexts. This make subsequent changes in
a series where we further refactor the hook API clearer, as we won't
conflate wanting to get the path of the hook with checking for its
existence.

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>hook.[ch]: move find_hook() from run-command.c to hook.c</title>
<updated>2021-09-27T16:44:54Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-09-26T19:03:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5e3aba33da26803e48b0099c9dabfd327f7f8b8b'/>
<id>urn:sha1:5e3aba33da26803e48b0099c9dabfd327f7f8b8b</id>
<content type='text'>
Move the find_hook() function from run-command.c to a new hook.c
library. This change establishes a stub library that's pretty
pointless right now, but will see much wider use with Emily Shaffer's
upcoming "configuration-based hooks" series.

Eventually all the hook related code will live in hook.[ch]. Let's
start that process by moving the simple find_hook() function over
as-is.

Signed-off-by: Emily Shaffer &lt;emilyshaffer@google.com&gt;
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>Merge branch 'ab/retire-advice-config'</title>
<updated>2021-09-10T18:46:29Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-09-10T18:46:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd0d7036e0da248f354e91fb8be8771fb20adfac'/>
<id>urn:sha1:fd0d7036e0da248f354e91fb8be8771fb20adfac</id>
<content type='text'>
Code clean up to migrate callers from older advice_config[] based
API to newer advice_if_enabled() and advice_enabled() API.

* ab/retire-advice-config:
  advice: move advice.graftFileDeprecated squashing to commit.[ch]
  advice: remove use of global advice_add_embedded_repo
  advice: remove read uses of most global `advice_` variables
  advice: add enum variants for missing advice variables
</content>
</entry>
<entry>
<title>advice: remove read uses of most global `advice_` variables</title>
<updated>2021-08-25T19:07:52Z</updated>
<author>
<name>Ben Boeckel</name>
<email>mathstuf@gmail.com</email>
</author>
<published>2021-08-23T10:44:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ed9bff0817d5a7500b50a39c1c35b44aa3e72578'/>
<id>urn:sha1:ed9bff0817d5a7500b50a39c1c35b44aa3e72578</id>
<content type='text'>
In c4a09cc9ccb (Merge branch 'hw/advise-ng', 2020-03-25), a new API for
accessing advice variables was introduced and deprecated `advice_config`
in favor of a new array, `advice_setting`.

This patch ports all but two uses which read the status of the global
`advice_` variables over to the new `advice_enabled` API. We'll deal
with advice_add_embedded_repo and advice_graft_file_deprecated
separately.

Signed-off-by: Ben Boeckel &lt;mathstuf@gmail.com&gt;
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>commit: restore --edit when combined with --fixup</title>
<updated>2021-08-15T16:44:08Z</updated>
<author>
<name>Joel Klinghed</name>
<email>the_jk@spawned.biz</email>
</author>
<published>2021-08-14T21:40:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8ef6aad664715c16caf6e36a7f6b174a06574477'/>
<id>urn:sha1:8ef6aad664715c16caf6e36a7f6b174a06574477</id>
<content type='text'>
Recent changes to --fixup, adding amend suboption, caused the
--edit flag to be ignored as use_editor was always set to zero.

Restore edit_flag having higher priority than fixup_message when
deciding the value of use_editor by moving the edit flag condition
later in the method.

Signed-off-by: Joel Klinghed &lt;the_jk@spawned.biz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ds/commit-and-checkout-with-sparse-index'</title>
<updated>2021-08-04T20:28:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-08-04T20:28:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=506d2a354a9b24c531634094292b11ed8b8c2514'/>
<id>urn:sha1:506d2a354a9b24c531634094292b11ed8b8c2514</id>
<content type='text'>
"git checkout" and "git commit" learn to work without unnecessarily
expanding sparse indexes.

* ds/commit-and-checkout-with-sparse-index:
  unpack-trees: resolve sparse-directory/file conflicts
  t1092: document bad 'git checkout' behavior
  checkout: stop expanding sparse indexes
  sparse-index: recompute cache-tree
  commit: integrate with sparse-index
  p2000: compress repo names
  p2000: add 'git checkout -' test and decrease depth
</content>
</entry>
<entry>
<title>Merge branch 'ds/status-with-sparse-index'</title>
<updated>2021-07-28T20:18:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-07-28T20:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b271a3034fc54a7c84ae5803d72f14a29b172c78'/>
<id>urn:sha1:b271a3034fc54a7c84ae5803d72f14a29b172c78</id>
<content type='text'>
"git status" codepath learned to work with sparsely populated index
without hydrating it fully.

* ds/status-with-sparse-index:
  t1092: document bad sparse-checkout behavior
  fsmonitor: integrate with sparse index
  wt-status: expand added sparse directory entries
  status: use sparse-index throughout
  status: skip sparse-checkout percentage with sparse-index
  diff-lib: handle index diffs with sparse dirs
  dir.c: accept a directory as part of cone-mode patterns
  unpack-trees: unpack sparse directory entries
  unpack-trees: rename unpack_nondirectories()
  unpack-trees: compare sparse directories correctly
  unpack-trees: preserve cache_bottom
  t1092: add tests for status/add and sparse files
  t1092: expand repository data shape
  t1092: replace incorrect 'echo' with 'cat'
  sparse-index: include EXTENDED flag when expanding
  sparse-index: skip indexes with unmerged entries
</content>
</entry>
<entry>
<title>commit: integrate with sparse-index</title>
<updated>2021-07-14T22:05:53Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2021-06-29T02:13:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=daa1acefc55bb6492c00519634e0a7622b3b6d69'/>
<id>urn:sha1:daa1acefc55bb6492c00519634e0a7622b3b6d69</id>
<content type='text'>
Update 'git commit' to allow using the sparse-index in memory without
expanding to a full one. The only place that had an ensure_full_index()
call was in cache_tree_update(). The recursive algorithm for
update_one() was already updated in 2de37c536 (cache-tree: integrate
with sparse directory entries, 2021-03-03) to handle sparse directory
entries in the index.

Most of this change involves testing different command-line options that
allow specifying which on-disk changes should be included in the commit.
This includes no options (only take currently-staged changes), -a (take
all tracked changes), and --include (take a list of specific changes).
To simplify testing that these options do not expand the index, update
the test that previously verified that 'git status' does not expand the
index with a helper method, ensure_not_expanded().

This allows 'git commit' to operate much faster when the sparse-checkout
cone is much smaller than the full list of files at HEAD.

Here are the relevant lines from p2000-sparse-operations.sh:

Test                                      HEAD~1           HEAD
----------------------------------------------------------------------------------
2000.14: git commit -a -m A (full-v3)     0.35(0.26+0.06)  0.36(0.28+0.07) +2.9%
2000.15: git commit -a -m A (full-v4)     0.32(0.26+0.05)  0.34(0.28+0.06) +6.3%
2000.16: git commit -a -m A (sparse-v3)   0.63(0.59+0.06)  0.04(0.05+0.05) -93.7%
2000.17: git commit -a -m A (sparse-v4)   0.64(0.59+0.08)  0.04(0.04+0.04) -93.8%

It is important to compare the full-index case to the sparse-index case,
so the improvement for index version v4 is actually an 88% improvement in
this synthetic example.

In a real repository with over two million files at HEAD and 60,000
files in the sparse-checkout definition, the time for 'git commit -a'
went from 2.61 seconds to 134ms. I compared this to the result if the
index only contained the paths in the sparse-checkout definition and
found the theoretical optimum to be 120ms, so the out-of-cone paths only
add a 12% overhead.

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>status: use sparse-index throughout</title>
<updated>2021-07-14T20:42:49Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2021-07-14T13:12:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d76723ee5313d0176e8777af4aa104d7562543c1'/>
<id>urn:sha1:d76723ee5313d0176e8777af4aa104d7562543c1</id>
<content type='text'>
By testing 'git -c core.fsmonitor= status -uno', we can check for the
simplest index operations that can be made sparse-aware. The necessary
implementation details are already integrated with sparse-checkout, so
modify command_requires_full_index to be zero for cmd_status().

In refresh_index(), we loop through the index entries to refresh their
stat() information. However, sparse directories have no stat()
information to populate. Ignore these entries.

This allows 'git status' to no longer expand a sparse index to a full
one. This is further tested by dropping the "-uno" option and adding an
untracked file into the worktree.

The performance test p2000-sparse-checkout-operations.sh demonstrates
these improvements:

Test                                  HEAD~1           HEAD
-----------------------------------------------------------------------------
2000.2: git status (full-index-v3)    0.31(0.30+0.05)  0.31(0.29+0.06) +0.0%
2000.3: git status (full-index-v4)    0.31(0.29+0.07)  0.34(0.30+0.08) +9.7%
2000.4: git status (sparse-index-v3)  2.35(2.28+0.10)  0.04(0.04+0.05) -98.3%
2000.5: git status (sparse-index-v4)  2.35(2.24+0.15)  0.05(0.04+0.06) -97.9%

Note that since HEAD~1 was expanding the sparse index by parsing trees,
it was artificially slower than the full index case. Thus, the 98%
improvement is misleading, and instead we should celebrate the 0.34s to
0.05s improvement of 85%. This is more indicative of the peformance
gains we are expecting by using a sparse index.

Note: we are dropping the assignment of core.fsmonitor here. This is not
necessary for the test script as we are not altering the config any
other way. Correct integration with FS Monitor will be validated in
later changes.

Reviewed-by: Elijah Newren &lt;newren@gmail.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>commit: remove irrelavent prompt on `--allow-empty-message`</title>
<updated>2021-07-09T19:08:18Z</updated>
<author>
<name>Hu Jialun</name>
<email>hujialun@comp.nus.edu.sg</email>
</author>
<published>2021-07-09T18:07:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f70f00b4f94c036767cbe0f4cd23db573a4e8ba'/>
<id>urn:sha1:6f70f00b4f94c036767cbe0f4cd23db573a4e8ba</id>
<content type='text'>
Even when the `--allow-empty-message` option is given, "git commit"
offers an interactive editor session with prefilled message that says
the commit will be aborted if the buffer is emptied, which is wrong.

Remove the "an empty message aborts" part from the message when the
option is given to fix it.

Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Helped-by: Đoàn Trần Công Danh &lt;congdanhqx@gmail.com&gt;
Helped-by: Felipe Contreras &lt;felipe.contreras@gmail.com&gt;
Signed-off-by: Hu Jialun &lt;hujialun@comp.nus.edu.sg&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
