From 2cd6e1d552e0f8d00c79821084f4b407a8b59f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Tue, 6 Oct 2020 22:08:18 +0700 Subject: [PATCH 01/17] t5534: split stdout and stderr redirection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On atomic pushing failure with GnuPG, we expect a very specific output in stdout due to `--porcelain` switch. On such failure, we also write down some helpful hint into stderr in order to help user understand what happens and how to continue from those failures. On a lot of system, those hint (in stderr) will be flushed first, then those messages in stdout will be flushed. In such systems, the current test code is fine as is. However, we don't have such guarantee, (at least) there're some real systems that writes those stream interleaved. On such systems, we may see the stderr stream written in the middle of stdout stream. Let's split those stream redirection. By splitting those stream, the output stream will contain exactly what we want to compare, thus, saving us a "sed" invocation. While we're at it, change the `test_i18ncmp` to `test_cmp` because we will never translate those messages (because of `--porcelain`). Signed-off-by: Đoàn Trần Công Danh Signed-off-by: Junio C Hamano --- t/t5534-push-signed.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/t/t5534-push-signed.sh b/t/t5534-push-signed.sh index 7e928aff66..af0385fb89 100755 --- a/t/t5534-push-signed.sh +++ b/t/t5534-push-signed.sh @@ -282,10 +282,9 @@ test_expect_success GPG 'failed atomic push does not execute GPG' ' EOF test_must_fail env PATH="$TRASH_DIRECTORY:$PATH" git push \ --signed --atomic --porcelain \ - dst noop ff noff >out 2>&1 && + dst noop ff noff >out 2>err && - test_i18ngrep ! "gpg failed to sign" out && - sed -n -e "/^To dst/,$ p" out >actual && + test_i18ngrep ! "gpg failed to sign" err && cat >expect <<-EOF && To dst = refs/heads/noop:refs/heads/noop [up to date] @@ -293,7 +292,7 @@ test_expect_success GPG 'failed atomic push does not execute GPG' ' ! refs/heads/noff:refs/heads/noff [rejected] (non-fast-forward) Done EOF - test_i18ncmp expect actual + test_cmp expect out ' test_done From 17c13069b47e64fb3fdd4de57f87b80943be1e4d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 7 Oct 2020 08:17:49 +0000 Subject: [PATCH 02/17] GitHub workflow: automatically follow minor updates of setup-msbuild It is the custom to follow minor updates of GitHub Actions automatically, by using the suffix `@v1`. Actions' maintainers will then update that `v1` ref to point to the newest. However, for `microsoft/setup-msbuild`, 889cacb6897 (ci: configure GitHub Actions for CI/PR, 2020-04-11) uses a very specific `@v1.0.0` suffix. In this instance, that is a problem: should `setup-msbuild` release a new version that intends to fix a critical bug, we won't know it, and we won't use it. Such a scenario is not theoretical. It is happening right now: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands Let's simplify our setup, allowing us to benefit from automatically using the newest v1.x. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fcfd138ff1..14ff94dcbe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -154,7 +154,7 @@ jobs: Expand-Archive compat.zip -DestinationPath . -Force Remove-Item compat.zip - name: add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.0 + uses: microsoft/setup-msbuild@v1 - name: copy dlls to root shell: powershell run: | From fcedb379fd1842cf943a05a331be862ad8d2d919 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Wed, 7 Oct 2020 01:31:59 -0700 Subject: [PATCH 03/17] compat/mingw.h: drop extern from function declaration In 554544276a (*.[ch]: remove extern from function declarations using spatch, 2019-04-29), `extern` on function declarations were declared to be redundant and thus removed from the codebase. An `extern` was accidentally reintroduced in 08809c09aa (mingw: add a helper function to attach GDB to the current process, 2020-02-13). Remove this spurious `extern`. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- compat/mingw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/mingw.h b/compat/mingw.h index e6fe810ba9..af8eddd73e 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -606,7 +606,7 @@ int main(int argc, const char **argv); * Call this function to open a new MinTTY (this assumes you are in Git for * Windows' SDK) with a GDB that attaches to the current process right away. */ -extern void open_in_gdb(void); +void open_in_gdb(void); /* * Used by Pthread API implementation for Windows From cea69151a4d4c0861a6dd5006267141b04ebbadb Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 7 Oct 2020 14:19:23 -0400 Subject: [PATCH 04/17] index-pack: restore "resolving deltas" progress meter Commit f08cbf60fe (index-pack: make quantum of work smaller, 2020-09-08) refactored the main loop in threaded_second_pass(), but also deleted the call to display_progress() at the top of the loop. This means that users typically see no progress at all during the delta resolution phase (and for large repositories, Git appears to hang). This looks like an accident that was unrelated to the intended change of that commit, since we continue to update nr_resolved_deltas in resolve_delta(). Let's restore the call to get that progress back. We'll also add a test that confirms we generate the expected progress. This isn't perfect, as it wouldn't catch a bug where progress was delayed to the end. That was probably possible to trigger when receiving a thin pack, because we'd eventually call display_progress() from fix_unresolved_deltas(), but only once after doing all the work. However, since our test case generates a complete pack, it reliably demonstrates this particular bug and its fix. And we can't do better without making the test racy. Signed-off-by: Jeff King Acked-by: Jonathan Tan Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 4 ++++ t/t5302-pack-index.sh | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 8da4031e72..0f05533902 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1028,6 +1028,10 @@ static void *threaded_second_pass(void *data) struct object_entry *child_obj; struct base_data *child; + counter_lock(); + display_progress(progress, nr_resolved_deltas); + counter_unlock(); + work_lock(); if (list_empty(&work_head)) { /* diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index c92e553a2f..7c9d687367 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -277,4 +277,11 @@ test_expect_success 'index-pack --fsck-objects also warns upon missing tagger in grep "^warning:.* expected .tagger. line" err ' +test_expect_success 'index-pack -v --stdin produces progress for both phases' ' + pack=$(git pack-objects --all pack err && + test_i18ngrep "Receiving objects" err && + test_i18ngrep "Resolving deltas" err +' + test_done From bebe1719470078b000950b0cca520d3e533996a9 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 7 Oct 2020 14:19:43 -0400 Subject: [PATCH 05/17] index-pack: drop type_cas mutex The type_cas lock lost all of its callers in f08cbf60fe (index-pack: make quantum of work smaller, 2020-09-08), so we can safely delete it. The compiler didn't alert us that the variable became unused, because we still call pthread_mutex_init() and pthread_mutex_destroy() on it. It's worth considering also whether that commit was in error to remove the use of the lock. Why don't we need it now, if we did before, as described in ab791dd138 (index-pack: fix race condition with duplicate bases, 2014-08-29)? I think the answer is that we now look at and assign the child_obj->real_type field in the main thread while holding the work_lock(). So we don't have to worry about racing with the worker threads. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 0f05533902..f8f1b48e56 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -159,10 +159,6 @@ static pthread_mutex_t deepest_delta_mutex; #define deepest_delta_lock() lock_mutex(&deepest_delta_mutex) #define deepest_delta_unlock() unlock_mutex(&deepest_delta_mutex) -static pthread_mutex_t type_cas_mutex; -#define type_cas_lock() lock_mutex(&type_cas_mutex) -#define type_cas_unlock() unlock_mutex(&type_cas_mutex) - static pthread_key_t key; static inline void lock_mutex(pthread_mutex_t *mutex) @@ -186,7 +182,6 @@ static void init_thread(void) init_recursive_mutex(&read_mutex); pthread_mutex_init(&counter_mutex, NULL); pthread_mutex_init(&work_mutex, NULL); - pthread_mutex_init(&type_cas_mutex, NULL); if (show_stat) pthread_mutex_init(&deepest_delta_mutex, NULL); pthread_key_create(&key, NULL); @@ -209,7 +204,6 @@ static void cleanup_thread(void) pthread_mutex_destroy(&read_mutex); pthread_mutex_destroy(&counter_mutex); pthread_mutex_destroy(&work_mutex); - pthread_mutex_destroy(&type_cas_mutex); if (show_stat) pthread_mutex_destroy(&deepest_delta_mutex); for (i = 0; i < nr_threads; i++) From ec6a8f9705cb61956f7fac61a4c0e27d9ae4bbd5 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Wed, 7 Oct 2020 13:16:58 -0700 Subject: [PATCH 06/17] index-pack: make get_base_data() comment clearer A comment mentions that we may free cached delta bases via find_unresolved_deltas(), but that function went away in f08cbf60fe (index-pack: make quantum of work smaller, 2020-09-08). Since we need to rewrite that comment anyway, make the entire comment clearer. Signed-off-by: Jonathan Tan Signed-off-by: Junio C Hamano --- builtin/index-pack.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/builtin/index-pack.c b/builtin/index-pack.c index f8f1b48e56..aee33ae6a8 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -888,18 +888,15 @@ static void sha1_object(const void *data, struct object_entry *obj_entry, } /* - * Walk from current node up - * to top parent if necessary to deflate the node. In normal - * situation, its parent node would be already deflated, so it just - * needs to apply delta. + * Ensure that this node has been reconstructed and return its contents. * - * In the worst case scenario, parent node is no longer deflated because - * we're running out of delta_base_cache_limit; we need to re-deflate - * parents, possibly up to the top base. - * - * All deflated objects here are subject to be freed if we exceed - * delta_base_cache_limit, just like in find_unresolved_deltas(), we - * just need to make sure the last node is not freed. + * In the typical and best case, this node would already be reconstructed + * (through the invocation to resolve_delta() in threaded_second_pass()) and it + * would not be pruned. However, if pruning of this node was necessary due to + * reaching delta_base_cache_limit, this function will find the closest + * ancestor with reconstructed data that has not been pruned (or if there is + * none, the ultimate base object), and reconstruct each node in the delta + * chain in order to generate the reconstructed data for this node. */ static void *get_base_data(struct base_data *c) { From 722fc374914d4f9b37d42a8eda603eecb790f64c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 7 Oct 2020 21:56:51 +0000 Subject: [PATCH 07/17] help: do not expect built-in commands to be hardlinked When building with SKIP_DASHED_BUILT_INS=YesPlease, the built-in commands are no longer present in the `PATH` as hardlinks to `git`. As a consequence, `load_command_list()` needs to be taught to find the names of the built-in commands from elsewhere. This only affected the output of `git --list-cmds=main`, but not the output of `git help -a` because the latter includes the built-in commands by virtue of them being listed in command-list.txt. The bug was detected via a patch series that turns the merge strategies included in Git into built-in commands: `git merge -s help` relies on `load_command_list()` to determine the list of available merge strategies. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- git.c | 19 +++++++++++++++++++ help.c | 2 ++ help.h | 1 + 3 files changed, 22 insertions(+) diff --git a/git.c b/git.c index 01c456edce..c853210bcc 100644 --- a/git.c +++ b/git.c @@ -637,6 +637,25 @@ static void list_builtins(struct string_list *out, unsigned int exclude_option) } } +void load_builtin_commands(const char *prefix, struct cmdnames *cmds) +{ + const char *name; + int i; + + /* + * Callers can ask for a subset of the commands based on a certain + * prefix, which is then dropped from the added names. The names in + * the `commands[]` array do not have the `git-` prefix, though, + * therefore we must expect the `prefix` to at least start with `git-`. + */ + if (!skip_prefix(prefix, "git-", &prefix)) + BUG("prefix '%s' must start with 'git-'", prefix); + + for (i = 0; i < ARRAY_SIZE(commands); i++) + if (skip_prefix(commands[i].cmd, prefix, &name)) + add_cmdname(cmds, name, strlen(name)); +} + #ifdef STRIP_EXTENSION static void strip_extension(const char **argv) { diff --git a/help.c b/help.c index 4e2468a44d..919cbb9206 100644 --- a/help.c +++ b/help.c @@ -263,6 +263,8 @@ void load_command_list(const char *prefix, const char *env_path = getenv("PATH"); const char *exec_path = git_exec_path(); + load_builtin_commands(prefix, main_cmds); + if (exec_path) { list_commands_in_dir(main_cmds, exec_path, prefix); QSORT(main_cmds->names, main_cmds->cnt, cmdname_compare); diff --git a/help.h b/help.h index dc02458855..5871e93ba2 100644 --- a/help.h +++ b/help.h @@ -32,6 +32,7 @@ const char *help_unknown_cmd(const char *cmd); void load_command_list(const char *prefix, struct cmdnames *main_cmds, struct cmdnames *other_cmds); +void load_builtin_commands(const char *prefix, struct cmdnames *cmds); void add_cmdname(struct cmdnames *cmds, const char *name, int len); /* Here we require that excludes is a sorted list. */ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes); From 8474f2658156157476e84e8b0ad2b8dcd6354f39 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Thu, 8 Oct 2020 00:39:26 -0700 Subject: [PATCH 08/17] Makefile: ASCII-sort += lists In 805d9eaf5e (Makefile: ASCII-sort += lists, 2020-03-21), the += lists in the Makefile were sorted into ASCII order. Since then, more out of order elements have been introduced. Sort these lists back into ASCII order. This patch is best viewed with `--color-moved`. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5311b1d2c4..95571ee3fc 100644 --- a/Makefile +++ b/Makefile @@ -820,8 +820,8 @@ TEST_SHELL_PATH = $(SHELL_PATH) LIB_FILE = libgit.a XDIFF_LIB = xdiff/lib.a -GENERATED_H += config-list.h GENERATED_H += command-list.h +GENERATED_H += config-list.h LIB_H := $(sort $(patsubst ./%,%,$(shell git ls-files '*.h' ':!t/' ':!Documentation/' 2>/dev/null || \ $(FIND) . \ @@ -998,9 +998,9 @@ LIB_OBJS += sigchain.o LIB_OBJS += split-index.o LIB_OBJS += stable-qsort.o LIB_OBJS += strbuf.o -LIB_OBJS += strvec.o LIB_OBJS += streaming.o LIB_OBJS += string-list.o +LIB_OBJS += strvec.o LIB_OBJS += sub-process.o LIB_OBJS += submodule-config.o LIB_OBJS += submodule.o @@ -1066,15 +1066,15 @@ BUILTIN_OBJS += builtin/checkout-index.o BUILTIN_OBJS += builtin/checkout.o BUILTIN_OBJS += builtin/clean.o BUILTIN_OBJS += builtin/clone.o -BUILTIN_OBJS += builtin/credential-cache.o -BUILTIN_OBJS += builtin/credential-cache--daemon.o -BUILTIN_OBJS += builtin/credential-store.o BUILTIN_OBJS += builtin/column.o BUILTIN_OBJS += builtin/commit-graph.o BUILTIN_OBJS += builtin/commit-tree.o BUILTIN_OBJS += builtin/commit.o BUILTIN_OBJS += builtin/config.o BUILTIN_OBJS += builtin/count-objects.o +BUILTIN_OBJS += builtin/credential-cache--daemon.o +BUILTIN_OBJS += builtin/credential-cache.o +BUILTIN_OBJS += builtin/credential-store.o BUILTIN_OBJS += builtin/credential.o BUILTIN_OBJS += builtin/describe.o BUILTIN_OBJS += builtin/diff-files.o From a15ad5d1bc23f3a6842360df5ee840b1dc3e4888 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 8 Oct 2020 10:13:46 +0000 Subject: [PATCH 09/17] t1415: avoid using `main` as ref name In preparation for a patch series that will change the fall-back for `init.defaultBranch` to `main`, let's not use `main` as ref name in this test script. Otherwise, the `git for-each-ref ... | grep main` which wants to catch those refs would also unexpectedly catch `refs/heads/main`. Since the refs in question are worktree-local ones (i.e. each worktree has their own, just like `HEAD`), and since the test case already uses a secondary worktree called "second", let's use the name "first" for those refs instead. While at it, adjust the test titles that talk about a "repo" when they meant a "worktree" instead. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t1415-worktree-refs.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh index bb2c7572a3..7ab91241ab 100755 --- a/t/t1415-worktree-refs.sh +++ b/t/t1415-worktree-refs.sh @@ -76,24 +76,24 @@ test_expect_success 'reflog of worktrees/xx/HEAD' ' test_cmp expected actual.wt2 ' -test_expect_success 'for-each-ref from main repo' ' +test_expect_success 'for-each-ref from main worktree' ' mkdir fer1 && git -C fer1 init repo && test_commit -C fer1/repo initial && git -C fer1/repo worktree add ../second && - git -C fer1/repo update-ref refs/bisect/main HEAD && - git -C fer1/repo update-ref refs/rewritten/main HEAD && - git -C fer1/repo update-ref refs/worktree/main HEAD && - git -C fer1/repo for-each-ref --format="%(refname)" | grep main >actual && + git -C fer1/repo update-ref refs/bisect/first HEAD && + git -C fer1/repo update-ref refs/rewritten/first HEAD && + git -C fer1/repo update-ref refs/worktree/first HEAD && + git -C fer1/repo for-each-ref --format="%(refname)" | grep first >actual && cat >expected <<-\EOF && - refs/bisect/main - refs/rewritten/main - refs/worktree/main + refs/bisect/first + refs/rewritten/first + refs/worktree/first EOF test_cmp expected actual ' -test_expect_success 'for-each-ref from linked repo' ' +test_expect_success 'for-each-ref from linked worktree' ' mkdir fer2 && git -C fer2 init repo && test_commit -C fer2/repo initial && From 538228ed23a1d5e17e89bb17086d4dda51325bd8 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 8 Oct 2020 10:13:47 +0000 Subject: [PATCH 10/17] tests: avoid using the branch name `main` In the near future, we want to change Git's default branch name to `main`. In preparation for that, stop using it as a branch name in the test suite. Replace that branch name by `topic`, the same name we used to rename variations of `master` in b6211b89eb3 (tests: avoid variations of the `master` branch name, 2020-09-26). Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t6012-rev-list-simplify.sh | 8 ++++---- t/t6400-merge-df.sh | 8 ++++---- t/t6409-merge-subtree.sh | 12 ++++++------ t/t6430-merge-recursive.sh | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh index b6fa43ace0..7fc10f8593 100755 --- a/t/t6012-rev-list-simplify.sh +++ b/t/t6012-rev-list-simplify.sh @@ -171,7 +171,7 @@ test_expect_success '--full-diff is not affected by --parents' ' test_expect_success 'rebuild repo' ' rm -rf .git * && git init && - git switch -c main && + git switch -c topic && echo base >file && git add file && @@ -186,7 +186,7 @@ test_expect_success 'rebuild repo' ' git add file && test_commit B && - git switch main && + git switch topic && test_must_fail git merge -m "M" B && echo A >file && echo B >>file && @@ -207,7 +207,7 @@ test_expect_success 'rebuild repo' ' git merge -m R -Xtheirs X && note R && - git switch main && + git switch topic && git merge -m N R && note N && @@ -221,7 +221,7 @@ test_expect_success 'rebuild repo' ' git add z && test_commit Z && - git switch main && + git switch topic && git merge -m O Z && note O && diff --git a/t/t6400-merge-df.sh b/t/t6400-merge-df.sh index 400a4cd139..f1b84617af 100755 --- a/t/t6400-merge-df.sh +++ b/t/t6400-merge-df.sh @@ -124,7 +124,7 @@ test_expect_success 'Simple merge in repo with interesting pathnames' ' git add . && git commit -m initial && - git branch main && + git branch topic && git branch other && git checkout other && @@ -132,10 +132,10 @@ test_expect_success 'Simple merge in repo with interesting pathnames' ' git add -u && git commit -m other && - git checkout main && - echo main >foo/bar/baz && + git checkout topic && + echo topic >foo/bar/baz && git add -u && - git commit -m main && + git commit -m topic && git merge other && git ls-files -s >out && diff --git a/t/t6409-merge-subtree.sh b/t/t6409-merge-subtree.sh index 1a0d0e23d0..b8e8b6f642 100755 --- a/t/t6409-merge-subtree.sh +++ b/t/t6409-merge-subtree.sh @@ -35,11 +35,11 @@ test_expect_success 'setup branch sub' ' test_commit foo ' -test_expect_success 'setup branch main' ' - git checkout -b main master && +test_expect_success 'setup topic branch' ' + git checkout -b topic master && git merge -s ours --no-commit --allow-unrelated-histories sub && git read-tree --prefix=dir/ -u sub && - git commit -m "initial merge of sub into main" && + git commit -m "initial merge of sub into topic" && test_path_is_file dir/foo.t && test_path_is_file hello ' @@ -49,9 +49,9 @@ test_expect_success 'update branch sub' ' test_commit bar ' -test_expect_success 'update branch main' ' - git checkout main && - git merge -s subtree sub -m "second merge of sub into main" && +test_expect_success 'update topic branch' ' + git checkout topic && + git merge -s subtree sub -m "second merge of sub into topic" && test_path_is_file dir/bar.t && test_path_is_file dir/foo.t && test_path_is_file hello diff --git a/t/t6430-merge-recursive.sh b/t/t6430-merge-recursive.sh index d48d211a95..a328260d42 100755 --- a/t/t6430-merge-recursive.sh +++ b/t/t6430-merge-recursive.sh @@ -663,7 +663,7 @@ test_expect_failure 'merge-recursive rename vs. rename/symlink' ' test_expect_success 'merging with triple rename across D/F conflict' ' git reset --hard HEAD && - git checkout -b main && + git checkout -b topic && git rm -rf . && echo "just a file" >sub1 && @@ -682,7 +682,7 @@ test_expect_success 'merging with triple rename across D/F conflict' ' test_tick && git commit -a -m changesimplefile && - git checkout main && + git checkout topic && git rm sub1 && git mv sub2 sub1 && test_tick && From 7d78d5fc1a91b683dde970e5e48b6d9a873cfd99 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 8 Oct 2020 15:29:34 +0000 Subject: [PATCH 11/17] ci: skip GitHub workflow runs for already-tested commits/trees When pushing a commit that has already passed a CI or PR build successfully, it makes sense to save some energy and time and skip the new build. Let's teach our GitHub workflow to do that. For good measure, we also compare the tree ID, which is what we actually test (the commit ID might have changed due to a reworded commit message, which should not affect the outcome of the run). Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- .github/workflows/main.yml | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fcfd138ff1..0a9acb6a19 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: ci-config: runs-on: ubuntu-latest outputs: - enabled: ${{ steps.check-ref.outputs.enabled }} + enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }} steps: - name: try to clone ci-config branch run: | @@ -34,6 +34,43 @@ jobs: enabled=no fi echo "::set-output name=enabled::$enabled" + - name: skip if the commit or tree was already tested + id: skip-if-redundant + uses: actions/github-script@v3 + if: steps.check-ref.outputs.enabled == 'yes' + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + // Figure out workflow ID, commit and tree + const { data: run } = await github.actions.getWorkflowRun({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.runId, + }); + const workflow_id = run.workflow_id; + const head_sha = run.head_sha; + const tree_id = run.head_commit.tree_id; + + // See whether there is a successful run for that commit or tree + const { data: runs } = await github.actions.listWorkflowRuns({ + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 500, + status: 'success', + workflow_id, + }); + for (const run of runs.workflow_runs) { + if (head_sha === run.head_sha) { + core.warning(`Successful run for the commit ${head_sha}: ${run.html_url}`); + core.setOutput('enabled', ' but skip'); + break; + } + if (tree_id === run.head_commit.tree_id) { + core.warning(`Successful run for the tree ${tree_id}: ${run.html_url}`); + core.setOutput('enabled', ' but skip'); + break; + } + } windows-build: needs: ci-config From 4463ce75b7eea47f9b484b05957def655d3f46d5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 8 Oct 2020 15:29:35 +0000 Subject: [PATCH 12/17] ci: do not skip tagged revisions in GitHub workflows When `master` is tagged, and then both `master` and the tag are pushed, Travis CI will happily build both. That is a waste of energy, which is why we skip the build for `master` in that case. Our GitHub workflow is also triggered by tags. However, the run would fail because the `windows-test` jobs are _not_ skipped on tags, but the `windows-build` job _is skipped (and therefore fails to upload the build artifacts needed by the test jobs). In addition, we just added logic to our GitHub workflow that will skip runs altogether if there is already a successful run for the same commit or at least for the same tree. Let's just change the GitHub workflow to no longer specifically skip tagged revisions. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- ci/lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/lib.sh b/ci/lib.sh index 821e3660d6..38c0eac351 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -149,6 +149,7 @@ then CI_REPO_SLUG="$GITHUB_REPOSITORY" CI_JOB_ID="$GITHUB_RUN_ID" CC="${CC:-gcc}" + DONT_SKIP_TAGS=t cache_dir="$HOME/none" @@ -167,6 +168,7 @@ good_trees_file="$cache_dir/good-trees" mkdir -p "$cache_dir" +test -n "${DONT_SKIP_TAGS-}" || skip_branch_tip_with_tag skip_good_tree From df49a806abab459430ce022d97ae62ab99e5bab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= Date: Thu, 8 Oct 2020 22:23:54 +0200 Subject: [PATCH 13/17] git-bisect-lk2009: make continuation of list indented MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That's clearer asciidoc formatting. Signed-off-by: Jean-Noël Avila Signed-off-by: Junio C Hamano --- Documentation/git-bisect-lk2009.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/git-bisect-lk2009.txt b/Documentation/git-bisect-lk2009.txt index 3ba49e85b7..f3d9566c89 100644 --- a/Documentation/git-bisect-lk2009.txt +++ b/Documentation/git-bisect-lk2009.txt @@ -473,7 +473,7 @@ Z-Z ------------- 2) starting from the "good" ends of the graph, associate to each -commit the number of ancestors it has plus one + commit the number of ancestors it has plus one For example with the following graph where H is the "bad" commit and A and D are some parents of some "good" commits: @@ -514,7 +514,7 @@ D---E ------------- 4) the best bisection point is the commit with the highest associated -number + number So in the above example the best bisection point is commit C. @@ -580,8 +580,8 @@ good or a bad commit does not give more or less information). Let's also suppose that we have a cleaned up graph like one after step 1) in the bisection algorithm above. This means that we can measure -the information we get in terms of number of commit we can remove from -the graph.. + the information we get in terms of number of commit we can remove + from the graph.. And let's take a commit X in the graph. @@ -689,18 +689,18 @@ roughly the following steps: 6) sort the commit by decreasing associated value 7) if the first commit has not been skipped, we can return it and stop -here + here 8) otherwise filter out all the skipped commits in the sorted list 9) use a pseudo random number generator (PRNG) to generate a random -number between 0 and 1 + number between 0 and 1 10) multiply this random number with its square root to bias it toward -0 + 0 11) multiply the result by the number of commits in the filtered list -to get an index into this list + to get an index into this list 12) return the commit at the computed index From 49fbf9ed71440f064b9fa922cd8febe36c1f8fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= Date: Thu, 8 Oct 2020 22:23:55 +0200 Subject: [PATCH 14/17] doc: use linkgit macro where needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-Noël Avila Signed-off-by: Junio C Hamano --- Documentation/git-grep.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index a7f9bc99ea..6077ff01a4 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -209,7 +209,7 @@ providing this option will cause it to die. Use \0 as the delimiter for pathnames in the output, and print them verbatim. Without this option, pathnames with "unusual" characters are quoted as explained for the configuration - variable core.quotePath (see git-config(1)). + variable core.quotePath (see linkgit:git-config[1]). -o:: --only-matching:: From 89eed6fa99915042792946a92b61fc64fed04b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= Date: Thu, 8 Oct 2020 22:23:56 +0200 Subject: [PATCH 15/17] doc: git-remote fix ups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-Noël Avila Signed-off-by: Junio C Hamano --- Documentation/git-remote.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt index 9659abbf8e..ea73386c81 100644 --- a/Documentation/git-remote.txt +++ b/Documentation/git-remote.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] 'git remote' [-v | --verbose] -'git remote add' [-t ] [-m ] [-f] [--[no-]tags] [--mirror=] +'git remote add' [-t ] [-m ] [-f] [--[no-]tags] [--mirror=(fetch|push)] 'git remote rename' 'git remote remove' 'git remote set-head' (-a | --auto | -d | --delete | ) @@ -35,7 +35,7 @@ OPTIONS -v:: --verbose:: Be a little more verbose and show remote url after name. - NOTE: This must be placed between `remote` and `subcommand`. + NOTE: This must be placed between `remote` and subcommand. COMMANDS @@ -46,7 +46,7 @@ subcommands are available to perform operations on the remotes. 'add':: -Adds a remote named for the repository at +Add a remote named for the repository at . The command `git fetch ` can then be used to create and update remote-tracking branches /. + @@ -109,13 +109,13 @@ With `-d` or `--delete`, the symbolic ref `refs/remotes//HEAD` is deleted. + With `-a` or `--auto`, the remote is queried to determine its `HEAD`, then the symbolic-ref `refs/remotes//HEAD` is set to the same branch. e.g., if the remote -`HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set +`HEAD` is pointed at `next`, `git remote set-head origin -a` will set the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will only work if `refs/remotes/origin/next` already exists; if not it must be fetched first. + -Use `` to set the symbolic-ref `refs/remotes//HEAD` explicitly. e.g., "git -remote set-head origin master" will set the symbolic-ref `refs/remotes/origin/HEAD` to +Use `` to set the symbolic-ref `refs/remotes//HEAD` explicitly. e.g., `git +remote set-head origin master` will set the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/master`. This will only work if `refs/remotes/origin/master` already exists; if not it must be fetched first. + @@ -127,7 +127,7 @@ This can be used to track a subset of the available remote branches after the initial setup for a remote. + The named branches will be interpreted as if specified with the -`-t` option on the 'git remote add' command line. +`-t` option on the `git remote add` command line. + With `--add`, instead of replacing the list of currently tracked branches, adds to that list. @@ -181,16 +181,16 @@ fetch --prune `, except that no new references will be fetched. See the PRUNING section of linkgit:git-fetch[1] for what it'll prune depending on various configuration. + -With `--dry-run` option, report what branches will be pruned, but do not +With `--dry-run` option, report what branches would be pruned, but do not actually prune them. 'update':: Fetch updates for remotes or remote groups in the repository as defined by -remotes.. If neither group nor remote is specified on the command line, +`remotes.`. If neither group nor remote is specified on the command line, the configuration parameter remotes.default will be used; if remotes.default is not defined, all remotes which do not have the -configuration parameter remote..skipDefaultUpdate set to true will +configuration parameter `remote..skipDefaultUpdate` set to true will be updated. (See linkgit:git-config[1]). + With `--prune` option, run pruning against all the remotes that are updated. From 9f443f553171032d5ce004ae326ecb116a6ef4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= Date: Thu, 8 Oct 2020 22:23:57 +0200 Subject: [PATCH 16/17] doc: fix the bnf like style of some commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In command line options, variables are entered between < and > Signed-off-by: Jean-Noël Avila Signed-off-by: Junio C Hamano --- Documentation/git-init.txt | 2 +- builtin/submodule--helper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/git-init.txt b/Documentation/git-init.txt index f35f70f13d..59ecda6c17 100644 --- a/Documentation/git-init.txt +++ b/Documentation/git-init.txt @@ -70,7 +70,7 @@ repository. + If this is reinitialization, the repository will be moved to the specified path. --b :: --initial-branch=:: Use the specified name for the initial branch in the newly created repository. diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index de5ad73bb8..c30896c897 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1308,7 +1308,7 @@ static int module_summary(int argc, const char **argv, const char *prefix) }; const char *const git_submodule_helper_usage[] = { - N_("git submodule--helper summary [] [commit] [--] []"), + N_("git submodule--helper summary [] [] [--] []"), NULL }; From d4a392452e292ff924e79ec8458611c0f679d6d4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 8 Oct 2020 21:53:09 -0700 Subject: [PATCH 17/17] Git 2.29-rc1 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/2.29.0.txt | 34 +++++++++++++++++++------------ GIT-VERSION-GEN | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Documentation/RelNotes/2.29.0.txt b/Documentation/RelNotes/2.29.0.txt index 43d7296efa..06ba2f803f 100644 --- a/Documentation/RelNotes/2.29.0.txt +++ b/Documentation/RelNotes/2.29.0.txt @@ -156,7 +156,7 @@ Performance, Internal Implementation, Development Support etc. barrier to adoption. * The final leg of SHA-256 transition plus doc updates. Note that - there is no inter-operability between SHA-1 and SHA-256 + there is no interoperability between SHA-1 and SHA-256 repositories yet. * CMake support to build with MSVC for Windows bypassing the Makefile. @@ -184,10 +184,6 @@ Performance, Internal Implementation, Development Support etc. the ref backend in use, as its format is much richer than the normal refs, and written directly by "git fetch" as a plain file.. - * A handful of places in in-tree code still relied on being able to - execute the git subcommands, especially built-ins, in "git-foo" - form, which have been corrected. - * An unused binary has been discarded, and and a bunch of commands have been turned into into built-in. @@ -216,10 +212,25 @@ Performance, Internal Implementation, Development Support etc. * "diff-highlight" (in contrib/) had a logic to flush its output upon seeing a blank line but the way it detected a blank line was broken. + * The logic to skip testing on the tagged commit and the tag itself + was not quite consistent which led to failure of Windows test + tasks. It has been revamped to consistently skip revisions that + have already been tested, based on the tree object of the revision. + Fixes since v2.28 ----------------- + * The "mediawiki" remote backend which lives in contrib/mw-to-git/ + and is not built with git by default, had an RCE bug allowing a + malicious MediaWiki server operator to inject arbitrary commands + for execution by a cloning client. This has been fixed. + + The bug was discovered and reported by Joern Schneeweisz of GitLab + to the git-security mailing list. Its practical impact due to the + obscurity of git-remote-mediawiki was deemed small enough to forgo + a dedicated security release. + * "git clone --separate-git-dir=$elsewhere" used to stomp on the contents of the existing directory $elsewhere, which has been taught to fail when $elsewhere is not an empty directory. @@ -355,16 +366,13 @@ Fixes since v2.28 "git log --tags=no-tag-matches-this-pattern" does. (merge 04a0e98515 jk/rev-input-given-fix later to maint). - * Various callers of run_command API has been modernized. + * Various callers of run_command API have been modernized. (merge afbdba391e jc/run-command-use-embedded-args later to maint). * List of options offered and accepted by "git add -i/-p" were inconsistent, which have been corrected. (merge ce910287e7 pw/add-p-allowed-options-fix later to maint). - * Various callers of run_command API has been modernized. - (merge afbdba391e jc/run-command-use-embedded-args later to maint). - * "git diff --stat -w" showed 0-line changes for paths whose changes were only whitespaces, which was not intuitive. We now omit such paths from the stat output. @@ -381,7 +389,7 @@ Fixes since v2.28 information (e.g. "@{u}" does not record what branch the user was on hence which branch 'the upstream' needs to be computed, and even if the record were available, the relationship between branches may - have changed), at least hide the error to allow "status" show its + have changed), at least hide the error and allow "status" to show its output. * "git status --short" quoted a path with SP in it when tracked, but @@ -398,7 +406,7 @@ Fixes since v2.28 (merge 378fe5fc3d mt/config-fail-nongit-early later to maint). * There is a logic to estimate how many objects are in the - repository, which is mean to run once per process invocation, but + repository, which is meant to run once per process invocation, but it ran every time the estimated value was requested. (merge 67bb65de5d jk/dont-count-existing-objects-twice later to maint). @@ -411,8 +419,8 @@ Fixes since v2.28 which has been corrected. (merge 4e735c1326 ar/fetch-ipversion-in-all later to maint). - * The "unshelve" subcommand of "git p4" used incorrectly used - commit^N where it meant to say commit~N to name the Nth generation + * The "unshelve" subcommand of "git p4" incorrectly used commit^N + where it meant to say commit~N to name the Nth generation ancestor, which has been corrected. (merge 0acbf5997f ld/p4-unshelve-fix later to maint). diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index c5027c4556..0ebd699cf0 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v2.29.0-rc0 +DEF_VER=v2.29.0-rc1 LF=' '