diff options
-rw-r--r-- | .mailmap | 3 | ||||
-rw-r--r-- | Documentation/config/http.txt | 4 | ||||
-rw-r--r-- | Documentation/fetch-options.txt | 5 | ||||
-rw-r--r-- | Documentation/gitcore-tutorial.txt | 2 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | builtin/checkout.c | 2 | ||||
-rw-r--r-- | builtin/commit.c | 1 | ||||
-rw-r--r-- | compat/regex/regex.h | 5 | ||||
-rw-r--r-- | object-store.h | 2 | ||||
-rw-r--r-- | run-command.c | 3 | ||||
-rw-r--r-- | sha1-file.c | 38 | ||||
-rw-r--r-- | string-list.h | 6 | ||||
-rw-r--r-- | submodule.c | 28 | ||||
-rwxr-xr-x | t/t2070-restore.sh | 17 | ||||
-rwxr-xr-x | t/t4018-diff-funcname.sh | 1 | ||||
-rwxr-xr-x | t/t5510-fetch.sh | 24 | ||||
-rwxr-xr-x | t/t5702-protocol-v2.sh | 12 | ||||
-rwxr-xr-x | t/t7500-commit-template-squash-signoff.sh | 9 | ||||
-rwxr-xr-x | t/t7800-difftool.sh | 5 | ||||
-rw-r--r-- | transport.c | 2 | ||||
-rw-r--r-- | unpack-trees.c | 10 |
21 files changed, 130 insertions, 52 deletions
@@ -59,6 +59,7 @@ David S. Miller <davem@davemloft.net> David Turner <novalis@novalis.org> <dturner@twopensource.com> David Turner <novalis@novalis.org> <dturner@twosigma.com> Derrick Stolee <dstolee@microsoft.com> <stolee@gmail.com> +Derrick Stolee <dstolee@microsoft.com> Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> Deskin Miller <deskinm@umich.edu> Đoàn Trần Công Danh <congdanhqx@gmail.com> Doan Tran Cong Danh Dirk Süsserott <newsletter@dirk.my1.cc> @@ -109,6 +110,7 @@ Jim Meyering <jim@meyering.net> <meyering@redhat.com> Joachim Berdal Haga <cjhaga@fys.uio.no> Joachim Jablon <joachim.jablon@people-doc.com> <ewjoachim@gmail.com> Johannes Schindelin <Johannes.Schindelin@gmx.de> <johannes.schindelin@gmx.de> +Johannes Schindelin <Johannes.Schindelin@gmx.de> Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com> Johannes Sixt <j6t@kdbg.org> <J.Sixt@eudaptics.com> Johannes Sixt <j6t@kdbg.org> <j.sixt@viscovery.net> Johannes Sixt <j6t@kdbg.org> <johannes.sixt@telecom.at> @@ -287,6 +289,7 @@ William Pursell <bill.pursell@gmail.com> YONETANI Tomokazu <y0n3t4n1@gmail.com> <qhwt+git@les.ath.cx> YONETANI Tomokazu <y0n3t4n1@gmail.com> <y0netan1@dragonflybsd.org> YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> +Yi-Jyun Pan <pan93412@gmail.com> # the two anonymous contributors are different persons: anonymous <linux@horizon.com> anonymous <linux@horizon.net> diff --git a/Documentation/config/http.txt b/Documentation/config/http.txt index 5a32f5b0a5..8471b39f0f 100644 --- a/Documentation/config/http.txt +++ b/Documentation/config/http.txt @@ -71,7 +71,7 @@ http.saveCookies:: http.version:: Use the specified HTTP protocol version when communicating with a server. If you want to force the default. The available and default version depend - on libcurl. Actually the possible values of + on libcurl. Currently the possible values of this option are: - HTTP/2 @@ -84,7 +84,7 @@ http.sslVersion:: particular configuration of the crypto library in use. Internally this sets the 'CURLOPT_SSL_VERSION' option; see the libcurl documentation for more details on the format of this option and - for the ssl version supported. Actually the possible values of + for the ssl version supported. Currently the possible values of this option are: - sslv2 diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt index a2f78624a2..a115a1ae0e 100644 --- a/Documentation/fetch-options.txt +++ b/Documentation/fetch-options.txt @@ -139,7 +139,10 @@ ifndef::git-pull[] specified refspec (can be given more than once) to map the refs to remote-tracking branches, instead of the values of `remote.*.fetch` configuration variables for the remote - repository. See section on "Configured Remote-tracking + repository. Providing an empty `<refspec>` to the + `--refmap` option causes Git to ignore the configured + refspecs and rely entirely on the refspecs supplied as + command-line arguments. See section on "Configured Remote-tracking Branches" for details. -t:: diff --git a/Documentation/gitcore-tutorial.txt b/Documentation/gitcore-tutorial.txt index f880d21dfb..c0b95256cc 100644 --- a/Documentation/gitcore-tutorial.txt +++ b/Documentation/gitcore-tutorial.txt @@ -751,7 +751,7 @@ to it. ================================================ If you make the decision to start your new branch at some other point in the history than the current `HEAD`, you can do so by -just telling 'git checkout' what the base of the checkout would be. +just telling 'git switch' what the base of the checkout would be. In other words, if you have an earlier tag or branch, you'd just do ------------ @@ -1220,6 +1220,9 @@ endif ifneq ($(filter leak,$(SANITIZERS)),) BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS endif +ifneq ($(filter address,$(SANITIZERS)),) +NO_REGEX = NeededForASAN +endif endif ifndef sysconfdir diff --git a/builtin/checkout.c b/builtin/checkout.c index b52c490c8f..18ef5fb975 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -524,6 +524,8 @@ static int checkout_paths(const struct checkout_opts *opts, /* Now we are committed to check them out */ if (opts->checkout_worktree) errs |= checkout_worktree(opts); + else + remove_marked_cache_entries(&the_index, 1); /* * Allow updating the index when checking out from the index. diff --git a/builtin/commit.c b/builtin/commit.c index aa1332308a..646e84547d 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -964,6 +964,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, */ if (!committable && whence != FROM_MERGE && !allow_empty && !(amend && is_a_merge(current_head))) { + s->hints = advice_status_hints; s->display_comment_prefix = old_display_comment_prefix; run_status(stdout, index_file, prefix, 0, s); if (amend) diff --git a/compat/regex/regex.h b/compat/regex/regex.h index 08a2609663..2d3412860d 100644 --- a/compat/regex/regex.h +++ b/compat/regex/regex.h @@ -41,6 +41,11 @@ extern "C" { #endif +#define regcomp git_regcomp +#define regexec git_regexec +#define regerror git_regerror +#define regfree git_regfree + /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two diff --git a/object-store.h b/object-store.h index 55ee639350..61b8b13e3b 100644 --- a/object-store.h +++ b/object-store.h @@ -292,8 +292,6 @@ struct object_info { #define OBJECT_INFO_LOOKUP_REPLACE 1 /* Allow reading from a loose object file of unknown/bogus type */ #define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2 -/* Do not check cached storage */ -#define OBJECT_INFO_SKIP_CACHED 4 /* Do not retry packed storage after checking packed and loose storage */ #define OBJECT_INFO_QUICK 8 /* Do not check loose object */ diff --git a/run-command.c b/run-command.c index 9942f120a9..f5e1149f9b 100644 --- a/run-command.c +++ b/run-command.c @@ -213,8 +213,9 @@ static char *locate_in_PATH(const char *file) static int exists_in_PATH(const char *file) { char *r = locate_in_PATH(file); + int found = r != NULL; free(r); - return r != NULL; + return found; } int sane_execvp(const char *file, char * const argv[]) diff --git a/sha1-file.c b/sha1-file.c index 188de57634..03ae9ae93a 100644 --- a/sha1-file.c +++ b/sha1-file.c @@ -1417,6 +1417,7 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid, struct object_info *oi, unsigned flags) { static struct object_info blank_oi = OBJECT_INFO_INIT; + struct cached_object *co; struct pack_entry e; int rtype; const struct object_id *real = oid; @@ -1431,24 +1432,22 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid, if (!oi) oi = &blank_oi; - if (!(flags & OBJECT_INFO_SKIP_CACHED)) { - struct cached_object *co = find_cached_object(real); - if (co) { - if (oi->typep) - *(oi->typep) = co->type; - if (oi->sizep) - *(oi->sizep) = co->size; - if (oi->disk_sizep) - *(oi->disk_sizep) = 0; - if (oi->delta_base_sha1) - hashclr(oi->delta_base_sha1); - if (oi->type_name) - strbuf_addstr(oi->type_name, type_name(co->type)); - if (oi->contentp) - *oi->contentp = xmemdupz(co->buf, co->size); - oi->whence = OI_CACHED; - return 0; - } + co = find_cached_object(real); + if (co) { + if (oi->typep) + *(oi->typep) = co->type; + if (oi->sizep) + *(oi->sizep) = co->size; + if (oi->disk_sizep) + *(oi->disk_sizep) = 0; + if (oi->delta_base_sha1) + hashclr(oi->delta_base_sha1); + if (oi->type_name) + strbuf_addstr(oi->type_name, type_name(co->type)); + if (oi->contentp) + *oi->contentp = xmemdupz(co->buf, co->size); + oi->whence = OI_CACHED; + return 0; } while (1) { @@ -1932,8 +1931,7 @@ int repo_has_object_file_with_flags(struct repository *r, { if (!startup_info->have_repository) return 0; - return oid_object_info_extended(r, oid, NULL, - flags | OBJECT_INFO_SKIP_CACHED) >= 0; + return oid_object_info_extended(r, oid, NULL, flags) >= 0; } int repo_has_object_file(struct repository *r, diff --git a/string-list.h b/string-list.h index 7bb0ad07e6..6c5d274126 100644 --- a/string-list.h +++ b/string-list.h @@ -4,7 +4,8 @@ /** * The string_list API offers a data structure and functions to handle * sorted and unsorted arrays of strings. A "sorted" list is one whose - * entries are sorted by string value in `strcmp()` order. + * entries are sorted by string value in the order specified by the `cmp` + * member (`strcmp()` by default). * * The caller: * @@ -209,7 +210,8 @@ struct string_list_item *string_list_append(struct string_list *list, const char struct string_list_item *string_list_append_nodup(struct string_list *list, char *string); /** - * Sort the list's entries by string value in `strcmp()` order. + * Sort the list's entries by string value in order specified by list->cmp + * (strcmp() if list->cmp is NULL). */ void string_list_sort(struct string_list *list); diff --git a/submodule.c b/submodule.c index 9da7181321..9430db8ffc 100644 --- a/submodule.c +++ b/submodule.c @@ -431,7 +431,7 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt, else if (!strcmp(arg, "dirty")) diffopt->flags.ignore_dirty_submodules = 1; else if (strcmp(arg, "none")) - die("bad --ignore-submodules argument: %s", arg); + die(_("bad --ignore-submodules argument: %s"), arg); /* * Please update _git_status() in git-completion.bash when you * add new options @@ -812,9 +812,9 @@ static void collect_changed_submodules_cb(struct diff_queue_struct *q, submodule = submodule_from_name(me->repo, commit_oid, name); if (submodule) { - warning("Submodule in commit %s at path: " + warning(_("Submodule in commit %s at path: " "'%s' collides with a submodule named " - "the same. Skipping it.", + "the same. Skipping it."), oid_to_hex(commit_oid), p->two->path); name = NULL; } @@ -844,7 +844,7 @@ static void collect_changed_submodules(struct repository *r, repo_init_revisions(r, &rev, NULL); setup_revisions(argv->argc, argv->argv, &rev, NULL); if (prepare_revision_walk(&rev)) - die("revision walk setup failed"); + die(_("revision walk setup failed")); while ((commit = get_revision(&rev))) { struct rev_info diff_rev; @@ -992,7 +992,7 @@ static int submodule_needs_pushing(struct repository *r, cp.out = -1; cp.dir = path; if (start_command(&cp)) - die("Could not run 'git rev-list <commits> --not --remotes -n 1' command in submodule %s", + die(_("Could not run 'git rev-list <commits> --not --remotes -n 1' command in submodule %s"), path); if (strbuf_read(&buf, cp.out, the_hash_algo->hexsz + 1)) needs_pushing = 1; @@ -1115,7 +1115,7 @@ static void submodule_push_check(const char *path, const char *head, * child process. */ if (run_command(&cp)) - die("process for submodule '%s' failed", path); + die(_("process for submodule '%s' failed"), path); } int push_unpushed_submodules(struct repository *r, @@ -1155,10 +1155,10 @@ int push_unpushed_submodules(struct repository *r, /* Actually push the submodules */ for (i = 0; i < needs_pushing.nr; i++) { const char *path = needs_pushing.items[i].string; - fprintf(stderr, "Pushing submodule '%s'\n", path); + fprintf(stderr, _("Pushing submodule '%s'\n"), path); if (!push_submodule(path, remote, rs, push_options, dry_run)) { - fprintf(stderr, "Unable to push submodule '%s'\n", path); + fprintf(stderr, _("Unable to push submodule '%s'\n"), path); ret = 0; } } @@ -1448,7 +1448,7 @@ static int get_next_submodule(struct child_process *cp, prepare_submodule_repo_env_in_gitdir(&cp->env_array); cp->git_cmd = 1; if (!spf->quiet) - strbuf_addf(err, "Fetching submodule %s%s\n", + strbuf_addf(err, _("Fetching submodule %s%s\n"), spf->prefix, ce->name); argv_array_init(&cp->args); argv_array_pushv(&cp->args, spf->args.argv); @@ -1610,7 +1610,7 @@ int fetch_populated_submodules(struct repository *r, goto out; if (repo_read_index(r) < 0) - die("index file corrupt"); + die(_("index file corrupt")); argv_array_push(&spf.args, "fetch"); for (i = 0; i < options->argc; i++) @@ -1665,7 +1665,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked) cp.out = -1; cp.dir = path; if (start_command(&cp)) - die("Could not run 'git status --porcelain=2' in submodule %s", path); + die(_("Could not run 'git status --porcelain=2' in submodule %s"), path); fp = xfdopen(cp.out, "r"); while (strbuf_getwholeline(&buf, fp, '\n') != EOF) { @@ -1706,7 +1706,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked) fclose(fp); if (finish_command(&cp) && !ignore_cp_exit_code) - die("'git status --porcelain=2' failed in submodule %s", path); + die(_("'git status --porcelain=2' failed in submodule %s"), path); strbuf_release(&buf); return dirty_submodule; @@ -1841,7 +1841,7 @@ static int submodule_has_dirty_index(const struct submodule *sub) cp.no_stdout = 1; cp.dir = sub->path; if (start_command(&cp)) - die("could not recurse into submodule '%s'", sub->path); + die(_("could not recurse into submodule '%s'"), sub->path); return finish_command(&cp); } @@ -1862,7 +1862,7 @@ static void submodule_reset_index(const char *path) argv_array_push(&cp.args, empty_tree_oid_hex()); if (run_command(&cp)) - die("could not reset submodule index"); + die(_("could not reset submodule index")); } /** diff --git a/t/t2070-restore.sh b/t/t2070-restore.sh index 21c3f84459..076d0df7fc 100755 --- a/t/t2070-restore.sh +++ b/t/t2070-restore.sh @@ -106,4 +106,21 @@ test_expect_success 'restore --staged adds deleted intent-to-add file back to in git diff --cached --exit-code ' +test_expect_success 'restore --staged invalidates cache tree for deletions' ' + test_when_finished git reset --hard && + >new1 && + >new2 && + git add new1 new2 && + + # It is important to commit and then reset here, so that the index + # contains a valid cache-tree for the "both" tree. + git commit -m both && + git reset --soft HEAD^ && + + git restore --staged new1 && + git commit -m "just new2" && + git rev-parse HEAD:new2 && + test_must_fail git rev-parse HEAD:new1 +' + test_done diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index c0f4839543..02255a08bf 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -106,7 +106,6 @@ do result=success fi test_expect_$result "hunk header: $i" " - test_when_finished 'cat actual' && # for debugging only git diff -U1 $i >actual && grep '@@ .* @@.*RIGHT' actual " diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 4b60282689..5f8f1c287f 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -174,6 +174,30 @@ test_expect_success 'fetch --prune --tags with refspec prunes based on refspec' git rev-parse sometag ' +test_expect_success '--refmap="" ignores configured refspec' ' + cd "$TRASH_DIRECTORY" && + git clone "$D" remote-refs && + git -C remote-refs rev-parse remotes/origin/master >old && + git -C remote-refs update-ref refs/remotes/origin/master master~1 && + git -C remote-refs rev-parse remotes/origin/master >new && + git -C remote-refs fetch --refmap= origin "+refs/heads/*:refs/hidden/origin/*" && + git -C remote-refs rev-parse remotes/origin/master >actual && + test_cmp new actual && + git -C remote-refs fetch origin && + git -C remote-refs rev-parse remotes/origin/master >actual && + test_cmp old actual +' + +test_expect_success '--refmap="" and --prune' ' + git -C remote-refs update-ref refs/remotes/origin/foo/otherbranch master && + git -C remote-refs update-ref refs/hidden/foo/otherbranch master && + git -C remote-refs fetch --prune --refmap="" origin +refs/heads/*:refs/hidden/* && + git -C remote-refs rev-parse remotes/origin/foo/otherbranch && + test_must_fail git -C remote-refs rev-parse refs/hidden/foo/otherbranch && + git -C remote-refs fetch --prune origin && + test_must_fail git -C remote-refs rev-parse remotes/origin/foo/otherbranch +' + test_expect_success 'fetch tags when there is no tags' ' cd "$D" && diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index e73067d23f..7fd7102c87 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -665,6 +665,18 @@ test_expect_success 'fetch from namespaced repo respects namespaces' ' test_cmp expect actual ' +test_expect_success 'ls-remote with v2 http sends only one POST' ' + test_when_finished "rm -f log" && + + git ls-remote "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" >expect && + GIT_TRACE_CURL="$(pwd)/log" git -c protocol.version=2 \ + ls-remote "$HTTPD_URL/smart/http_parent" >actual && + test_cmp expect actual && + + grep "Send header: POST" log >posts && + test_line_count = 1 posts +' + test_expect_success 'push with http:// and a config of v2 does not request v2' ' test_when_finished "rm -f log" && # Till v2 for push is designed, make sure that if a client has diff --git a/t/t7500-commit-template-squash-signoff.sh b/t/t7500-commit-template-squash-signoff.sh index 46a5cd4b73..6d19ece05d 100755 --- a/t/t7500-commit-template-squash-signoff.sh +++ b/t/t7500-commit-template-squash-signoff.sh @@ -382,4 +382,13 @@ test_expect_success 'check commit with unstaged rename and copy' ' ) ' +test_expect_success 'commit without staging files fails and displays hints' ' + echo "initial" >file && + git add file && + git commit -m initial && + echo "changes" >>file && + test_must_fail git commit -m update >actual && + test_i18ngrep "no changes added to commit (use \"git add\" and/or \"git commit -a\")" actual +' + test_done diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 6bac9ed180..29b92907e2 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -125,15 +125,14 @@ test_expect_success 'difftool stops on error with --trust-exit-code' ' test_when_finished "rm -f for-diff .git/fail-right-file" && test_when_finished "git reset -- for-diff" && write_script .git/fail-right-file <<-\EOF && - echo "$2" + echo failed exit 1 EOF >for-diff && git add for-diff && - echo file >expect && test_must_fail git difftool -y --trust-exit-code \ --extcmd .git/fail-right-file branch >actual && - test_cmp expect actual + test_line_count = 1 actual ' test_expect_success 'difftool honors exit status if command not found' ' diff --git a/transport.c b/transport.c index 83379a037d..1fdc7dac1a 100644 --- a/transport.c +++ b/transport.c @@ -737,7 +737,7 @@ static int disconnect_git(struct transport *transport) { struct git_transport_data *data = transport->data; if (data->conn) { - if (data->got_remote_heads) + if (data->got_remote_heads && !transport->stateless_rpc) packet_flush(data->fd[1]); close(data->fd[0]); close(data->fd[1]); diff --git a/unpack-trees.c b/unpack-trees.c index 2399b6818b..191e738143 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -694,9 +694,11 @@ static int index_pos_by_traverse_info(struct name_entry *names, if (pos >= 0) BUG("This is a directory and should not exist in index"); pos = -pos - 1; - if (!starts_with(o->src_index->cache[pos]->name, name.buf) || + if (pos >= o->src_index->cache_nr || + !starts_with(o->src_index->cache[pos]->name, name.buf) || (pos > 0 && starts_with(o->src_index->cache[pos-1]->name, name.buf))) - BUG("pos must point at the first entry in this directory"); + BUG("pos %d doesn't point to the first entry of %s in index", + pos, name.buf); strbuf_release(&name); return pos; } @@ -1305,14 +1307,14 @@ static int clear_ce_flags_dir(struct index_state *istate, if (pl->use_cone_patterns && orig_ret == MATCHED_RECURSIVE) { struct cache_entry **ce = cache; - rc = (cache_end - cache) / sizeof(struct cache_entry *); + rc = cache_end - cache; while (ce < cache_end) { (*ce)->ce_flags &= ~clear_mask; ce++; } } else if (pl->use_cone_patterns && orig_ret == NOT_MATCHED) { - rc = (cache_end - cache) / sizeof(struct cache_entry *); + rc = cache_end - cache; } else { rc = clear_ce_flags_1(istate, cache, cache_end - cache, prefix, |