diff options
-rw-r--r-- | .mailmap | 2 | ||||
-rw-r--r-- | Documentation/git-rebase.txt | 6 | ||||
-rw-r--r-- | Documentation/pretty-formats.txt | 2 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | builtin/checkout.c | 19 | ||||
-rw-r--r-- | builtin/rebase.c | 21 | ||||
-rwxr-xr-x | ci/lib.sh | 9 | ||||
-rwxr-xr-x | git-legacy-rebase.sh | 6 | ||||
-rw-r--r-- | remote-curl.c | 100 | ||||
-rwxr-xr-x | t/lib-gpg.sh | 3 | ||||
-rw-r--r-- | t/lib-httpd.sh | 1 | ||||
-rw-r--r-- | t/lib-httpd/apache.conf | 4 | ||||
-rw-r--r-- | t/lib-httpd/error-smart-http.sh | 3 | ||||
-rwxr-xr-x | t/t3418-rebase-continue.sh | 3 | ||||
-rwxr-xr-x | t/t5403-post-checkout-hook.sh | 2 | ||||
-rwxr-xr-x | t/t5551-http-fetch-smart.sh | 5 | ||||
-rwxr-xr-x | t/t9833-errors.sh | 27 |
17 files changed, 98 insertions, 120 deletions
@@ -40,6 +40,8 @@ Cord Seele <cowose@gmail.com> <cowose@googlemail.com> Christian Couder <chriscool@tuxfamily.org> <christian.couder@gmail.com> Christian Stimming <stimming@tuhh.de> <chs@ckiste.goetheallee> Christopher Díaz Riveros <chrisadr@gentoo.org> Christopher Diaz Riveros +Clemens Buchacher <drizzd@gmx.net> <drizzd@aon.at> +Clemens Buchacher <drizzd@gmx.net> <clemens.buchacher@intel.com> Csaba Henk <csaba@gluster.com> <csaba@lowlife.hu> Dan Johnson <computerdruid@gmail.com> Dana L. How <danahow@gmail.com> <how@deathvalley.cswitch.com> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 7e695b30e4..daa16403ec 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -462,12 +462,6 @@ without an explicit `--interactive`. + See also INCOMPATIBLE OPTIONS below. --y <cmd>:: - This is the same as passing `--reschedule-failed-exec` before - `-x <cmd>`, i.e. it appends the specified `exec` command and - turns on the mode where failed `exec` commands are automatically - rescheduled. - --root:: Rebase all commits reachable from <branch>, instead of limiting them with an <upstream>. This allows you to rebase diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt index de6953108c..7bfffae765 100644 --- a/Documentation/pretty-formats.txt +++ b/Documentation/pretty-formats.txt @@ -183,7 +183,7 @@ endif::git-rev-list[] `color.diff`, `color.ui`, or `--color`, and respecting the `auto` settings of the former if we are going to a terminal). `%C(auto,...)` is accepted as a historical synonym for the default (e.g., - `%C(auto,red)`). Specifying `%C(always,...) will show the colors + `%C(auto,red)`). Specifying `%C(always,...)` will show the colors even when color is not otherwise enabled (though consider just using `--color=always` to enable color for the whole output, including this format and anything else git might color). `auto` @@ -3114,6 +3114,11 @@ coverage-test: coverage-clean-results coverage-compile $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \ DEFAULT_TEST_TARGET=test -j1 test +coverage-prove: coverage-clean-results coverage-compile + $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \ + DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$(GIT_PROVE_OPTS) -j1" \ + -j1 test + coverage-report: $(QUIET_GCOV)for dir in $(object_dirs); do \ $(GCOV) $(GCOVFLAGS) --object-directory=$$dir $$dir*.c || exit; \ diff --git a/builtin/checkout.c b/builtin/checkout.c index ece4eb14bf..24b8593b93 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -261,7 +261,7 @@ static int checkout_paths(const struct checkout_opts *opts, struct commit *head; int errs = 0; struct lock_file lock_file = LOCK_INIT; - int nr_checkouts = 0; + int nr_checkouts = 0, nr_unmerged = 0; if (opts->track != BRANCH_TRACK_UNSPECIFIED) die(_("'%s' cannot be used with updating paths"), "--track"); @@ -386,23 +386,28 @@ static int checkout_paths(const struct checkout_opts *opts, &state, &nr_checkouts); else if (opts->merge) errs |= checkout_merged(pos, &state, - &nr_checkouts); + &nr_unmerged); pos = skip_same_name(ce, pos) - 1; } } errs |= finish_delayed_checkout(&state, &nr_checkouts); if (opts->count_checkout_paths) { + if (nr_unmerged) + fprintf_ln(stderr, Q_("Recreated %d merge conflict", + "Recreated %d merge conflicts", + nr_unmerged), + nr_unmerged); if (opts->source_tree) - fprintf_ln(stderr, Q_("Checked out %d path out of %s", - "Checked out %d paths out of %s", + fprintf_ln(stderr, Q_("Updated %d path from %s", + "Updated %d paths from %s", nr_checkouts), nr_checkouts, find_unique_abbrev(&opts->source_tree->object.oid, DEFAULT_ABBREV)); - else - fprintf_ln(stderr, Q_("Checked out %d path out of the index", - "Checked out %d paths out of the index", + else if (!nr_unmerged || nr_checkouts) + fprintf_ln(stderr, Q_("Updated %d path from the index", + "Updated %d paths from the index", nr_checkouts), nr_checkouts); } diff --git a/builtin/rebase.c b/builtin/rebase.c index b9d61771ab..96efd40901 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -941,23 +941,6 @@ static int parse_opt_interactive(const struct option *opt, const char *arg, return 0; } -struct opt_y { - struct string_list *list; - struct rebase_options *options; -}; - -static int parse_opt_y(const struct option *opt, const char *arg, int unset) -{ - struct opt_y *o = opt->value; - - if (unset || !arg) - return -1; - - o->options->reschedule_failed_exec = 1; - string_list_append(o->list, arg); - return 0; -} - static void NORETURN error_on_missing_default_upstream(void) { struct branch *current_branch = branch_get(NULL); @@ -1051,7 +1034,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) struct string_list strategy_options = STRING_LIST_INIT_NODUP; struct object_id squash_onto; char *squash_onto_name = NULL; - struct opt_y opt_y = { .list = &exec, .options = &options }; struct option builtin_rebase_options[] = { OPT_STRING(0, "onto", &options.onto_name, N_("revision"), @@ -1129,9 +1111,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) OPT_STRING_LIST('x', "exec", &exec, N_("exec"), N_("add exec lines after each commit of the " "editable list")), - { OPTION_CALLBACK, 'y', NULL, &opt_y, N_("<cmd>"), - N_("same as --reschedule-failed-exec -x <cmd>"), - PARSE_OPT_NONEG, parse_opt_y }, OPT_BOOL(0, "allow-empty-message", &options.allow_empty_message, N_("allow rebasing commits with empty messages")), @@ -74,6 +74,9 @@ check_unignored_build_artifacts () } } +# Clear MAKEFLAGS that may come from the outside world. +export MAKEFLAGS= + # Set 'exit on error' for all CI scripts to let the caller know that # something went wrong. # Set tracing executed commands, primarily setting environment variables @@ -101,7 +104,7 @@ then BREW_INSTALL_PACKAGES="git-lfs gettext" export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --immediate" - export MAKEFLAGS="--jobs=2" + MAKEFLAGS="$MAKEFLAGS --jobs=2" elif test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI" then CI_TYPE=azure-pipelines @@ -126,7 +129,7 @@ then BREW_INSTALL_PACKAGES=gcc@8 export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save" export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml" - export MAKEFLAGS="--jobs=10" + MAKEFLAGS="$MAKEFLAGS --jobs=10" test windows_nt != "$CI_OS_NAME" || GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS" else @@ -185,4 +188,4 @@ GIT_TEST_GETTEXT_POISON) ;; esac -export MAKEFLAGS="CC=${CC:-cc}" +MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh index 8d6c9aca65..5c2c4e5276 100755 --- a/git-legacy-rebase.sh +++ b/git-legacy-rebase.sh @@ -26,7 +26,6 @@ f,force-rebase! cherry-pick all commits, even if unchanged m,merge! use merging strategies to rebase i,interactive! let the user edit the list of commits to rebase x,exec=! add exec lines after each commit of the editable list -y=! same as --reschedule-failed-exec -x k,keep-empty preserve empty commits during rebase allow-empty-message allow rebasing commits with empty messages stat! display a diffstat of what changed upstream @@ -261,11 +260,6 @@ do cmd="${cmd}exec ${1#--exec=}${LF}" test -z "$interactive_rebase" && interactive_rebase=implied ;; - -y*) - reschedule_failed_exec=--reschedule-failed-exec - cmd="${cmd}exec ${1#-y}${LF}" - test -z "$interactive_rebase" && interactive_rebase=implied - ;; --interactive) interactive_rebase=explicit ;; diff --git a/remote-curl.c b/remote-curl.c index 2e04d53ac8..bb7421023b 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -331,9 +331,63 @@ static int get_protocol_http_header(enum protocol_version version, return 0; } +static void check_smart_http(struct discovery *d, const char *service, + struct strbuf *type) +{ + const char *p; + struct packet_reader reader; + + /* + * If we don't see x-$service-advertisement, then it's not smart-http. + * But once we do, we commit to it and assume any other protocol + * violations are hard errors. + */ + if (!skip_prefix(type->buf, "application/x-", &p) || + !skip_prefix(p, service, &p) || + strcmp(p, "-advertisement")) + return; + + packet_reader_init(&reader, -1, d->buf, d->len, + PACKET_READ_CHOMP_NEWLINE | + PACKET_READ_DIE_ON_ERR_PACKET); + if (packet_reader_read(&reader) != PACKET_READ_NORMAL) + die("invalid server response; expected service, got flush packet"); + + if (skip_prefix(reader.line, "# service=", &p) && !strcmp(p, service)) { + /* + * The header can include additional metadata lines, up + * until a packet flush marker. Ignore these now, but + * in the future we might start to scan them. + */ + for (;;) { + packet_reader_read(&reader); + if (reader.pktlen <= 0) { + break; + } + } + + /* + * v0 smart http; callers expect us to soak up the + * service and header packets + */ + d->buf = reader.src_buffer; + d->len = reader.src_len; + d->proto_git = 1; + + } else if (!strcmp(reader.line, "version 2")) { + /* + * v2 smart http; do not consume version packet, which will + * be handled elsewhere. + */ + d->proto_git = 1; + + } else { + die("invalid server response; got '%s'", reader.line); + } +} + static struct discovery *discover_refs(const char *service, int for_push) { - struct strbuf exp = STRBUF_INIT; struct strbuf type = STRBUF_INIT; struct strbuf charset = STRBUF_INIT; struct strbuf buffer = STRBUF_INIT; @@ -405,47 +459,8 @@ static struct discovery *discover_refs(const char *service, int for_push) last->buf_alloc = strbuf_detach(&buffer, &last->len); last->buf = last->buf_alloc; - strbuf_addf(&exp, "application/x-%s-advertisement", service); - if (maybe_smart && - (5 <= last->len && last->buf[4] == '#') && - !strbuf_cmp(&exp, &type)) { - struct packet_reader reader; - packet_reader_init(&reader, -1, last->buf, last->len, - PACKET_READ_CHOMP_NEWLINE | - PACKET_READ_DIE_ON_ERR_PACKET); - - /* - * smart HTTP response; validate that the service - * pkt-line matches our request. - */ - if (packet_reader_read(&reader) != PACKET_READ_NORMAL) - die("invalid server response; expected service, got flush packet"); - - strbuf_reset(&exp); - strbuf_addf(&exp, "# service=%s", service); - if (strcmp(reader.line, exp.buf)) - die("invalid server response; got '%s'", reader.line); - strbuf_release(&exp); - - /* The header can include additional metadata lines, up - * until a packet flush marker. Ignore these now, but - * in the future we might start to scan them. - */ - for (;;) { - packet_reader_read(&reader); - if (reader.pktlen <= 0) { - break; - } - } - - last->buf = reader.src_buffer; - last->len = reader.src_len; - - last->proto_git = 1; - } else if (maybe_smart && - last->len > 5 && starts_with(last->buf + 4, "version 2")) { - last->proto_git = 1; - } + if (maybe_smart) + check_smart_http(last, service, &type); if (last->proto_git) last->refs = parse_git_refs(last, for_push); @@ -453,7 +468,6 @@ static struct discovery *discover_refs(const char *service, int for_push) last->refs = parse_info_refs(last); strbuf_release(&refs_url); - strbuf_release(&exp); strbuf_release(&type); strbuf_release(&charset); strbuf_release(&effective_url); diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index f1277bef4f..8d28652b72 100755 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -63,8 +63,7 @@ then cut -d" " -f4 | tr -d '\n' >"${GNUPGHOME}/trustlist.txt" && - echo " S relax" >> ${GNUPGHOME}/trustlist.txt && - (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) && + echo " S relax" >>"${GNUPGHOME}/trustlist.txt" && echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \ -u committer@example.com -o /dev/null --sign - 2>&1 && test_set_prereq GPGSM diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index e465116ef9..216281eabc 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -131,6 +131,7 @@ prepare_httpd() { mkdir -p "$HTTPD_DOCUMENT_ROOT_PATH" cp "$TEST_PATH"/passwd "$HTTPD_ROOT_PATH" install_script broken-smart-http.sh + install_script error-smart-http.sh install_script error.sh install_script apply-one-time-sed.sh diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf index 5d63ed90c5..06a81b54c7 100644 --- a/t/lib-httpd/apache.conf +++ b/t/lib-httpd/apache.conf @@ -119,6 +119,7 @@ Alias /auth/dumb/ www/auth/dumb/ 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/ +ScriptAlias /error_smart/ error-smart-http.sh/ ScriptAlias /error/ error.sh/ ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1 <Directory ${GIT_EXEC_PATH}> @@ -127,6 +128,9 @@ ScriptAliasMatch /one_time_sed/(.*) apply-one-time-sed.sh/$1 <Files broken-smart-http.sh> Options ExecCGI </Files> +<Files error-smart-http.sh> + Options ExecCGI +</Files> <Files error.sh> Options ExecCGI </Files> diff --git a/t/lib-httpd/error-smart-http.sh b/t/lib-httpd/error-smart-http.sh new file mode 100644 index 0000000000..e65d447fc4 --- /dev/null +++ b/t/lib-httpd/error-smart-http.sh @@ -0,0 +1,3 @@ +echo "Content-Type: application/x-git-upload-pack-advertisement" +echo +printf "%s" "0019ERR server-side error" diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh index 25aaacacfc..bdaa511bb0 100755 --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@ -262,9 +262,6 @@ test_expect_success '--reschedule-failed-exec' ' test_must_fail git -c rebase.rescheduleFailedExec=true \ rebase -x false HEAD^ 2>err && grep "^exec false" .git/rebase-merge/git-rebase-todo && - test_i18ngrep "has been rescheduled" err && - git rebase --abort && - test_must_fail git rebase -y false HEAD^ 2>err && test_i18ngrep "has been rescheduled" err ' diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh index a539ffc080..a39b3b5c78 100755 --- a/t/t5403-post-checkout-hook.sh +++ b/t/t5403-post-checkout-hook.sh @@ -67,7 +67,7 @@ test_expect_success 'post-checkout is triggered on rebase with fast-forward' ' test_expect_success 'post-checkout hook is triggered by clone' ' mkdir -p templates/hooks && write_script templates/hooks/post-checkout <<-\EOF && - echo "$@" >$GIT_DIR/post-checkout.args + echo "$@" >"$GIT_DIR/post-checkout.args" EOF git clone --template=templates . clone3 && test -f clone3/.git/post-checkout.args diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh index 8630b0cc39..ba83e567e5 100755 --- a/t/t5551-http-fetch-smart.sh +++ b/t/t5551-http-fetch-smart.sh @@ -429,5 +429,10 @@ test_expect_success 'GIT_TRACE_CURL_NO_DATA prevents data from being traced' ' ! grep "=> Send data" err ' +test_expect_success 'server-side error detected' ' + test_must_fail git clone $HTTPD_URL/error_smart/repo.git 2>actual && + grep "server-side error" actual +' + stop_httpd test_done diff --git a/t/t9833-errors.sh b/t/t9833-errors.sh index 277d347012..47b312e1c9 100755 --- a/t/t9833-errors.sh +++ b/t/t9833-errors.sh @@ -45,33 +45,6 @@ test_expect_success 'ticket logged out' ' ) ' -test_expect_success 'create group with short ticket expiry' ' - P4TICKETS="$cli/tickets" && - echo "newpassword" | p4 login && - p4_add_user short_expiry_user && - p4 -u short_expiry_user passwd -P password && - p4 group -i <<-EOF && - Group: testgroup - Timeout: 3 - Users: short_expiry_user - EOF - - p4 users | grep short_expiry_user -' - -test_expect_success 'git operation with expired ticket' ' - P4TICKETS="$cli/tickets" && - P4USER=short_expiry_user && - echo "password" | p4 login && - ( - cd "$git" && - git p4 sync && - sleep 5 && - test_must_fail git p4 sync 2>errmsg && - grep "failure accessing depot" errmsg - ) -' - test_expect_success 'kill p4d' ' kill_p4d ' |