diff options
36 files changed, 167 insertions, 108 deletions
diff --git a/Documentation/Makefile b/Documentation/Makefile index 911b6bf79c..ed656db2ae 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -472,9 +472,9 @@ print-man1: ## Lint: gitlink .build/lint-docs/gitlink: | .build/lint-docs $(QUIET)mkdir $@ -.build/lint-docs/gitlink/howto: | .build/lint-docs +.build/lint-docs/gitlink/howto: | .build/lint-docs/gitlink $(QUIET)mkdir $@ -.build/lint-docs/gitlink/config: | .build/lint-docs +.build/lint-docs/gitlink/config: | .build/lint-docs/gitlink $(QUIET)mkdir $@ LINT_DOCS_GITLINK = $(patsubst %.txt,.build/lint-docs/gitlink/%.ok,$(HOWTO_TXT) $(DOC_DEP_TXT)) $(LINT_DOCS_GITLINK): | .build/lint-docs/gitlink diff --git a/Documentation/config.txt b/Documentation/config.txt index 0c0e6b859f..1167e88e34 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -304,7 +304,7 @@ path relative to Git's "runtime prefix", i.e. relative to the location where Git itself was installed. For example, `%(prefix)/bin/` refers to the directory in which the Git executable itself lives. If Git was compiled without runtime prefix support, the compiled-in prefix will be -subsituted instead. In the unlikely event that a literal path needs to +substituted instead. In the unlikely event that a literal path needs to be specified that should _not_ be expanded, it needs to be prefixed by `./`, like so: `./%(prefix)/bin`. diff --git a/Documentation/config/color.txt b/Documentation/config/color.txt index dd2d2e0d84..6e817f6047 100644 --- a/Documentation/config/color.txt +++ b/Documentation/config/color.txt @@ -17,11 +17,9 @@ date settings, starting and ending with a color, the dates should be set from oldest to newest. The metadata will be colored with the specified colors if the line was introduced before the given timestamp, overwriting older timestamped colors. - + Instead of an absolute timestamp relative timestamps work as well, e.g. `2.weeks.ago` is valid to address anything older than 2 weeks. - + It defaults to `blue,12 month ago,white,1 month ago,red`, which colors everything older than one year blue, recent changes between diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt index 9f8172828d..bc4e76a783 100644 --- a/Documentation/git-archive.txt +++ b/Documentation/git-archive.txt @@ -93,12 +93,19 @@ BACKEND EXTRA OPTIONS zip ~~~ --0:: - Store the files instead of deflating them. --9:: - Highest and slowest compression level. You can specify any - number from 1 to 9 to adjust compression speed and ratio. +-<digit>:: + Specify compression level. Larger values allow the command + to spend more time to compress to smaller size. Supported + values are from `-0` (store-only) to `-9` (best ratio). + Default is `-6` if not given. +tar +~~~ +-<number>:: + Specify compression level. The value will be passed to the + compression command configured in `tar.<format>.command`. See + manual page of the configured command for the list of supported + levels and the default level if this option isn't specified. CONFIGURATION ------------- diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 5449767121..8af42eff89 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -125,14 +125,14 @@ OPTIONS -m:: --move:: - Move/rename a branch and the corresponding reflog. + Move/rename a branch, together with its config and reflog. -M:: Shortcut for `--move --force`. -c:: --copy:: - Copy a branch and the corresponding reflog. + Copy a branch, together with its config and reflog. -C:: Shortcut for `--copy --force`. diff --git a/Documentation/git-bundle.txt b/Documentation/git-bundle.txt index 71b5ecabd1..72ab813905 100644 --- a/Documentation/git-bundle.txt +++ b/Documentation/git-bundle.txt @@ -51,10 +51,10 @@ using the `--thin` option to linkgit:git-pack-objects[1], and unbundled using the `--fix-thin` option to linkgit:git-index-pack[1]. There is no option to create a "thick pack" when using revision -exclusions, users should not be concerned about the difference. By -using "thin packs" bundles created using exclusions are smaller in +exclusions, and users should not be concerned about the difference. By +using "thin packs", bundles created using exclusions are smaller in size. That they're "thin" under the hood is merely noted here as a -curiosity, and as a reference to other documentation +curiosity, and as a reference to other documentation. See link:technical/bundle-format.html[the `bundle-format` documentation] for more details and the discussion of "thin pack" in @@ -144,7 +144,7 @@ unbundle <file>:: SPECIFYING REFERENCES --------------------- -Revisions must accompanied by reference names to be packaged in a +Revisions must be accompanied by reference names to be packaged in a bundle. More than one reference may be packaged, and more than one set of prerequisite objects can diff --git a/Documentation/git-multi-pack-index.txt b/Documentation/git-multi-pack-index.txt index b008ce2850..c588fb91af 100644 --- a/Documentation/git-multi-pack-index.txt +++ b/Documentation/git-multi-pack-index.txt @@ -99,13 +99,13 @@ associated `.keep` file will not be selected for the batch to repack. EXAMPLES -------- -* Write a MIDX file for the packfiles in the current .git folder. +* Write a MIDX file for the packfiles in the current `.git` directory. + ----------------------------------------------- $ git multi-pack-index write ----------------------------------------------- -* Write a MIDX file for the packfiles in the current .git folder with a +* Write a MIDX file for the packfiles in the current `.git` directory with a corresponding bitmap. + ------------------------------------------------------------- @@ -118,7 +118,7 @@ $ git multi-pack-index write --preferred-pack=<pack> --bitmap $ git multi-pack-index --object-dir <alt> write ----------------------------------------------- -* Verify the MIDX file for the packfiles in the current .git folder. +* Verify the MIDX file for the packfiles in the current `.git` directory. + ----------------------------------------------- $ git multi-pack-index verify diff --git a/Documentation/git.txt b/Documentation/git.txt index d63c65e67d..281c5f8cae 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -42,7 +42,7 @@ OPTIONS --version:: Prints the Git suite version that the 'git' program came from. + -This option is internaly converted to `git version ...` and accepts +This option is internally converted to `git version ...` and accepts the same options as the linkgit:git-version[1] command. If `--help` is also given, it takes precedence over `--version`. diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index f8a1fc2014..f2738b10db 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -155,7 +155,7 @@ accessed from the index or a tree versus from the filesystem. EXAMPLES -------- - - The pattern `hello.*` matches any file or folder + - The pattern `hello.*` matches any file or directory whose name begins with `hello.`. If one wants to restrict this only to the directory and not in its subdirectories, one can prepend the pattern with a slash, i.e. `/hello.*`; diff --git a/Documentation/gitweb.txt b/Documentation/gitweb.txt index 3cc9b034c4..7cee9d3689 100644 --- a/Documentation/gitweb.txt +++ b/Documentation/gitweb.txt @@ -547,7 +547,7 @@ like this: # make the front page an internal rewrite to the gitweb script RewriteRule ^/$ /cgi-bin/gitweb.cgi [QSA,L,PT] - # look for a public_git folder in unix users' home + # look for a public_git directory in unix users' home # http://git.example.org/~<user>/ RewriteRule ^/\~([^\/]+)(/|/gitweb.cgi)?$ /cgi-bin/gitweb.cgi \ [QSA,E=GITWEB_PROJECTROOT:/home/$1/public_git/,L,PT] diff --git a/Documentation/pretty-options.txt b/Documentation/pretty-options.txt index b3af850608..dc685be363 100644 --- a/Documentation/pretty-options.txt +++ b/Documentation/pretty-options.txt @@ -41,8 +41,8 @@ people using 80-column terminals. in `X` and we are outputting in `X`, we will output the object verbatim; this means that invalid sequences in the original commit may be copied to the output. Likewise, if iconv(3) fails - to convert the commit, we will output the original object - verbatim, along with a warning. + to convert the commit, we will quietly output the original + object verbatim. --expand-tabs=<n>:: --expand-tabs:: @@ -2901,7 +2901,7 @@ check-sha1:: t/helper/test-tool$X SP_OBJ = $(patsubst %.o,%.sp,$(C_OBJ)) -$(SP_OBJ): %.sp: %.c %.o GIT-CFLAGS +$(SP_OBJ): %.sp: %.c %.o $(QUIET_SP)cgcc -no-compile $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) \ -Wsparse-error \ $(SPARSE_FLAGS) $(SP_EXTRA_FLAGS) $< && \ diff --git a/builtin/branch.c b/builtin/branch.c index 0b7ed82654..7a1d1eeb07 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -407,7 +407,8 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r return strbuf_detach(&fmt, NULL); } -static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting, struct ref_format *format) +static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting, + struct ref_format *format, struct string_list *output) { int i; struct ref_array array; @@ -449,7 +450,7 @@ static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin if (column_active(colopts)) { assert(!filter->verbose && "--column and --verbose are incompatible"); /* format to a string_list to let print_columns() do its job */ - string_list_append(&output, out.buf); + string_list_append(output, out.buf); } else { fwrite(out.buf, 1, out.len, stdout); putchar('\n'); @@ -753,9 +754,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix) ref_sorting_set_sort_flags_all(sorting, REF_SORTING_ICASE, icase); ref_sorting_set_sort_flags_all( sorting, REF_SORTING_DETACHED_HEAD_FIRST, 1); - print_ref_list(&filter, sorting, &format); + print_ref_list(&filter, sorting, &format, &output); print_columns(&output, colopts, NULL); string_list_clear(&output, 0); + ref_sorting_release(sorting); return 0; } else if (edit_description) { const char *branch_name; diff --git a/builtin/clone.c b/builtin/clone.c index 559acf9e03..fb377b2765 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1040,8 +1040,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix) init_db(git_dir, real_git_dir, option_template, GIT_HASH_UNKNOWN, NULL, INIT_DB_QUIET); - if (real_git_dir) + if (real_git_dir) { + free((char *)git_dir); git_dir = real_git_dir; + } /* * additional config can be injected with -c, make sure it's included diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 642b4b888f..16a2c7d57c 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -96,6 +96,6 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix) ref_array_clear(&array); free_commit_list(filter.with_commit); free_commit_list(filter.no_commit); - UNLEAK(sorting); + ref_sorting_release(sorting); return 0; } diff --git a/builtin/grep.c b/builtin/grep.c index 8af5249a7b..9e34a820ad 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -199,8 +199,8 @@ static void *run(void *arg) grep_source_clear_data(&w->source); work_done(w); } - free_grep_patterns(arg); - free(arg); + free_grep_patterns(opt); + free(opt); return (void*) (intptr_t) hit; } @@ -401,7 +401,7 @@ static void append_path(struct grep_opt *opt, const void *data, size_t len) if (len == 1 && *(const char *)data == '\0') return; - string_list_append(path_list, xstrndup(data, len)); + string_list_append_nodup(path_list, xstrndup(data, len)); } static void run_pager(struct grep_opt *opt, const char *prefix) @@ -839,7 +839,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) struct grep_opt opt; struct object_array list = OBJECT_ARRAY_INIT; struct pathspec pathspec; - struct string_list path_list = STRING_LIST_INIT_NODUP; + struct string_list path_list = STRING_LIST_INIT_DUP; int i; int dummy; int use_index = 1; @@ -1159,8 +1159,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix) strbuf_addf(&buf, "+/%s%s", strcmp("less", pager) ? "" : "*", opt.pattern_list->pattern); - string_list_append(&path_list, - strbuf_detach(&buf, NULL)); + string_list_append_nodup(&path_list, + strbuf_detach(&buf, NULL)); } } @@ -1195,7 +1195,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix) if (hit && show_in_pager) run_pager(&opt, prefix); clear_pathspec(&pathspec); + string_list_clear(&path_list, 0); free_grep_patterns(&opt); + object_array_clear(&list); free_repos(); return !hit; } diff --git a/builtin/reflog.c b/builtin/reflog.c index bd4c669918..175c83e7cc 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -653,6 +653,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix) should_expire_reflog_ent, reflog_expiry_cleanup, &cb); + free(ref); } return status; } diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 8932142312..69c432ef1a 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -87,6 +87,10 @@ static void print_helper_status(struct ref *ref) break; case REF_STATUS_EXPECTING_REPORT: + res = "error"; + msg = "expecting report"; + break; + default: continue; } diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 6298cbdd4e..e630f0c730 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2999,7 +2999,7 @@ struct add_data { }; #define ADD_DATA_INIT { .depth = -1 } -static void show_fetch_remotes(FILE *output, const char *git_dir_path) +static void append_fetch_remotes(struct strbuf *msg, const char *git_dir_path) { struct child_process cp_remote = CHILD_PROCESS_INIT; struct strbuf sb_remote_out = STRBUF_INIT; @@ -3015,7 +3015,7 @@ static void show_fetch_remotes(FILE *output, const char *git_dir_path) while ((next_line = strchr(line, '\n')) != NULL) { size_t len = next_line - line; if (strip_suffix_mem(line, &len, " (fetch)")) - fprintf(output, " %.*s\n", (int)len, line); + strbuf_addf(msg, " %.*s\n", (int)len, line); line = next_line + 1; } } @@ -3047,19 +3047,27 @@ static int add_submodule(const struct add_data *add_data) if (is_directory(submod_gitdir_path)) { if (!add_data->force) { - fprintf(stderr, _("A git directory for '%s' is found " - "locally with remote(s):"), - add_data->sm_name); - show_fetch_remotes(stderr, submod_gitdir_path); + struct strbuf msg = STRBUF_INIT; + char *die_msg; + + strbuf_addf(&msg, _("A git directory for '%s' is found " + "locally with remote(s):\n"), + add_data->sm_name); + + append_fetch_remotes(&msg, submod_gitdir_path); free(submod_gitdir_path); - die(_("If you want to reuse this local git " - "directory instead of cloning again from\n" - " %s\n" - "use the '--force' option. If the local git " - "directory is not the correct repo\n" - "or if you are unsure what this means, choose " - "another name with the '--name' option.\n"), - add_data->realrepo); + + strbuf_addf(&msg, _("If you want to reuse this local git " + "directory instead of cloning again from\n" + " %s\n" + "use the '--force' option. If the local git " + "directory is not the correct repo\n" + "or you are unsure what this means choose " + "another name with the '--name' option."), + add_data->realrepo); + + die_msg = strbuf_detach(&msg, NULL); + die("%s", die_msg); } else { printf(_("Reactivating local git directory for " "submodule '%s'\n"), add_data->sm_name); @@ -3220,6 +3228,7 @@ static void die_on_index_match(const char *path, int force) } free(ps_matched); } + clear_pathspec(&ps); } static void die_on_repo_without_commits(const char *path) @@ -3231,6 +3240,7 @@ static void die_on_repo_without_commits(const char *path) if (resolve_gitlink_ref(path, "HEAD", &oid) < 0) die(_("'%s' does not have a commit checked out"), path); } + strbuf_release(&sb); } static int module_add(int argc, const char **argv, const char *prefix) diff --git a/builtin/tag.c b/builtin/tag.c index 6535ed27ee..6fe646710d 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -432,7 +432,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) int annotate = 0, force = 0; int cmdmode = 0, create_tag_object = 0; const char *msgfile = NULL, *keyid = NULL; - struct msg_arg msg = { 0, STRBUF_INIT }; + struct msg_arg msg = { .buf = STRBUF_INIT }; struct ref_transaction *transaction; struct strbuf err = STRBUF_INIT; struct ref_filter filter; @@ -482,6 +482,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) OPT_BOOL('i', "ignore-case", &icase, N_("sorting and filtering are case insensitive")), OPT_END() }; + int ret = 0; setup_ref_filter_porcelain_msg(); @@ -529,7 +530,6 @@ int cmd_tag(int argc, const char **argv, const char *prefix) ref_sorting_set_sort_flags_all(sorting, REF_SORTING_ICASE, icase); filter.ignore_case = icase; if (cmdmode == 'l') { - int ret; if (column_active(colopts)) { struct column_options copts; memset(&copts, 0, sizeof(copts)); @@ -540,7 +540,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) ret = list_tags(&filter, sorting, &format); if (column_active(colopts)) stop_column_filter(); - return ret; + goto cleanup; } if (filter.lines != -1) die(_("-n option is only allowed in list mode")); @@ -552,12 +552,15 @@ int cmd_tag(int argc, const char **argv, const char *prefix) die(_("--points-at option is only allowed in list mode")); if (filter.reachable_from || filter.unreachable_from) die(_("--merged and --no-merged options are only allowed in list mode")); - if (cmdmode == 'd') - return delete_tags(argv); + if (cmdmode == 'd') { + ret = delete_tags(argv); + goto cleanup; + } if (cmdmode == 'v') { if (format.format && verify_ref_format(&format)) usage_with_options(git_tag_usage, options); - return for_each_tag_name(argv, verify_tag, &format); + ret = for_each_tag_name(argv, verify_tag, &format); + goto cleanup; } if (msg.given || msgfile) { @@ -626,10 +629,12 @@ int cmd_tag(int argc, const char **argv, const char *prefix) printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(&prev, DEFAULT_ABBREV)); - UNLEAK(buf); - UNLEAK(ref); - UNLEAK(reflog_msg); - UNLEAK(msg); - UNLEAK(err); - return 0; +cleanup: + ref_sorting_release(sorting); + strbuf_release(&buf); + strbuf_release(&ref); + strbuf_release(&reflog_msg); + strbuf_release(&msg.buf); + strbuf_release(&err); + return ret; } diff --git a/command-list.txt b/command-list.txt index a289f09ed6..eb9cee8dee 100644 --- a/command-list.txt +++ b/command-list.txt @@ -168,7 +168,7 @@ git-show-index plumbinginterrogators git-show-ref plumbinginterrogators git-sh-i18n purehelpers git-sh-setup purehelpers -git-sparse-checkout mainporcelain worktree +git-sparse-checkout mainporcelain git-stash mainporcelain git-stage complete git-status mainporcelain info @@ -148,8 +148,10 @@ static int handle_path_include(const char *path, struct config_include_data *inc if (!is_absolute_path(path)) { char *slash; - if (!cf || !cf->path) - return error(_("relative config includes must come from files")); + if (!cf || !cf->path) { + ret = error(_("relative config includes must come from files")); + goto cleanup; + } slash = find_last_dir_sep(cf->path); if (slash) @@ -167,6 +169,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc ret = git_config_from_file(git_config_include, path, inc); inc->depth--; } +cleanup: strbuf_release(&buf); free(expanded); return ret; diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh index e3d9f4836d..a15c0620db 100644 --- a/git-sh-i18n.sh +++ b/git-sh-i18n.sh @@ -51,12 +51,6 @@ gettext_without_eval_gettext) ) } - eval_ngettext () { - ngettext "$1" "$2" "$3" | ( - export PATH $(git sh-i18n--envsubst --variables "$2"); - git sh-i18n--envsubst "$2" - ) - } ;; *) gettext () { @@ -70,12 +64,6 @@ gettext_without_eval_gettext) ) } - eval_ngettext () { - (test "$3" = 1 && printf "%s" "$1" || printf "%s" "$2") | ( - export PATH $(git sh-i18n--envsubst --variables "$2"); - git sh-i18n--envsubst "$2" - ) - } ;; esac diff --git a/git-sh-setup.sh b/git-sh-setup.sh index cee053cdc3..960982f9d5 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -217,9 +217,6 @@ require_clean_work_tree () { then action=$1 case "$action" in - rebase) - gettextln "Cannot rebase: You have unstaged changes." >&2 - ;; "rewrite branches") gettextln "Cannot rewrite branches: You have unstaged changes." >&2 ;; @@ -235,14 +232,7 @@ require_clean_work_tree () { if test $err = 0 then action=$1 - case "$action" in - rebase) - gettextln "Cannot rebase: Your index contains uncommitted changes." >&2 - ;; - *) - eval_gettextln "Cannot \$action: Your index contains uncommitted changes." >&2 - ;; - esac + eval_gettextln "Cannot \$action: Your index contains uncommitted changes." >&2 else gettextln "Additionally, your index contains uncommitted changes." >&2 fi @@ -671,11 +671,7 @@ const char *repo_logmsg_reencode(struct repository *r, * If the re-encoding failed, out might be NULL here; in that * case we just return the commit message verbatim. */ - if (!out) { - warning("unable to reencode commit to '%s'", output_encoding); - return msg; - } - return out; + return out ? out : msg; } static int mailmap_name(const char **email, size_t *email_len, diff --git a/ref-filter.c b/ref-filter.c index add429be79..282cdad103 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -2705,6 +2705,15 @@ int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset) return 0; } +void ref_sorting_release(struct ref_sorting *sorting) +{ + while (sorting) { + struct ref_sorting *next = sorting->next; + free(sorting); + sorting = next; + } +} + int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset) { struct ref_filter *rf = opt->value; diff --git a/ref-filter.h b/ref-filter.h index b636f4389d..6228458d30 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -127,6 +127,8 @@ void parse_ref_sorting(struct ref_sorting **sorting_tail, const char *atom); int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset); /* Default sort option based on refname */ struct ref_sorting *ref_default_sorting(void); +/* Release a "struct ref_sorting" */ +void ref_sorting_release(struct ref_sorting *); /* Function to parse --merged and --no-merged options */ int parse_opt_merge_filter(const struct option *opt, const char *arg, int unset); /* Get the current HEAD's description */ diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index d2edfa4c50..782891908d 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -131,6 +131,7 @@ prepare_httpd() { cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH" install_script incomplete-length-upload-pack-v2-http.sh install_script incomplete-body-upload-pack-v2-http.sh + install_script error-no-report.sh install_script broken-smart-http.sh install_script error-smart-http.sh install_script error.sh diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf index 180a41fe96..497b9b9d92 100644 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@ -122,6 +122,7 @@ Alias /auth/dumb/ www/auth/dumb/ </LocationMatch> ScriptAlias /smart/incomplete_length/git-upload-pack incomplete-length-upload-pack-v2-http.sh/ ScriptAlias /smart/incomplete_body/git-upload-pack incomplete-body-upload-pack-v2-http.sh/ +ScriptAlias /smart/no_report/git-receive-pack error-no-report.sh/ ScriptAliasMatch /error_git_upload_pack/(.*)/git-upload-pack error.sh/ ScriptAliasMatch /smart_*[^/]*/(.*) ${GIT_EXEC_PATH}/git-http-backend/$1 ScriptAlias /broken_smart/ broken-smart-http.sh/ @@ -137,6 +138,9 @@ ScriptAliasMatch /one_time_perl/(.*) apply-one-time-perl.sh/$1 <Files incomplete-body-upload-pack-v2-http.sh> Options ExecCGI </Files> +<Files error-no-report.sh> + Options ExecCGI +</Files> <Files broken-smart-http.sh> Options ExecCGI </Files> diff --git a/t/lib-httpd/error-no-report.sh b/t/lib-httpd/error-no-report.sh new file mode 100644 index 0000000000..39ff75bbc4 --- /dev/null +++ b/t/lib-httpd/error-no-report.sh @@ -0,0 +1,6 @@ +echo "Content-Type: application/x-git-receive-pack-result" +echo +printf '0013\001000eunpack ok\n' +printf '0015\002skipping report\n' +printf '0009\0010000' +printf '0000' diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh index ccbb116c01..5cde79ef8c 100755 --- a/t/t1305-config-include.sh +++ b/t/t1305-config-include.sh @@ -1,6 +1,7 @@ #!/bin/sh test_description='test config file include directives' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh # Force setup_explicit_git_dir() to run until the end. This is needed diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh index 0141f36e33..d2dfcf164e 100755 --- a/t/t4210-log-i18n.sh +++ b/t/t4210-log-i18n.sh @@ -131,11 +131,4 @@ do fi done -test_expect_success 'log shows warning when conversion fails' ' - enc=this-encoding-does-not-exist && - git log -1 --encoding=$enc 2>err && - echo "warning: unable to reencode commit to ${SQ}${enc}${SQ}" >expect && - test_cmp expect err -' - test_done diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh index c024fa2818..8ca50f8b18 100755 --- a/t/t5541-http-push-smart.sh +++ b/t/t5541-http-push-smart.sh @@ -509,4 +509,20 @@ test_expect_success 'colorize errors/hints' ' test_i18ngrep ! "^hint: " decoded ' +test_expect_success 'report error server does not provide ref status' ' + git init "$HTTPD_DOCUMENT_ROOT_PATH/no_report" && + git -C "$HTTPD_DOCUMENT_ROOT_PATH/no_report" config http.receivepack true && + test_must_fail git push --porcelain \ + $HTTPD_URL_USER_PASS/smart/no_report \ + HEAD:refs/tags/will-fail >actual && + test_must_fail git -C "$HTTPD_DOCUMENT_ROOT_PATH/no_report" \ + rev-parse --verify refs/tags/will-fail && + cat >expect <<-EOF && + To $HTTPD_URL/smart/no_report + ! HEAD:refs/tags/will-fail [remote failure] (remote failed to report status) + Done + EOF + test_cmp expect actual +' + test_done diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh index a98785da79..1dd07141a7 100755 --- a/t/t7811-grep-open.sh +++ b/t/t7811-grep-open.sh @@ -3,6 +3,7 @@ test_description='git grep --open-files-in-pager ' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-pager.sh unset PAGER GIT_PAGER @@ -114,8 +115,8 @@ test_expect_success 'modified file' ' unrelated EOF + test_when_finished "git reset --hard" && echo "enum grep_pat_token" >unrelated && - test_when_finished "git checkout HEAD unrelated" && GIT_PAGER=./less git grep -F -O "enum grep_pat_token" >out && test_cmp expect actual && test_must_be_empty out diff --git a/t/test-lib.sh b/t/test-lib.sh index a291a5d4a2..2679a7596a 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -589,17 +589,33 @@ USER_TERM="$TERM" TERM=dumb export TERM USER_TERM -error () { - say_color error "error: $*" +_error_exit () { finalize_junit_xml GIT_EXIT_OK=t exit 1 } +error () { + say_color error "error: $*" + _error_exit +} + BUG () { error >&7 "bug in the test script: $*" } +BAIL_OUT () { + test $# -ne 1 && BUG "1 param" + + # Do not change "Bail out! " string. It's part of TAP syntax: + # https://testanything.org/tap-specification.html + local bail_out="Bail out! " + local message="$1" + + say_color error $bail_out "$message" + _error_exit +} + say () { say_color info "$*" } @@ -608,9 +624,7 @@ if test -n "$HARNESS_ACTIVE" then if test "$verbose" = t || test -n "$verbose_only" then - printf 'Bail out! %s\n' \ - 'verbose mode forbidden under TAP harness; try --verbose-log' - exit 1 + BAIL_OUT 'verbose mode forbidden under TAP harness; try --verbose-log' fi fi @@ -720,7 +734,7 @@ test_failure_ () { say_color error "not ok $test_count - $1" shift printf '%s\n' "$*" | sed -e 's/^/# /' - test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; } + test "$immediate" = "" || _error_exit } test_known_broken_ok_ () { @@ -1398,7 +1412,7 @@ then fi elif test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false then - error "GIT_TEST_PASSING_SANITIZE_LEAK=true has no effect except when compiled with SANITIZE=leak" + BAIL_OUT "GIT_TEST_PASSING_SANITIZE_LEAK=true has no effect except when compiled with SANITIZE=leak" fi # Last-minute variable setup diff --git a/transport-helper.c b/transport-helper.c index e8dbdd1153..a0297b0986 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -845,6 +845,10 @@ static int push_update_ref_status(struct strbuf *buf, forced = 1; FREE_AND_NULL(msg); } + else if (!strcmp(msg, "expecting report")) { + status = REF_STATUS_EXPECTING_REPORT; + FREE_AND_NULL(msg); + } } if (state->hint) |