From: Junio C Hamano Date: Mon, 13 Feb 2012 19:42:07 +0000 (-0800) Subject: Merge branch 'jc/branch-desc-typoavoidance' into maint X-Git-Tag: v1.7.9.1~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8eb865ba8a24aad5380a23fc1e331aba2f7c5bbb;hp=c2d17ba3db0d2b14daf04e69a8c5ec73b023c1fe;p=git.git Merge branch 'jc/branch-desc-typoavoidance' into maint * jc/branch-desc-typoavoidance: branch --edit-description: protect against mistyped branch name tests: add write_script helper function --- diff --git a/Documentation/RelNotes/1.7.9.1.txt b/Documentation/RelNotes/1.7.9.1.txt new file mode 100644 index 000000000..a6c15e5d5 --- /dev/null +++ b/Documentation/RelNotes/1.7.9.1.txt @@ -0,0 +1,36 @@ +Git v1.7.9.1 Release Notes +========================== + +Fixes since v1.7.9 +------------------ + + * Subprocesses spawned from various git programs were often left running + to completion even when the top-level process was killed. + + * Using "git grep -l/-L" together with options -W or --break may not + make much sense as the output is to only count the number of hits + and there is no place for file breaks, but the latter options made + "-l/-L" to miscount the hits. + + * "git log --first-parent $pathspec" did not stay on the first parent + chain and veered into side branch from which the whole change to the + specified paths came. + + * "git push -q" was not sufficiently quiet. + + * When "git push" fails to update any refs, the client side did not + report an error correctly to the end user. + + * "git mergetool" now gives an empty file as the common base version + to the backend when dealing with the "both sides added, differently" + case. + + * When asking for a tag to be pulled, "request-pull" did not show the + name of the tag prefixed with "tags/", which would have helped older + clients. + + * "git submodule add $path" forgot to recompute the name to be stored + in .gitmodules when the submodule at $path was once added to the + superproject and already initialized. + +Also contains minor fixes and documentation updates. diff --git a/Documentation/git.txt b/Documentation/git.txt index c99143064..f7e201fae 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -69,9 +69,10 @@ Documentation for older releases are available here: link:RelNotes/1.7.7.1.txt[1.7.7.1], link:RelNotes/1.7.7.txt[1.7.7]. -* link:v1.7.6.5/git.html[documentation for release 1.7.6.5] +* link:v1.7.6.6/git.html[documentation for release 1.7.6.6] * release notes for + link:RelNotes/1.7.6.6.txt[1.7.6.6], link:RelNotes/1.7.6.5.txt[1.7.6.5], link:RelNotes/1.7.6.4.txt[1.7.6.4], link:RelNotes/1.7.6.3.txt[1.7.6.3], diff --git a/Documentation/howto/using-signed-tag-in-pull-request.txt b/Documentation/howto/using-signed-tag-in-pull-request.txt index a1351c5bb..98c0033a5 100644 --- a/Documentation/howto/using-signed-tag-in-pull-request.txt +++ b/Documentation/howto/using-signed-tag-in-pull-request.txt @@ -109,7 +109,7 @@ The resulting msg.txt file begins like so: are available in the git repository at: - example.com:/git/froboz.git frotz-for-xyzzy + example.com:/git/froboz.git tags/frotz-for-xyzzy for you to fetch changes up to 703f05ad5835c...: @@ -141,7 +141,7 @@ After receiving such a pull request message, the integrator fetches and integrates the tag named in the request, with: ------------ - $ git pull example.com:/git/froboz.git/ frotz-for-xyzzy + $ git pull example.com:/git/froboz.git/ tags/frotz-for-xyzzy ------------ This operation will always open an editor to allow the integrator to fine diff --git a/Makefile b/Makefile index a78240930..b5530cbaa 100644 --- a/Makefile +++ b/Makefile @@ -339,7 +339,7 @@ pathsep = : export prefix bindir sharedir sysconfdir gitwebdir localedir -CC = gcc +CC = cc AR = ar RM = rm -f DIFF = diff diff --git a/RelNotes b/RelNotes index 766bbaf8f..d69b2c37a 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes/1.7.9.txt \ No newline at end of file +Documentation/RelNotes/1.7.9.1.txt \ No newline at end of file diff --git a/builtin/grep.c b/builtin/grep.c index 9ce064ac1..5c2ae94e5 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -1034,8 +1034,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix) #ifndef NO_PTHREADS if (use_threads) { - if (opt.pre_context || opt.post_context || opt.file_break || - opt.funcbody) + if (!(opt.name_only || opt.unmatch_name_only || opt.count) + && (opt.pre_context || opt.post_context || + opt.file_break || opt.funcbody)) skip_first_line = 1; start_threads(&opt); } diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 8c9e91e78..fa7448be5 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -33,6 +33,7 @@ static int transfer_unpack_limit = -1; static int unpack_limit = 100; static int report_status; static int use_sideband; +static int quiet; static int prefer_ofs_delta = 1; static int auto_update_server_info; static int auto_gc = 1; @@ -122,7 +123,7 @@ static void show_ref(const char *path, const unsigned char *sha1) else packet_write(1, "%s %s%c%s%s\n", sha1_to_hex(sha1), path, 0, - " report-status delete-refs side-band-64k", + " report-status delete-refs side-band-64k quiet", prefer_ofs_delta ? " ofs-delta" : ""); sent_capabilities = 1; } @@ -748,10 +749,13 @@ static struct command *read_head_info(void) refname = line + 82; reflen = strlen(refname); if (reflen + 82 < len) { - if (strstr(refname + reflen + 1, "report-status")) + const char *feature_list = refname + reflen + 1; + if (parse_feature_request(feature_list, "report-status")) report_status = 1; - if (strstr(refname + reflen + 1, "side-band-64k")) + if (parse_feature_request(feature_list, "side-band-64k")) use_sideband = LARGE_PACKET_MAX; + if (parse_feature_request(feature_list, "quiet")) + quiet = 1; } cmd = xcalloc(1, sizeof(struct command) + len - 80); hashcpy(cmd->old_sha1, old_sha1); @@ -805,8 +809,10 @@ static const char *unpack(void) if (ntohl(hdr.hdr_entries) < unpack_limit) { int code, i = 0; - const char *unpacker[4]; + const char *unpacker[5]; unpacker[i++] = "unpack-objects"; + if (quiet) + unpacker[i++] = "-q"; if (fsck_objects) unpacker[i++] = "--strict"; unpacker[i++] = hdr_arg; @@ -901,6 +907,11 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) const char *arg = *argv++; if (*arg == '-') { + if (!strcmp(arg, "--quiet")) { + quiet = 1; + continue; + } + if (!strcmp(arg, "--advertise-refs")) { advertise_refs = 1; continue; diff --git a/builtin/send-pack.c b/builtin/send-pack.c index cd1115ffc..71f258ef6 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -263,6 +263,8 @@ int send_pack(struct send_pack_args *args, args->use_ofs_delta = 1; if (server_supports("side-band-64k")) use_sideband = 1; + if (!server_supports("quiet")) + args->quiet = 0; if (!remote_refs) { fprintf(stderr, "No refs in common and none specified; doing nothing.\n" @@ -301,11 +303,12 @@ int send_pack(struct send_pack_args *args, char *old_hex = sha1_to_hex(ref->old_sha1); char *new_hex = sha1_to_hex(ref->new_sha1); - if (!cmds_sent && (status_report || use_sideband)) { - packet_buf_write(&req_buf, "%s %s %s%c%s%s", + if (!cmds_sent && (status_report || use_sideband || args->quiet)) { + packet_buf_write(&req_buf, "%s %s %s%c%s%s%s", old_hex, new_hex, ref->name, 0, status_report ? " report-status" : "", - use_sideband ? " side-band-64k" : ""); + use_sideband ? " side-band-64k" : "", + args->quiet ? " quiet" : ""); } else packet_buf_write(&req_buf, "%s %s %s", @@ -439,6 +442,10 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) args.force_update = 1; continue; } + if (!strcmp(arg, "--quiet")) { + args.quiet = 1; + continue; + } if (!strcmp(arg, "--verbose")) { args.verbose = 1; continue; diff --git a/cache.h b/cache.h index 10afd71d4..9bd8c2d06 100644 --- a/cache.h +++ b/cache.h @@ -1037,6 +1037,7 @@ struct extra_have_objects { }; extern struct ref **get_remote_heads(int in, struct ref **list, unsigned int flags, struct extra_have_objects *); extern int server_supports(const char *feature); +extern const char *parse_feature_request(const char *features, const char *feature); extern struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path); diff --git a/connect.c b/connect.c index 2ea5c3c0f..912cddeea 100644 --- a/connect.c +++ b/connect.c @@ -101,8 +101,27 @@ struct ref **get_remote_heads(int in, struct ref **list, int server_supports(const char *feature) { - return server_capabilities && - strstr(server_capabilities, feature) != NULL; + return !!parse_feature_request(server_capabilities, feature); +} + +const char *parse_feature_request(const char *feature_list, const char *feature) +{ + int len; + + if (!feature_list) + return NULL; + + len = strlen(feature); + while (*feature_list) { + const char *found = strstr(feature_list, feature); + if (!found) + return NULL; + if ((feature_list == found || isspace(found[-1])) && + (!found[len] || isspace(found[len]) || found[len] == '=')) + return found; + feature_list = found + 1; + } + return NULL; } enum protocol { diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1496c6dc0..78be19583 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1622,7 +1622,7 @@ _git_log () __git_merge_options=" --no-commit --no-stat --log --no-log --squash --strategy - --commit --stat --no-squash --ff --no-ff --ff-only + --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit " _git_merge () diff --git a/git-mergetool.sh b/git-mergetool.sh index 085e213a1..a9f23f7fc 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -181,10 +181,14 @@ stage_submodule () { } checkout_staged_file () { - tmpfile=$(expr "$(git checkout-index --temp --stage="$1" "$2")" : '\([^ ]*\) ') + tmpfile=$(expr \ + "$(git checkout-index --temp --stage="$1" "$2" 2>/dev/null)" \ + : '\([^ ]*\) ') if test $? -eq 0 -a -n "$tmpfile" ; then mv -- "$(git rev-parse --show-cdup)$tmpfile" "$3" + else + >"$3" fi } @@ -224,9 +228,9 @@ merge_file () { mv -- "$MERGED" "$BACKUP" cp -- "$BACKUP" "$MERGED" - base_present && checkout_staged_file 1 "$MERGED" "$BASE" - local_present && checkout_staged_file 2 "$MERGED" "$LOCAL" - remote_present && checkout_staged_file 3 "$MERGED" "$REMOTE" + checkout_staged_file 1 "$MERGED" "$BASE" + checkout_staged_file 2 "$MERGED" "$LOCAL" + checkout_staged_file 3 "$MERGED" "$REMOTE" if test -z "$local_mode" -o -z "$remote_mode"; then echo "Deleted merge conflict for '$MERGED':" diff --git a/git-request-pull.sh b/git-request-pull.sh index 64960d65a..e6438e24c 100755 --- a/git-request-pull.sh +++ b/git-request-pull.sh @@ -63,7 +63,7 @@ die "fatal: No commits in common between $base and $head" find_matching_ref=' sub abbr { my $ref = shift; - if ($ref =~ s|refs/heads/|| || $ref =~ s|refs/tags/||) { + if ($ref =~ s|^refs/heads/|| || $ref =~ s|^refs/tags/|tags/|) { return $ref; } else { return $ref; diff --git a/git-submodule.sh b/git-submodule.sh index 3adab9363..9bb2e13e9 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -131,6 +131,7 @@ module_clone() gitdir= gitdir_base= name=$(module_name "$path" 2>/dev/null) + test -n "$name" || name="$path" base_path=$(dirname "$path") gitdir=$(git rev-parse --git-dir) diff --git a/git.c b/git.c index fb9029cbf..380561663 100644 --- a/git.c +++ b/git.c @@ -495,7 +495,7 @@ static void execv_dashed_external(const char **argv) * if we fail because the command is not found, it is * OK to return. Otherwise, we just pass along the status code. */ - status = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE); + status = run_command_v_opt(argv, RUN_SILENT_EXEC_FAILURE | RUN_CLEAN_ON_EXIT); if (status >= 0 || errno != ENOENT) exit(status); diff --git a/git.spec.in b/git.spec.in index c562c6228..b93df109c 100644 --- a/git.spec.in +++ b/git.spec.in @@ -134,6 +134,7 @@ find $RPM_BUILD_ROOT -type f -name perllocal.pod -exec rm -f {} ';' %else rm -rf $RPM_BUILD_ROOT%{_mandir} %endif +rm -rf $RPM_BUILD_ROOT%{_datadir}/locale mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d install -m 644 -T contrib/completion/git-completion.bash $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/git diff --git a/imap-send.c b/imap-send.c index e40125a22..972ad62cd 100644 --- a/imap-send.c +++ b/imap-send.c @@ -42,28 +42,6 @@ struct store_conf { unsigned trash_remote_new:1, trash_only_new:1; }; -struct string_list { - struct string_list *next; - char string[1]; -}; - -struct channel_conf { - struct channel_conf *next; - char *name; - struct store_conf *master, *slave; - char *master_name, *slave_name; - char *sync_state; - struct string_list *patterns; - int mops, sops; - unsigned max_messages; /* for slave only */ -}; - -struct group_conf { - struct group_conf *next; - char *name; - struct string_list *channels; -}; - /* For message->status */ #define M_RECENT (1<<0) /* unsyncable flag; maildir_* depend on this being 1<<0 */ #define M_DEAD (1<<1) /* expunged */ @@ -71,7 +49,6 @@ struct group_conf { struct message { struct message *next; - /* struct string_list *keywords; */ size_t size; /* zero implies "not fetched" */ int uid; unsigned char flags, status; diff --git a/remote-curl.c b/remote-curl.c index 48c20b86f..d159fe7f3 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -770,7 +770,9 @@ static int push_git(struct discovery *heads, int nr_spec, char **specs) argv[argc++] = "--thin"; if (options.dry_run) argv[argc++] = "--dry-run"; - if (options.verbosity > 1) + if (options.verbosity == 0) + argv[argc++] = "--quiet"; + else if (options.verbosity > 1) argv[argc++] = "--verbose"; argv[argc++] = url; for (i = 0; i < nr_spec; i++) @@ -805,7 +807,7 @@ static int push(int nr_spec, char **specs) static void parse_push(struct strbuf *buf) { char **specs = NULL; - int alloc_spec = 0, nr_spec = 0, i; + int alloc_spec = 0, nr_spec = 0, i, ret; do { if (!prefixcmp(buf->buf, "push ")) { @@ -822,12 +824,13 @@ static void parse_push(struct strbuf *buf) break; } while (1); - if (push(nr_spec, specs)) - exit(128); /* error already reported */ - + ret = push(nr_spec, specs); printf("\n"); fflush(stdout); + if (ret) + exit(128); /* error already reported */ + free_specs: for (i = 0; i < nr_spec; i++) free(specs[i]); diff --git a/revision.c b/revision.c index 064e35108..eb0be4206 100644 --- a/revision.c +++ b/revision.c @@ -416,7 +416,7 @@ static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit) static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) { struct commit_list **pp, *parent; - int tree_changed = 0, tree_same = 0; + int tree_changed = 0, tree_same = 0, nth_parent = 0; /* * If we don't do pruning, everything is interesting @@ -444,6 +444,14 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) while ((parent = *pp) != NULL) { struct commit *p = parent->item; + /* + * Do not compare with later parents when we care only about + * the first parent chain, in order to avoid derailing the + * traversal to follow a side branch that brought everything + * in the path we are limited to by the pathspec. + */ + if (revs->first_parent_only && nth_parent++) + break; if (parse_commit(p) < 0) die("cannot simplify commit %s (because of %s)", sha1_to_hex(commit->object.sha1), diff --git a/run-command.c b/run-command.c index 1c5104388..1db8abf98 100644 --- a/run-command.c +++ b/run-command.c @@ -1,8 +1,66 @@ #include "cache.h" #include "run-command.h" #include "exec_cmd.h" +#include "sigchain.h" #include "argv-array.h" +struct child_to_clean { + pid_t pid; + struct child_to_clean *next; +}; +static struct child_to_clean *children_to_clean; +static int installed_child_cleanup_handler; + +static void cleanup_children(int sig) +{ + while (children_to_clean) { + struct child_to_clean *p = children_to_clean; + children_to_clean = p->next; + kill(p->pid, sig); + free(p); + } +} + +static void cleanup_children_on_signal(int sig) +{ + cleanup_children(sig); + sigchain_pop(sig); + raise(sig); +} + +static void cleanup_children_on_exit(void) +{ + cleanup_children(SIGTERM); +} + +static void mark_child_for_cleanup(pid_t pid) +{ + struct child_to_clean *p = xmalloc(sizeof(*p)); + p->pid = pid; + p->next = children_to_clean; + children_to_clean = p; + + if (!installed_child_cleanup_handler) { + atexit(cleanup_children_on_exit); + sigchain_push_common(cleanup_children_on_signal); + installed_child_cleanup_handler = 1; + } +} + +static void clear_child_for_cleanup(pid_t pid) +{ + struct child_to_clean **last, *p; + + last = &children_to_clean; + for (p = children_to_clean; p; p = p->next) { + if (p->pid == pid) { + *last = p->next; + free(p); + return; + } + } +} + static inline void close_pair(int fd[2]) { close(fd[0]); @@ -130,6 +188,9 @@ static int wait_or_whine(pid_t pid, const char *argv0, int silent_exec_failure) } else { error("waitpid is confused (%s)", argv0); } + + clear_child_for_cleanup(pid); + errno = failed_errno; return code; } @@ -292,6 +353,8 @@ fail_pipe: if (cmd->pid < 0) error("cannot fork() for %s: %s", cmd->argv[0], strerror(failed_errno = errno)); + else if (cmd->clean_on_exit) + mark_child_for_cleanup(cmd->pid); /* * Wait for child's execvp. If the execvp succeeds (or if fork() @@ -312,6 +375,7 @@ fail_pipe: cmd->pid = -1; } close(notify_pipe[0]); + } #else { @@ -356,6 +420,8 @@ fail_pipe: failed_errno = errno; if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT)) error("cannot spawn %s: %s", cmd->argv[0], strerror(errno)); + if (cmd->clean_on_exit && cmd->pid >= 0) + mark_child_for_cleanup(cmd->pid); if (cmd->env) free_environ(env); @@ -431,6 +497,7 @@ static void prepare_run_command_v_opt(struct child_process *cmd, cmd->stdout_to_stderr = opt & RUN_COMMAND_STDOUT_TO_STDERR ? 1 : 0; cmd->silent_exec_failure = opt & RUN_SILENT_EXEC_FAILURE ? 1 : 0; cmd->use_shell = opt & RUN_USING_SHELL ? 1 : 0; + cmd->clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0; } int run_command_v_opt(const char **argv, int opt) @@ -540,6 +607,8 @@ int start_async(struct async *async) exit(!!async->proc(proc_in, proc_out, async->data)); } + mark_child_for_cleanup(async->pid); + if (need_in) close(fdin[0]); else if (async->in) diff --git a/run-command.h b/run-command.h index 56491b9f2..44f7d2bd4 100644 --- a/run-command.h +++ b/run-command.h @@ -38,6 +38,7 @@ struct child_process { unsigned silent_exec_failure:1; unsigned stdout_to_stderr:1; unsigned use_shell:1; + unsigned clean_on_exit:1; void (*preexec_cb)(void); }; @@ -52,6 +53,7 @@ extern int run_hook(const char *index_file, const char *name, ...); #define RUN_COMMAND_STDOUT_TO_STDERR 4 #define RUN_SILENT_EXEC_FAILURE 8 #define RUN_USING_SHELL 16 +#define RUN_CLEAN_ON_EXIT 32 int run_command_v_opt(const char **argv, int opt); /* diff --git a/t/Makefile b/t/Makefile index 9046ec981..52a23fffc 100644 --- a/t/Makefile +++ b/t/Makefile @@ -73,42 +73,4 @@ gitweb-test: valgrind: $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind" -# Smoke testing targets --include ../GIT-VERSION-FILE -uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo unknown') -uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo unknown') - -test-results: - mkdir -p test-results - -test-results/git-smoke.tar.gz: test-results - $(PERL_PATH) ./harness \ - --archive="test-results/git-smoke.tar.gz" \ - $(T) - -smoke: test-results/git-smoke.tar.gz - -SMOKE_UPLOAD_FLAGS = -ifdef SMOKE_USERNAME - SMOKE_UPLOAD_FLAGS += -F username="$(SMOKE_USERNAME)" -F password="$(SMOKE_PASSWORD)" -endif -ifdef SMOKE_COMMENT - SMOKE_UPLOAD_FLAGS += -F comments="$(SMOKE_COMMENT)" -endif -ifdef SMOKE_TAGS - SMOKE_UPLOAD_FLAGS += -F tags="$(SMOKE_TAGS)" -endif - -smoke_report: smoke - curl \ - -H "Expect: " \ - -F project=Git \ - -F architecture="$(uname_M)" \ - -F platform="$(uname_S)" \ - -F revision="$(GIT_VERSION)" \ - -F report_file=@test-results/git-smoke.tar.gz \ - $(SMOKE_UPLOAD_FLAGS) \ - http://smoke.git.nix.is/app/projects/process_add_report/1 \ - | grep -v ^Redirecting - -.PHONY: pre-clean $(T) aggregate-results clean valgrind smoke smoke_report +.PHONY: pre-clean $(T) aggregate-results clean valgrind diff --git a/t/README b/t/README index c85abaffb..681e8b432 100644 --- a/t/README +++ b/t/README @@ -658,76 +658,3 @@ Then, at the top-level: That'll generate a detailed cover report in the "cover_db_html" directory, which you can then copy to a webserver, or inspect locally in a browser. - -Smoke testing -------------- - -The Git test suite has support for smoke testing. Smoke testing is -when you submit the results of a test run to a central server for -analysis and aggregation. - -Running a smoke tester is an easy and valuable way of contributing to -Git development, particularly if you have access to an uncommon OS on -obscure hardware. - -After building Git you can generate a smoke report like this in the -"t" directory: - - make clean smoke - -You can also pass arguments via the environment. This should make it -faster: - - GIT_TEST_OPTS='--root=/dev/shm' TEST_JOBS=10 make clean smoke - -The "smoke" target will run the Git test suite with Perl's -"TAP::Harness" module, and package up the results in a .tar.gz archive -with "TAP::Harness::Archive". The former is included with Perl v5.10.1 -or later, but you'll need to install the latter from the CPAN. See the -"Test coverage" section above for how you might do that. - -Once the "smoke" target finishes you'll see a message like this: - - TAP Archive created at /t/test-results/git-smoke.tar.gz - -To upload the smoke report you need to have curl(1) installed, then -do: - - make smoke_report - -To upload the report anonymously. Hopefully that'll return something -like "Reported #7 added.". - -If you're going to be uploading reports frequently please request a -user account by E-Mailing gitsmoke@v.nix.is. Once you have a username -and password you'll be able to do: - - SMOKE_USERNAME= SMOKE_PASSWORD= make smoke_report - -You can also add an additional comment to attach to the report, and/or -a comma separated list of tags: - - SMOKE_USERNAME= SMOKE_PASSWORD= \ - SMOKE_COMMENT= SMOKE_TAGS= \ - make smoke_report - -Once the report is uploaded it'll be made available at -http://smoke.git.nix.is, here's an overview of Recent Smoke Reports -for Git: - - http://smoke.git.nix.is/app/projects/smoke_reports/1 - -The reports will also be mirrored to GitHub every few hours: - - http://github.com/gitsmoke/smoke-reports - -The Smolder SQLite database is also mirrored and made available for -download: - - http://github.com/gitsmoke/smoke-database - -Note that the database includes hashed (with crypt()) user passwords -and E-Mail addresses. Don't use a valuable password for the smoke -service if you have an account, or an E-Mail address you don't want to -be publicly known. The user accounts are just meant to be convenient -labels, they're not meant to be secure. diff --git a/t/harness b/t/harness deleted file mode 100755 index f5c02f49b..000000000 --- a/t/harness +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/perl -use strict; -use warnings; -use Getopt::Long (); -use TAP::Harness::Archive; - -Getopt::Long::Parser->new( - config => [ qw/ pass_through / ], -)->getoptions( - 'jobs:1' => \(my $jobs = $ENV{TEST_JOBS}), - 'archive=s' => \my $archive, -) or die "$0: Couldn't getoptions()"; - -TAP::Harness::Archive->new({ - jobs => $jobs, - archive => $archive, - ($ENV{GIT_TEST_OPTS} - ? (test_args => [ split /\s+/, $ENV{GIT_TEST_OPTS} ]) - : ()), - extra_properties => {}, -})->runtests(@ARGV); diff --git a/t/t4150-am.sh b/t/t4150-am.sh index d7d9ccc1c..7e6e59aef 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -136,7 +136,7 @@ test_expect_success setup ' git format-patch -M --stdout lorem^ >rename-add.patch && # reset time - unset test_tick && + sane_unset test_tick && test_tick ' diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh index da25bc2d1..7c1dc641d 100755 --- a/t/t5150-request-pull.sh +++ b/t/t5150-request-pull.sh @@ -179,11 +179,7 @@ test_expect_success 'request names an appropriate branch' ' read repository && read branch } &1 | tee output && + test_cmp /dev/null output +' + test_done diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index 9b85d420c..d66ed2450 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -14,6 +14,7 @@ fi ROOT_PATH="$PWD" LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5541'} . "$TEST_DIRECTORY"/lib-httpd.sh +. "$TEST_DIRECTORY"/lib-terminal.sh start_httpd test_expect_success 'setup remote repository' ' @@ -95,6 +96,32 @@ test_expect_success 'create and delete remote branch' ' test_must_fail git show-ref --verify refs/remotes/origin/dev ' +cat >"$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update" <exp < dev2 (hook declined) +error: failed to push some refs to 'http://127.0.0.1:5541/smart/test_repo.git' +EOF + +test_expect_success 'rejected update prints status' ' + cd "$ROOT_PATH"/test_repo_clone && + git checkout -b dev2 && + : >path4 && + git add path4 && + test_tick && + git commit -m dev2 && + test_must_fail git push origin dev2 2>act && + sed -e "/^remote: /s/ *$//" cmp && + test_cmp exp cmp +' +rm -f "$HTTPD_DOCUMENT_ROOT_PATH/test_repo.git/hooks/update" + cat >exp <&1 | tee output && + test_cmp /dev/null output +' + stop_httpd test_done diff --git a/t/t5560-http-backend-noserver.sh b/t/t5560-http-backend-noserver.sh index 0ad7ce07c..ef98d95e0 100755 --- a/t/t5560-http-backend-noserver.sh +++ b/t/t5560-http-backend-noserver.sh @@ -17,7 +17,7 @@ run_backend() { GET() { REQUEST_METHOD="GET" && export REQUEST_METHOD && run_backend "/repo.git/$1" && - unset REQUEST_METHOD && + sane_unset REQUEST_METHOD && if ! grep "Status" act.out >act then printf "Status: 200 OK\r\n" >act @@ -30,8 +30,8 @@ POST() { REQUEST_METHOD="POST" && export REQUEST_METHOD && CONTENT_TYPE="application/x-$1-request" && export CONTENT_TYPE && run_backend "/repo.git/$1" "$2" && - unset REQUEST_METHOD && - unset CONTENT_TYPE && + sane_unset REQUEST_METHOD && + sane_unset CONTENT_TYPE && if ! grep "Status" act.out >act then printf "Status: 200 OK\r\n" >act diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh index af34a1e81..839ad97b7 100755 --- a/t/t6012-rev-list-simplify.sh +++ b/t/t6012-rev-list-simplify.sh @@ -86,5 +86,6 @@ check_result 'I H E C B A' --full-history --date-order -- file check_result 'I E C B A' --simplify-merges -- file check_result 'I B A' -- file check_result 'I B A' --topo-order -- file +check_result 'H' --first-parent -- another-file test_done diff --git a/t/t6032-merge-large-rename.sh b/t/t6032-merge-large-rename.sh index fdb6c2537..94f010be8 100755 --- a/t/t6032-merge-large-rename.sh +++ b/t/t6032-merge-large-rename.sh @@ -95,7 +95,7 @@ test_expect_success 'setup large simple rename' ' ' test_expect_success 'massive simple rename does not spam added files' ' - unset GIT_MERGE_VERBOSITY && + sane_unset GIT_MERGE_VERBOSITY && git merge --no-stat simple-rename | grep -v Removing >output && test 5 -gt "$(wc -l < output)" ' diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index 33b292b8a..5b97222c4 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh @@ -611,4 +611,12 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re ) ' +test_expect_success 'submodule add properly re-creates deeper level submodules' ' + (cd super && + git reset --hard master && + rm -rf deeper/ && + git submodule add ../submodule deeper/submodule + ) +' + test_done diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index 4aab2a75b..f5e16fc7d 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -39,6 +39,7 @@ test_expect_success 'setup' ' echo branch1 change >file1 && echo branch1 newfile >file2 && echo branch1 spaced >"spaced name" && + echo branch1 both added >both && echo branch1 change file11 >file11 && echo branch1 change file13 >file13 && echo branch1 sub >subdir/file3 && @@ -50,6 +51,7 @@ test_expect_success 'setup' ' git checkout -b submod-branch1 ) && git add file1 "spaced name" file11 file13 file2 subdir/file3 submod && + git add both && git rm file12 && git commit -m "branch1 changes" && @@ -58,6 +60,7 @@ test_expect_success 'setup' ' echo master updated >file1 && echo master new >file2 && echo master updated spaced >"spaced name" && + echo master both added >both && echo master updated file12 >file12 && echo master updated file14 >file14 && echo master new sub >subdir/file3 && @@ -69,18 +72,22 @@ test_expect_success 'setup' ' git checkout -b submod-master ) && git add file1 "spaced name" file12 file14 file2 subdir/file3 submod && + git add both && git rm file11 && git commit -m "master updates" && git config merge.tool mytool && git config mergetool.mytool.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" && - git config mergetool.mytool.trustExitCode true + git config mergetool.mytool.trustExitCode true && + git config mergetool.mybase.cmd "cat \"\$BASE\" >\"\$MERGED\"" && + git config mergetool.mybase.trustExitCode true ' test_expect_success 'custom mergetool' ' git checkout -b test1 branch1 && git submodule update -N && test_must_fail git merge master >/dev/null 2>&1 && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "" | git mergetool file1 file1 ) && ( yes "" | git mergetool file2 "spaced name" >/dev/null 2>&1 ) && ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) && @@ -101,6 +108,7 @@ test_expect_success 'mergetool crlf' ' ( yes "" | git mergetool file1 >/dev/null 2>&1 ) && ( yes "" | git mergetool file2 >/dev/null 2>&1 ) && ( yes "" | git mergetool "spaced name" >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) && ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) && @@ -131,6 +139,7 @@ test_expect_success 'mergetool on file in parent dir' ' cd subdir && ( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) && ( yes "" | git mergetool ../file2 ../spaced\ name >/dev/null 2>&1 ) && + ( yes "" | git mergetool ../both >/dev/null 2>&1 ) && ( yes "d" | git mergetool ../file11 >/dev/null 2>&1 ) && ( yes "d" | git mergetool ../file12 >/dev/null 2>&1 ) && ( yes "l" | git mergetool ../submod >/dev/null 2>&1 ) && @@ -212,6 +221,7 @@ test_expect_success 'deleted vs modified submodule' ' test_must_fail git merge master && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "r" | git mergetool submod ) && rmdir submod && mv submod-movedaside submod && @@ -228,6 +238,7 @@ test_expect_success 'deleted vs modified submodule' ' test_must_fail git merge master && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "l" | git mergetool submod ) && test ! -e submod && @@ -241,6 +252,7 @@ test_expect_success 'deleted vs modified submodule' ' test_must_fail git merge test6 && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "r" | git mergetool submod ) && test ! -e submod && @@ -256,6 +268,7 @@ test_expect_success 'deleted vs modified submodule' ' test_must_fail git merge test6 && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "l" | git mergetool submod ) && test "$(cat submod/bar)" = "master submodule" && @@ -279,6 +292,7 @@ test_expect_success 'file vs modified submodule' ' test_must_fail git merge master && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "r" | git mergetool submod ) && rmdir submod && mv submod-movedaside submod && @@ -294,6 +308,7 @@ test_expect_success 'file vs modified submodule' ' test_must_fail git merge master && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "l" | git mergetool submod ) && git submodule update -N && @@ -309,6 +324,7 @@ test_expect_success 'file vs modified submodule' ' test_must_fail git merge test7 && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both >/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "r" | git mergetool submod ) && test -d submod.orig && @@ -324,6 +340,7 @@ test_expect_success 'file vs modified submodule' ' test_must_fail git merge test7 && test -n "$(git ls-files -u)" && ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && + ( yes "" | git mergetool both>/dev/null 2>&1 ) && ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && ( yes "l" | git mergetool submod ) && test "$(cat submod/bar)" = "master submodule" && @@ -445,4 +462,13 @@ test_expect_success 'directory vs modified submodule' ' git submodule update -N ' +test_expect_success 'file with no base' ' + git checkout -b test13 branch1 && + test_must_fail git merge master && + git mergetool --no-prompt --tool mybase -- both && + >expected && + test_cmp both expected && + git reset --hard master >/dev/null 2>&1 +' + test_done diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 7ba5b16f9..75f4716d8 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -245,6 +245,28 @@ do ' done +cat >expected <actual && + test_cmp expected actual +' + +cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'grep -L -C' ' + git ls-files >expected && + git grep -L -C1 nonexistent_string >actual && + test_cmp expected actual +' + cat >expected <