[PATCH 08/10] merge-recursive.c: remove implicit dependency on the_repository

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- merge-recursive.c | 45 - 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/merge-recursive.c b/merge-recursive.c index 28f44c73ec..a596d95739 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @

[PATCH 10/10] cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch

2019-01-04 Thread Nguyễn Thái Ngọc Duy
>From now on, by default index compat macros are off because they could hide the_index dependency. Only those in builtin can use it (and even so should be avoided if possible). Signed-off-by: Nguyễn Thái Ngọc Duy --- attr.c | 1 - builtin/add.c

[PATCH 09/10] read-cache.c: remove the_* from index_has_changes()

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/am.c | 6 +++--- cache.h | 6 +++--- merge-recursive.c | 2 +- read-cache.c | 12 +--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index 611712dc95..a9ffc92eaa 100644 --

[PATCH 07/10] merge-recursive.c: remove implicit dependency on the_index

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/am.c | 2 +- builtin/checkout.c| 2 +- builtin/merge-recursive.c | 2 +- builtin/merge.c | 2 +- merge-recursive.c | 148 -- merge-recursive.h | 6 +- seque

[PATCH 01/10] notes-utils.c: remove the_repository references

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/am.c | 2 +- builtin/commit.c | 2 +- builtin/notes.c | 21 + notes-merge.c| 4 ++-- notes-utils.c| 17 ++--- notes-utils.h| 11 --- sequencer.c | 7 --- sequencer.h | 3 ++-

[PATCH 06/10] sha1-name.c: remove implicit dependency on the_index

2019-01-04 Thread Nguyễn Thái Ngọc Duy
This kills the_index dependency in get_oid_with_context() but for get_oid() and friends, they still assume the_repository (which also means the_index). Unfortunately the widespread use of get_oid() will make it hard to make the conversion now. We probably will add repo_get_oid() at some point and

[PATCH 02/10] repository.c: replace hold_locked_index() with repo_hold_locked_index()

2019-01-04 Thread Nguyễn Thái Ngọc Duy
hold_locked_index() assumes the index path at $GIT_DIR/index. This is not good for places that take an arbitrary index_state instead of the_index, which is basically everywhere except builtin/. Replace it with repo_hold_locked_index(). hold_locked_index() remains as a wrapper around repo_hold_lock

git@vger.kernel.org

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/commit.c | 2 +- builtin/describe.c | 2 +- builtin/diff.c | 2 +- builtin/rebase.c | 5 ++--- cache.h| 6 -- read-cache.c | 14 -- repository.h | 6 ++ wt-status.c| 2 +- 8 files ch

[PATCH 03/10] checkout: avoid the_index when possible

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/checkout.c b/builtin/checkout.c index 08b0ac48f3..1b672a9fd9 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -284,7 +284,7 @@ static int checkout_path

[PATCH 04/10] read-cache.c: kill read_index()

2019-01-04 Thread Nguyễn Thái Ngọc Duy
read_index() shares the same problem as hold_locked_index(): it assumes $GIT_DIR/index. Move all call sites to repo_read_index() instead. read_index_preload() and read_index_unmerged() are also killed as a consequence. Signed-off-by: Nguyễn Thái Ngọc Duy --- apply.c | 2 +- blame.c

[PATCH 00/10] Remove the_index, the final part

2019-01-04 Thread Nguyễn Thái Ngọc Duy
This completely removes the_index outside builtin/. The macro NO_THE_INDEX_COMPATIBILITY_MACROS is replaced with USE_THE_INDEX_COMPATIBILITY_MACROS, which means by default you don't have access to the_index any more. And USE_THE_... should only be defined in builtin/ There's one easy conflict in b

[PATCH v3] worktree: allow to (re)move worktrees with uninitialized submodules

2019-01-04 Thread Nguyễn Thái Ngọc Duy
Uninitialized submodules have nothing valueable for us to be worried about. They are just SHA-1. Let "worktree remove" and "worktree move" continue in this case so that people can still use multiple worktrees on repos with optional submodules that are never populated, like sha1collisiondetection in

Re: How DELTA objects values work and are calculated

2019-01-04 Thread Duy Nguyen
On Sat, Jan 5, 2019 at 9:49 AM Farhan Khan wrote: > > Hi all, > > I'm having trouble understanding how OBJ_REF_DELTA and OBJ_REF_DELTA > (deltas) work in git. Where does git calculate the sha1 hash values > when doing "git index-pack" in builtin/index-pack.c. I think my lack > of understanding of

How DELTA objects values work and are calculated

2019-01-04 Thread Farhan Khan
Hi all, I'm having trouble understanding how OBJ_REF_DELTA and OBJ_REF_DELTA (deltas) work in git. Where does git calculate the sha1 hash values when doing "git index-pack" in builtin/index-pack.c. I think my lack of understanding of the code is compounded the fact that I do not understand what th

[PATCH v4 7/8] test-lib-functions: introduce the 'test_set_port' helper function

2019-01-04 Thread SZEDER Gábor
Several test scripts run daemons like 'git-daemon' or Apache, and communicate with them through TCP sockets. To have unique ports where these daemons are accessible, the ports are usually the number of the corresponding test scripts, unless the user overrides them via environment variables, and th

[PATCH v4 5/8] test-lib: consolidate naming of test-results paths

2019-01-04 Thread SZEDER Gábor
There are two places where we strip off any leading path components and the '.sh' suffix from the test script's pathname, and there are four places where we construct the name of the 't/test-results' directory or the name of various test-specific files in there. The last patch in this series will

[PATCH v4 3/8] test-lib: parse options in a for loop to keep $@ intact

2019-01-04 Thread SZEDER Gábor
'test-lib.sh' looks for the presence of certain options like '--tee' and '--verbose-log', so it can execute the test script again to save its standard output and error, and to do so it needs the original command line options the test was invoked with. The next patch is about to move the option par

[PATCH v4 8/8] test-lib: add the '--stress' option to run a test repeatedly under load

2019-01-04 Thread SZEDER Gábor
Unfortunately, we have a few flaky tests, whose failures tend to be hard to reproduce. We've found that the best we can do to reproduce such a failure is to run the test script repeatedly while the machine is under load, and wait in the hope that the load creates enough variance in the timing of t

[PATCH v4 4/8] test-lib: parse command line options earlier

2019-01-04 Thread SZEDER Gábor
'test-lib.sh' looks for the presence of certain options like '--tee' and '--verbose-log', so it can execute the test script again to save its standard output and error. It looks for '--valgrind' as well, to set up some Valgrind-specific stuff. These all happen before the actual option parsing loo

[PATCH v4 6/8] test-lib: set $TRASH_DIRECTORY earlier

2019-01-04 Thread SZEDER Gábor
A later patch in this series will need to know the path to the trash directory early in 'test-lib.sh', but $TRASH_DIRECTORY is set much later. Set $TRASH_DIRECTORY earlier, where the other test-specific path variables are set. Signed-off-by: SZEDER Gábor --- t/test-lib.sh | 12 ++-- 1 f

[PATCH v4 2/8] test-lib: extract Bash version check for '-x' tracing

2019-01-04 Thread SZEDER Gábor
One of our test scripts, 't1510-repo-setup.sh' [1], still can't be reliably run with '-x' tracing enabled, unless it's executed with a Bash version supporting BASH_XTRACEFD (since v4.1). We have a lengthy condition to check the version of the shell running the test script, and disable tracing if i

[PATCH v4 1/8] test-lib: translate SIGTERM and SIGHUP to an exit

2019-01-04 Thread SZEDER Gábor
Right now if a test script receives SIGTERM or SIGHUP (e.g., because a test was hanging and the user 'kill'-ed it or simply closed the terminal window the test was running in), the shell exits immediately. This can be annoying if the test script did any global setup, like starting apache or git-dae

[PATCH v4 0/8] test-lib: add the '--stress' option to help reproduce occasional failures in flaky tests

2019-01-04 Thread SZEDER Gábor
To recap: this patch series tries to make reproducing rare failures in flaky tests easier: it adds the '--stress' option to our test library to run the test script repeatedly in multiple parallel jobs, in the hope that the increased load creates enough variance in the timing of the test's commands

Re: [PATCH 4/4] built-in rebase: call `git am` directly

2019-01-04 Thread Junio C Hamano
"Johannes Schindelin via GitGitGadget" writes: > While the scripted `git rebase` still has to rely on the > `git-rebase--am.sh` script to implement the glue between the `rebase` > and the `am` commands, we can go a more direct route in the built-in > rebase and avoid using a shell script altogeth

Re: [PATCH v2] worktree: allow to (re)move worktrees with uninitialized submodules

2019-01-04 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > Uninitialized submodules have nothing valueable for us to be worried > about. They are just SHA-1. Let "worktree remove" and "worktree move" > continue in this case so that people can still use multiple worktrees > on repos with optional submodules that are never p

Re: [PATCH 1/1] Add optional targets for documentation l10n

2019-01-04 Thread Junio C Hamano
Jean-Noël Avila writes: > From: Jean-Noel Avila > > The standard doc lists can be filtered to allow using the compilation > rules with translated manpages where all the pages of the original > version may not be present. > > The install variable are reused in the secondary repo so that the > con

Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-04 Thread Junio C Hamano
Jeff King writes: > The most robust thing would perhaps be: > > fflush(dest->file); > ftruncate(fileno(dest->file), 0); > > which leaves the handle intact. An added benefit of that approach is that there is no need for the filename field in the dest structure. Having a separate filename fie

Re: [PATCH v2] test-lib: check Bash version for '-x' without using shell arrays

2019-01-04 Thread Junio C Hamano
Carlo Arenas writes: > v2 works fine, as expected Thanks.

Re: [PATCH] diff: add support for reading files literally with --no-index

2019-01-04 Thread Junio C Hamano
"brian m. carlson" writes: >> - --dereference to control whether to follow symlinks > > This is actually surprisingly difficult. The reason I implemented this > only for no-index mode is because there are actually several places we > can stat a file in the diff code, and implementing a --derefer

Re: [PATCH v2] test-lib: check Bash version for '-x' without using shell arrays

2019-01-04 Thread Carlo Arenas
v2 works fine, as expected Carlo

Re: [PATCH 3/4] rebase: teach `reset_head()` to optionally skip the worktree

2019-01-04 Thread Junio C Hamano
Junio C Hamano writes: > "Johannes Schindelin via GitGitGadget" > writes: > >> From: Johannes Schindelin >> >> This is what the legacy (scripted) rebase does in >> `move_to_original_branch`, and we will need this functionality in the >> next commit. > > The move-to-original-branch helper does:

Re: [PATCH 1/4] rebase: move `reset_head()` into a better spot

2019-01-04 Thread Junio C Hamano
"Johannes Schindelin via GitGitGadget" writes: > From: Johannes Schindelin > > Over the next commits, we want to make use of it in `run_am()` (i.e. > running the `--am` backend directly, without detouring to Unix shell > script code) which in turn will be called from `run_specific_rebase()`. > >

Re: [PATCH 2/4] rebase: avoid double reflog entry when switching branches

2019-01-04 Thread Junio C Hamano
"Johannes Schindelin via GitGitGadget" writes: > From: Johannes Schindelin > > When switching a branch *and* updating said branch to a different > revision, let's avoid a double entry by first updating the branch and > then adjusting the symbolic ref HEAD. Ah, in the original sequence, HEAD is

Re: [PATCH 3/4] rebase: teach `reset_head()` to optionally skip the worktree

2019-01-04 Thread Junio C Hamano
"Johannes Schindelin via GitGitGadget" writes: > From: Johannes Schindelin > > This is what the legacy (scripted) rebase does in > `move_to_original_branch`, and we will need this functionality in the > next commit. The move-to-original-branch helper does: - point $head_name to the commit

Re: [PATCH 4/4] built-in rebase: call `git am` directly

2019-01-04 Thread Junio C Hamano
"Johannes Schindelin via GitGitGadget" writes: > +static int write_basic_state(struct rebase_options *opts) > +{ > + write_file(state_dir_path("head-name", opts), "%s", > +opts->head_name ? opts->head_name : "detached HEAD"); > + write_file(state_dir_path("onto", opts), "%

[PATCH 1/1] Add optional targets for documentation l10n

2019-01-04 Thread Jean-Noël Avila
From: Jean-Noel Avila The standard doc lists can be filtered to allow using the compilation rules with translated manpages where all the pages of the original version may not be present. The install variable are reused in the secondary repo so that the configured paths can be used for translated

[PATCH 0/1] i18n: add framework for localizing the manpages

2019-01-04 Thread Jean-Noël Avila
Hi all, This is a second attempt at providing localized manpages of git in a central way. The first attempt[1] was to include all the changes directly in the main repo. But as Junio made me realize, staying in the main repo would have many drawbacks such as forcing possible translators to follo

Re: [PATCH 1/3] Add 'human' date format

2019-01-04 Thread Stephen P Smith
On Friday, January 4, 2019 12:50:35 AM MST Jeff King wrote: > On Thu, Jan 03, 2019 at 06:19:56AM -0700, Stephen P. Smith wrote: > > > > I didn't see anything in the code which would prohibit setting something > > like that. > > Yeah, I don't think supporting that is too hard. I was thinking > som

Re: [PATCH v2] test-lib: check Bash version for '-x' without using shell arrays

2019-01-04 Thread SZEDER Gábor
On Fri, Jan 04, 2019 at 03:25:57AM -0800, Junio C Hamano wrote: > SZEDER Gábor writes: > > > On Thu, Jan 03, 2019 at 12:29:35PM -0800, Junio C Hamano wrote: > >> Let's treat this as an independent and more urgent fix-up. I think > >> it is sufficient to apply it to 2.20.x track, even though we c

Re: [PATCH v2] test-lib: check Bash version for '-x' without using shell arrays

2019-01-04 Thread Junio C Hamano
SZEDER Gábor writes: > On Thu, Jan 03, 2019 at 12:29:35PM -0800, Junio C Hamano wrote: >> Let's treat this as an independent and more urgent fix-up. I think >> it is sufficient to apply it to 2.20.x track, even though we could >> go back to 2.17.x and above. >> >> And then let's tentatively kic

Re: [PATCH v2 2/2] Unset CURLOPT_FAILONERROR

2019-01-04 Thread Jeff King
On Sat, Dec 29, 2018 at 11:44:47AM -0800, Masaya Suzuki wrote: > When GIT_CURL_VERBOSE is set, libcurl produces request/response headers > to stderr. However, if the response is an error response and > CURLOPT_FAILONERROR is set, libcurl stops parsing the response, and it > won't dump the headers.

Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-04 Thread Jeff King
On Sat, Dec 29, 2018 at 11:44:46AM -0800, Masaya Suzuki wrote: > +/* > + * A callback for CURLOPT_WRITEFUNCTION. The return value is the bytes > consumed > + * from ptr. > + */ > static size_t rpc_in(char *ptr, size_t eltsize, > size_t nmemb, void *buffer_) > { > size_t size

Re: [PATCH v2 1/2] Change how HTTP response body is returned

2019-01-04 Thread Jeff King
On Thu, Jan 03, 2019 at 11:09:02AM -0800, Junio C Hamano wrote: > > + if (dest->file) { > > + /* > > +* At this point, the file contains the response body of the > > +* previous request. We need to truncate the file. > > +*/ > > + FILE *new

Re: [PATCH v2] test-lib: check Bash version for '-x' without using shell arrays

2019-01-04 Thread SZEDER Gábor
On Thu, Jan 03, 2019 at 12:29:35PM -0800, Junio C Hamano wrote: > Let's treat this as an independent and more urgent fix-up. I think > it is sufficient to apply it to 2.20.x track, even though we could > go back to 2.17.x and above. > > And then let's tentatively kick the "stress test" series out

Re: git clone on page 44 of progit-en.1084.pdf (2nd try)

2019-01-04 Thread Jeff King
On Thu, Jan 03, 2019 at 04:43:32PM -0800, Charles Kerr wrote: > I am an easily-derailed newbie reading chapter 2 of progit-en.1084.pdf Sort of orthogonal to your question, but I think this is a slightly older version of the book. Note that it's constantly undergoing revisions, and the latest ver

Re: [PATCH v3] Simplify handling of setup_git_directory_gently() failure cases.

2019-01-04 Thread Jeff King
On Thu, Jan 03, 2019 at 10:09:18AM -0800, Junio C Hamano wrote: > >> @@ -1132,7 +1142,10 @@ const char *setup_git_directory_gently(int > >> *nongit_ok) > >> * the user has set GIT_DIR. It may be beneficial to disallow bogus > >> * GIT_DIR values at some point in the future. > >> */ >