Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:36 +0000 (08:44 +0100)]
t/helper: merge test-date into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:35 +0000 (08:44 +0100)]
t/helper: merge test-ctype into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:34 +0000 (08:44 +0100)]
t/helper: merge test-config into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:33 +0000 (08:44 +0100)]
t/helper: merge test-lazy-init-name-hash into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:32 +0000 (08:44 +0100)]
t/helper: merge test-sha1 into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:31 +0000 (08:44 +0100)]
t/helper: merge test-chmtime into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 07:44:30 +0000 (08:44 +0100)]
t/helper: add an empty test-tool program
This will become an umbrella program that absorbs most [1] t/helper
programs in. By having a single executable binary we reduce disk usage
(libgit.a is replicated by every t/helper program) and shorten link
time a bit.
Running "make --jobs=1; du -sh t/helper" with ccache fully populated,
it takes 27 seconds and 277MB at the beginning of this series, 17
seconds and 42MB at the end.
[1] There are a couple programs that will not become part of
test-tool: test-line-buffer and test-svn-fe have extra
dependencies and test-fake-ssh's program name has to be a single
word for some ssh tests.
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:55 +0000 (19:20 +0000)]
t2107: abstract away SHA-1-specific constants
Use the $EMPTY_BLOB variable instead of hard-coding a hash.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:54 +0000 (19:20 +0000)]
t2101: abstract away SHA-1-specific constants
Adjust the test so that it uses variables and command substitution for
blobs instead of hard-coded hashes.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:53 +0000 (19:20 +0000)]
t2101: modernize test style
Most of our tests start with the opening quote of the test body on the
same line as the test_expect_success call. Additionally, our tests are
usually indented with a single tab. Update this test to be the same as
most others, which will make it easier to use inline heredocs in the
future.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:52 +0000 (19:20 +0000)]
t2020: abstract away SHA-1 specific constants
Adjust the test so that it uses variables for the revisions we're
checking out instead of hard-coded hashes.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:51 +0000 (19:20 +0000)]
t1507: abstract away SHA-1-specific constants
Adjust the test so that it uses a variable consisting of the current
HEAD instead of a hard-coded hash.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:50 +0000 (19:20 +0000)]
t1411: abstract away SHA-1-specific constants
Adjust the test so that it uses a variable consisting of the current
HEAD instead of a hard-coded hash.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:49 +0000 (19:20 +0000)]
t1405: sort reflog entries in a hash-independent way
The test enumerates reflog entries in an arbitrary order and then sorts
them. For SHA-1, this produces results that happen to sort in
alphabetical order, but for other hash algorithms they sort differently.
Ensure we sort the reflog entries in a hash-independent way by sorting
on the ref name instead of the object ID. Remove an assumption about
the length of a hash by using cut with the delimiter and field options
instead of the character range option.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:48 +0000 (19:20 +0000)]
t1300: abstract away SHA-1-specific constants
Adjust the test so that it uses the computed blob value instead of
hard-coding a hash.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:47 +0000 (19:20 +0000)]
t1304: abstract away SHA-1-specific constants
Adjust the test so that it uses the $EMPTY_BLOB value instead of
hard-coding the hash.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
brian m. carlson [Sun, 25 Mar 2018 19:20:46 +0000 (19:20 +0000)]
t1011: abstract away SHA-1-specific constants
Adjust the test so that it computes the expected hash value dynamically
instead of relying on a hard-coded hash. Hoist some code earlier in the
test to make this possible.
Signed-off-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
Ævar Arnfjörð Bjarmason [Sun, 25 Mar 2018 20:46:53 +0000 (20:46 +0000)]
Remove contrib/examples/*
There were some side discussions at Git Merge this year about how we
should just update the README to tell users they can dig these up from
the history if the need them, do that.
Looking at the "git log" for this directory we get quite a bit more
patch churn than we should here, mainly from things fixing various
tree-wide issues.
There's also confusion on the list occasionally about how these should
be treated, "Re: [PATCH 1/4] stash: convert apply to
builtin" (<redacted>)
being the latest example of that.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Fri, 23 Mar 2018 17:45:27 +0000 (18:45 +0100)]
packfile: keep prepare_packed_git() private
The reason callers have to call this is to make sure either packed_git
or packed_git_mru pointers are initialized since we don't do that by
default. Sometimes it's hard to see this connection between where the
function is called and where packed_git pointer is used (sometimes in
separate functions).
Keep this dependency internal because now all access to packed_git and
packed_git_mru must go through get_xxx() wrappers.
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:26 +0000 (18:45 +0100)]
packfile: allow find_pack_entry to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:25 +0000 (18:45 +0100)]
packfile: add repository argument to find_pack_entry
While at it move the documentation to the header and mention which pack
files are searched.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:24 +0000 (18:45 +0100)]
packfile: allow reprepare_packed_git to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:23 +0000 (18:45 +0100)]
packfile: allow prepare_packed_git to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:22 +0000 (18:45 +0100)]
packfile: allow prepare_packed_git_one to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:21 +0000 (18:45 +0100)]
packfile: add repository argument to reprepare_packed_git
See previous patch for explanation.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:20 +0000 (18:45 +0100)]
packfile: add repository argument to prepare_packed_git
Add a repository argument to allow prepare_packed_git callers to be
more specific about which repository to handle. See commit "sha1_file:
add repository argument to link_alt_odb_entry" for an explanation of
the #define trick.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:19 +0000 (18:45 +0100)]
packfile: add repository argument to prepare_packed_git_one
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:18 +0000 (18:45 +0100)]
packfile: allow install_packed_git to handle arbitrary repositories
This conversion was done without the #define trick used in the earlier
series refactoring to have better repository access, because this function
is easy to review, as it only has one caller and all lines but the first
two are converted.
We must not convert 'pack_open_fds' to be a repository specific variable,
as it is used to monitor resource usage of the machine that Git executes
on.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:17 +0000 (18:45 +0100)]
packfile: allow rearrange_packed_git to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:45:16 +0000 (18:45 +0100)]
packfile: allow prepare_packed_git_mru to handle arbitrary repositories
This conversion was done without the #define trick used in the earlier
series refactoring to have better repository access, because this function
is easy to review, as all lines are converted and it has only one caller
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Jonathan Nieder [Fri, 23 Mar 2018 17:21:21 +0000 (18:21 +0100)]
sha1_file: allow sha1_loose_object_info to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:20 +0000 (18:21 +0100)]
sha1_file: allow map_sha1_file to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Jonathan Nieder [Fri, 23 Mar 2018 17:21:19 +0000 (18:21 +0100)]
sha1_file: allow map_sha1_file_1 to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:18 +0000 (18:21 +0100)]
sha1_file: allow open_sha1_file to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:17 +0000 (18:21 +0100)]
sha1_file: allow stat_sha1_file to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:16 +0000 (18:21 +0100)]
sha1_file: allow sha1_file_name to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:15 +0000 (18:21 +0100)]
sha1_file: add repository argument to sha1_loose_object_info
Add a repository argument to allow the sha1_loose_object_info caller
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:14 +0000 (18:21 +0100)]
sha1_file: add repository argument to map_sha1_file
Add a repository argument to allow map_sha1_file callers to be more
specific about which repository to handle. This is a small mechanical
change; it doesn't change the implementation to handle repositories
other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
While at it, move the declaration to object-store.h, where it should
be easier to find.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:13 +0000 (18:21 +0100)]
sha1_file: add repository argument to map_sha1_file_1
Add a repository argument to allow the map_sha1_file_1 caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:12 +0000 (18:21 +0100)]
sha1_file: add repository argument to open_sha1_file
Add a repository argument to allow the open_sha1_file caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:11 +0000 (18:21 +0100)]
sha1_file: add repository argument to stat_sha1_file
Add a repository argument to allow the stat_sha1_file caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:10 +0000 (18:21 +0100)]
sha1_file: add repository argument to sha1_file_name
Add a repository argument to allow sha1_file_name callers to be more
specific about which repository to handle. This is a small mechanical
change; it doesn't change the implementation to handle repositories
other than the_repository yet.
As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.
While at it, move the declaration to object-store.h, where it should
be easier to find.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:09 +0000 (18:21 +0100)]
sha1_file: allow prepare_alt_odb to handle arbitrary repositories
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:08 +0000 (18:21 +0100)]
sha1_file: allow link_alt_odb_entries to handle arbitrary repositories
Actually this also allows read_info_alternates and link_alt_odb_entry to
handle arbitrary repositories, but link_alt_odb_entries is the most
interesting function in this set of functions, hence the commit subject.
These functions span a strongly connected component in the function
graph, i.e. the recursive call chain might look like
-> link_alt_odb_entries
-> link_alt_odb_entry
-> read_info_alternates
-> link_alt_odb_entries
That is why we need to convert all these functions at the same time.
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:07 +0000 (18:21 +0100)]
sha1_file: add repository argument to prepare_alt_odb
See previous patch for explanation.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:06 +0000 (18:21 +0100)]
sha1_file: add repository argument to link_alt_odb_entries
See previous patch for explanation.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:05 +0000 (18:21 +0100)]
sha1_file: add repository argument to read_info_alternates
See previous patch for explanation.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:04 +0000 (18:21 +0100)]
sha1_file: add repository argument to link_alt_odb_entry
Add a repository argument to allow the link_alt_odb_entry caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.
Since the implementation does not yet work with other repositories,
use a wrapper macro to enforce that the caller passes in
the_repository as the first argument. It would be more appealing to
use BUILD_ASSERT_OR_ZERO to enforce this, but that doesn't work
because it requires a compile-time constant and common compilers like
gcc 4.8.4 do not consider "r == the_repository" a compile-time
constant.
This and the following three patches add repository arguments to
link_alt_odb_entry, read_info_alternates, link_alt_odb_entries
and prepare_alt_odb. Three out of the four functions are found
in a recursive call chain, calling each other, and one of them
accesses the repositories `objectdir` (which was migrated; it
was an obvious choice) and `ignore_env` (which we need to keep in
the repository struct for clarify); hence we will pass through the
repository unlike just the object store object + the ignore_env flag.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:03 +0000 (18:21 +0100)]
sha1_file: add raw_object_store argument to alt_odb_usable
Add a raw_object_store to alt_odb_usable to be more specific about which
repository to act on. The choice of the repository is delegated to its
only caller link_alt_odb_entry.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:02 +0000 (18:21 +0100)]
pack: move approximate object count to object store
The approximate_object_count() function maintains a rough count of
objects in a repository to estimate how long object name abbreviates
should be. Object names are scoped to a repository and the
appropriate length may differ by repository, so the object count
should not be global.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:01 +0000 (18:21 +0100)]
pack: move prepare_packed_git_run_once to object store
Each repository's object store can be initialized independently, so
they must not share a run_once variable.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:21:00 +0000 (18:21 +0100)]
object-store: close all packs upon clearing the object store
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:20:59 +0000 (18:20 +0100)]
object-store: move packed_git and packed_git_mru to object store
In a process with multiple repositories open, packfile accessors
should be associated to a single repository and not shared globally.
Move packed_git and packed_git_mru into the_repository and adjust
callers to reflect this.
[nd: while at there, wrap access to these two fields in get_packed_git()
and get_packed_git_mru(). This allows us to lazily initialize these
fields without caller doing that explicitly]
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
René Scharfe [Sun, 25 Mar 2018 16:31:48 +0000 (18:31 +0200)]
unpack-trees: release oid_array after use in check_updates()
Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
Yuki Kokubun [Sun, 25 Mar 2018 16:54:58 +0000 (16:54 +0000)]
filter-branch: fix errors caused by refs that point at non-committish
"git filter-branch -- --all" prints error messages when processing refs that
point at objects that are not committish. Such refs can be created by
"git replace" with trees or blobs. And also "git tag" with trees or blobs can
create such refs.
Filter these problematic refs out early, before they are seen by the logic to
see which refs have been modified and which have been left intact (which is
where the unwanted error messages come from), and warn that these refs are left
unwritten while doing so.
Signed-off-by: Yuki Kokubun <redacted>
Signed-off-by: Junio C Hamano <redacted>
René Scharfe [Sun, 25 Mar 2018 10:57:50 +0000 (12:57 +0200)]
run-command: use strbuf_addstr() for adding a string to a strbuf
Patch generated with Coccinelle and contrib/coccinelle/strbuf.cocci.
Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
René Scharfe [Sun, 25 Mar 2018 10:57:36 +0000 (12:57 +0200)]
bisect: use oid_to_hex() for converting object_id hashes to hex strings
Patch generated with Coccinelle and contrib/coccinelle/object_id.cocci.
Signed-off-by: Rene Scharfe <redacted>
Reviewed-by: brian m. carlson <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:25 +0000 (21:35 +0100)]
completion: use __gitcomp_builtin in _git_cherry
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:24 +0000 (21:35 +0100)]
completion: use __gitcomp_builtin in _git_ls_tree
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:23 +0000 (21:35 +0100)]
completion: delete option-only completion commands
The new function __git_complete_common can take over this job with
less code to maintain.
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:22 +0000 (21:35 +0100)]
completion: add --option completion for most builtin commands
Many builtin commands use parseopt which can expose the option list
via --git-completion-helper but do not have explicit support in
git-completion.bash. This patch detects those commands and uses
__gitcomp_builtin for option completion.
This does not pollute the command name completion though. "git <tab>"
will show you the same set as before. This only kicks in when you type
the correct command name.
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:21 +0000 (21:35 +0100)]
completion: factor out _git_xxx calling code
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:20 +0000 (21:35 +0100)]
completion: mention the oldest version we need to support
This is more of a note for git-completion.bash contributors, not
users. The bash version is from MacOS [1]. Most Linux distros should
be 4.x at this point.
[1] https://public-inbox.org/git/%3CCAPig+cQXT1ov4MjzSzqiLBzr4wN1XcP7aSxMP+_dhtWtYwhDAA@mail.gmail.com%3E/
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:19 +0000 (21:35 +0100)]
git.c: add hidden option --list-parseopt-builtins
This is another step to help automate git-completion.bash. This option
gives a list of all builtin commands that do use parse_options(),
which supports another hidden option --git-completion-helper. The
output is prepared for easy consumption by git-completion.bash and
separates items by spaces instead of \n
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:18 +0000 (21:35 +0100)]
git.c: move cmd_struct declaration up
In a later patch we need access to one of these command option
constants near the top of this file. Move this block up so we will be
able to access the command options.
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
René Scharfe [Sat, 24 Mar 2018 16:41:08 +0000 (17:41 +0100)]
sha1_name: use bsearch_pack() in unique_in_pack()
Replace the custom binary search in unique_in_pack() with a call to
bsearch_pack(). This reduces code duplication and makes use of the
fan-out table of packs.
Signed-off-by: Rene Scharfe <redacted>
Signed-off-by: Junio C Hamano <redacted>
Jiang Xin [Sun, 25 Mar 2018 13:24:02 +0000 (21:24 +0800)]
Merge branch 'fr_v2.17.0' of git://github.com/jnavila/git
* 'fr_v2.17.0' of git://github.com/jnavila/git:
l10n: fr.po: v2.17.0 no fuzzy
Wink Saville [Fri, 23 Mar 2018 21:25:29 +0000 (14:25 -0700)]
rebase: remove merges_option and a blank line
merges_option is unused in git_rebase__interactive and always empty in
git_rebase__interactive__preserve_merges so it can be removed.
Signed-off-by: Wink Saville <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 21:25:28 +0000 (14:25 -0700)]
rebase: remove unused code paths from git_rebase__interactive__preserve_merges
Since git_rebase__interactive__preserve_merges is now always called with
$preserve_merges = t we can remove the unused code paths.
Signed-off-by: Wink Saville <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 21:25:27 +0000 (14:25 -0700)]
rebase: remove unused code paths from git_rebase__interactive
Since git_rebase__interactive is now never called with
$preserve_merges = t we can remove those code paths.
Signed-off-by: Wink Saville <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 21:25:26 +0000 (14:25 -0700)]
rebase: add and use git_rebase__interactive__preserve_merges
At the moment it's an exact copy of git_rebase__interactive except
the name has changed.
Signed-off-by: Wink Saville <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 21:25:25 +0000 (14:25 -0700)]
rebase: extract functions out of git_rebase__interactive
The extracted functions are:
- initiate_action
- setup_reflog_action
- init_basic_state
- init_revisions_and_shortrevisions
- complete_action
Used by git_rebase__interactive
Signed-off-by: Wink Saville <redacted>
Helped-by: Junio C Hamano <redacted>
Helped-by: Johannes Schindelin <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 21:25:24 +0000 (14:25 -0700)]
rebase: reindent function git_rebase__interactive
Signed-off-by: Wink Saville <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 21:25:23 +0000 (14:25 -0700)]
rebase: update invocation of rebase dot-sourced scripts
Due to historical reasons, the backend scriptlets for "git rebase"
are structured a bit unusually. As originally designed,
dot-sourcing them from "git rebase" was sufficient to invoke the
specific backend.
However, it was later discovered that some shell implementations
(e.g. FreeBSD 9.x) misbehaved by continuing to execute statements
following a top-level "return" rather than returning control to
the next statement in "git rebase" after dot-sourcing the
scriptlet. To work around this shortcoming, the whole body of
git-rebase--$backend.sh was made into a shell function
git_rebase__$backend, and then the very last line of the scriptlet
called that function.
A more normal architecture is for a dot-sourced scriptlet merely
to define functions (thus acting as a function library), and for
those functions to be called by the script doing the dot-sourcing.
Migrate to this arrangement by moving the git_rebase__$backend
call from the end of a scriptlet into "git rebase" itself.
While at it, remove the large comment block from each scriptlet
explaining this historic anomaly since it serves no purpose under
the new normalized architecture in which a scriptlet is merely a
function library.
Signed-off-by: Wink Saville <redacted>
Helped-by: Junio C Hamano <redacted>
Helped-by: Eric Sunshine <redacted>
Signed-off-by: Junio C Hamano <redacted>
Jean-Noël Avila [Fri, 23 Mar 2018 22:03:37 +0000 (23:03 +0100)]
l10n: fr.po: v2.17.0 no fuzzy
Signed-off-by: Jean-Noël Avila <redacted>
Junio C Hamano [Fri, 23 Mar 2018 17:40:06 +0000 (10:40 -0700)]
t9902: disable test on the list of merge-strategies under GETTEXT_POISON
The code to learn the list of merge strategies from the output of
"git merge -s help" forces C locale, so that it can notice the
message shown to indicate where the list starts in the output.
However, GETTEXT_POISON build corrupts its output even when run in
the C locale, and we cannot expect this test to succeed.
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:20:58 +0000 (18:20 +0100)]
object-store: free alt_odb_list
Free the memory and reset alt_odb_{list, tail} to NULL.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:20:57 +0000 (18:20 +0100)]
object-store: move alt_odb_list and alt_odb_tail to object store
In a process with multiple repositories open, alternates should be
associated to a single repository and not shared globally. Move
alt_odb_list and alt_odb_tail into the_repository and adjust callers
to reflect this.
Now that the alternative object data base is per repository, we're
leaking its memory upon freeing a repository. The next patch plugs
this hole.
No functional change intended.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:20:56 +0000 (18:20 +0100)]
object-store: migrate alternates struct and functions from cache.h
Migrate the struct alternate_object_database and all its related
functions to the object store as these functions are easier found in
that header. The migration is just a verbatim copy, no need to
include the object store header at any C file, because cache.h includes
repository.h which in turn includes the object-store.h
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Stefan Beller [Fri, 23 Mar 2018 17:20:55 +0000 (18:20 +0100)]
repository: introduce raw object store field
The raw object store field will contain any objects needed for access
to objects in a given repository.
This patch introduces the raw object store and populates it with the
`objectdir`, which used to be part of the repository struct.
As the struct gains members, we'll also populate the function to clear
the memory for these members.
In a later step, we'll introduce a struct object_parser, that will
complement the object parsing in a repository struct: The raw object
parser is the layer that will provide access to raw object content,
while the higher level object parser code will parse raw objects and
keeps track of parenthood and other object relationships using 'struct
object'. For now only add the lower level to the repository struct.
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Nguyễn Thái Ngọc Duy [Fri, 23 Mar 2018 15:55:23 +0000 (16:55 +0100)]
repository.h: add comment and clarify repo_set_gitdir
The argument name "optional" may mislead the reader to think this
option could be NULL. But it can't be. While at there, document a bit
more about struct set_gitdir_args.
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
Wink Saville [Fri, 23 Mar 2018 04:39:52 +0000 (21:39 -0700)]
rebase-interactive: simplify pick_on_preserving_merges
Use compound if statement instead of nested if statements to
simplify pick_on_preserving_merges.
Signed-off-by: Wink Saville <redacted>
Acked-by: Johannes Schindelin <redacted>
Signed-off-by: Junio C Hamano <redacted>
Junio C Hamano [Thu, 22 Mar 2018 21:36:51 +0000 (14:36 -0700)]
Sync with Git 2.16.3
Junio C Hamano [Thu, 22 Mar 2018 21:24:45 +0000 (14:24 -0700)]
Git 2.16.3
Signed-off-by: Junio C Hamano <redacted>
Junio C Hamano [Thu, 22 Mar 2018 21:24:25 +0000 (14:24 -0700)]
Merge branch 'ms/non-ascii-ticks' into maint
Doc markup fix.
* ms/non-ascii-ticks:
Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes
Junio C Hamano [Thu, 22 Mar 2018 21:24:25 +0000 (14:24 -0700)]
Merge branch 'jk/cached-commit-buffer' into maint
Code clean-up.
* jk/cached-commit-buffer:
revision: drop --show-all option
commit: drop uses of get_cached_commit_buffer()
Junio C Hamano [Thu, 22 Mar 2018 21:24:25 +0000 (14:24 -0700)]
Merge branch 'sm/mv-dry-run-update' into maint
Code clean-up.
* sm/mv-dry-run-update:
mv: remove unneeded 'if (!show_only)'
t7001: add test case for --dry-run
Junio C Hamano [Thu, 22 Mar 2018 21:24:24 +0000 (14:24 -0700)]
Merge branch 'tg/worktree-create-tracking' into maint
Hotfix for a recent topic.
* tg/worktree-create-tracking:
git-worktree.txt: fix indentation of example and text of 'add' command
git-worktree.txt: fix missing ")" typo
Junio C Hamano [Thu, 22 Mar 2018 21:24:24 +0000 (14:24 -0700)]
Merge branch 'gs/test-unset-xdg-cache-home' into maint
Test update.
* gs/test-unset-xdg-cache-home:
test-lib.sh: unset XDG_CACHE_HOME
Junio C Hamano [Thu, 22 Mar 2018 21:24:23 +0000 (14:24 -0700)]
Merge branch 'sb/status-doc-fix' into maint
Docfix.
* sb/status-doc-fix:
Documentation/git-status: clarify status table for porcelain mode
Junio C Hamano [Thu, 22 Mar 2018 21:24:22 +0000 (14:24 -0700)]
Merge branch 'rd/typofix' into maint
Typofix.
* rd/typofix:
Correct mispellings of ".gitmodule" to ".gitmodules"
t/: correct obvious typo "detahced"
Junio C Hamano [Thu, 22 Mar 2018 21:24:21 +0000 (14:24 -0700)]
Merge branch 'bp/fsmonitor' into maint
Doc update for a recently added feature.
* bp/fsmonitor:
fsmonitor: update documentation to remove reference to invalid config settings
Junio C Hamano [Thu, 22 Mar 2018 21:24:21 +0000 (14:24 -0700)]
Merge branch 'bc/doc-interpret-trailers-grammofix' into maint
Docfix.
* bc/doc-interpret-trailers-grammofix:
docs/interpret-trailers: fix agreement error
Junio C Hamano [Thu, 22 Mar 2018 21:24:19 +0000 (14:24 -0700)]
Merge branch 'sg/doc-test-must-fail-args' into maint
Devdoc update.
* sg/doc-test-must-fail-args:
t: document 'test_must_fail ok=<signal-name>'
Junio C Hamano [Thu, 22 Mar 2018 21:24:19 +0000 (14:24 -0700)]
Merge branch 'rj/sparse-updates' into maint
Devtool update.
* rj/sparse-updates:
Makefile: suppress a sparse warning for pack-revindex.c
config.mak.uname: remove SPARSE_FLAGS setting for cygwin
Junio C Hamano [Thu, 22 Mar 2018 21:24:18 +0000 (14:24 -0700)]
Merge branch 'jk/gettext-poison' into maint
Test updates.
* jk/gettext-poison:
git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME
t0205: drop redundant test
Junio C Hamano [Thu, 22 Mar 2018 21:24:18 +0000 (14:24 -0700)]
Merge branch 'nd/ignore-glob-doc-update' into maint
Doc update.
* nd/ignore-glob-doc-update:
gitignore.txt: elaborate shell glob syntax
Junio C Hamano [Thu, 22 Mar 2018 21:24:17 +0000 (14:24 -0700)]
Merge branch 'rs/cocci-strbuf-addf-to-addstr' into maint
* rs/cocci-strbuf-addf-to-addstr:
cocci: simplify check for trivial format strings
Junio C Hamano [Thu, 22 Mar 2018 21:24:17 +0000 (14:24 -0700)]
Merge branch 'jc/worktree-add-short-help' into maint
Error message fix.
* jc/worktree-add-short-help:
worktree: say that "add" takes an arbitrary commit in short-help
Junio C Hamano [Thu, 22 Mar 2018 21:24:17 +0000 (14:24 -0700)]
Merge branch 'tz/doc-show-defaults-to-head' into maint
Doc update.
* tz/doc-show-defaults-to-head:
doc: mention 'git show' defaults to HEAD