From: Junio C Hamano Date: Sat, 12 Apr 2008 06:55:55 +0000 (-0700) Subject: Merge branch 'maint-1.5.4' into maint X-Git-Tag: v1.5.5.1~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/eed81838f0d0e031702473e1d427d71055134edd?ds=inline;hp=-c Merge branch 'maint-1.5.4' into maint * maint-1.5.4: bisect: fix bad rev checking in "git bisect good" revision.c: make --date-order overriddable Fix section about backdating tags in the git-tag docs Document option --only of git commit Documentation/git-request-pull: Fixed a typo ("send" -> "end") --- eed81838f0d0e031702473e1d427d71055134edd diff --combined Documentation/git-commit.txt index b4ae61ff46,488d873f43..4bb51cc06e --- a/Documentation/git-commit.txt +++ b/Documentation/git-commit.txt @@@ -139,6 -139,17 +139,17 @@@ but can be used to amend a merge commit as well. This is usually not what you want unless you are concluding a conflicted merge. + -o|--only:: + Make a commit only from the paths specified on the + command line, disregarding any contents that have been + staged so far. This is the default mode of operation of + 'git commit' if any paths are given on the command line, + in which case this option can be omitted. + If this option is specified together with '--amend', then + no paths need be specified, which can be used to amend + the last commit without committing changes that have + already been staged. + -u|--untracked-files:: Show all untracked files, also those in uninteresting directories, in the "Untracked files:" section of commit @@@ -280,8 -291,8 +291,8 @@@ order) HOOKS ----- -This command can run `commit-msg`, `pre-commit`, and -`post-commit` hooks. See link:hooks.html[hooks] for more +This command can run `commit-msg`, `prepare-commit-msg`, `pre-commit`, +and `post-commit` hooks. See link:hooks.html[hooks] for more information. diff --combined Documentation/git-tag.txt index 4b6fd90eaf,b729595984..9712392f79 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@@ -26,9 -26,6 +26,9 @@@ creates a 'tag' object, and requires th `-m ` or `-F ` is given, an editor is started for the user to type in the tag message. +If `-m ` or `-F ` is given and `-a`, `-s`, and `-u ` +are absent, `-a` is implied. + Otherwise just the SHA1 object name of the commit object is written (i.e. a lightweight tag). @@@ -71,14 -68,10 +71,14 @@@ OPTION Use the given tag message (instead of prompting). If multiple `-m` options are given, there values are concatenated as separate paragraphs. + Implies `-a` if none of `-a`, `-s`, or `-u ` + is given. -F :: Take the tag message from the given file. Use '-' to read the message from the standard input. + Implies `-a` if none of `-a`, `-s`, or `-u ` + is given. CONFIGURATION ------------- @@@ -233,14 -226,14 +233,14 @@@ the tag object affects, for example, th gitweb interface. To set the date used in future tag objects, set the environment - variable GIT_AUTHOR_DATE to one or more of the date and time. The + variable GIT_COMMITTER_DATE to one or more of the date and time. The date and time can be specified in a number of ways; the most common is "YYYY-MM-DD HH:MM". An example follows. ------------ - $ GIT_AUTHOR_DATE="2006-10-02 10:31" git tag -s v1.0.1 + $ GIT_COMMITTER_DATE="2006-10-02 10:31" git tag -s v1.0.1 ------------ diff --combined builtin-commit.c index 660a3458f7,a228a43f75..05dfc6973a --- a/builtin-commit.c +++ b/builtin-commit.c @@@ -7,7 -7,6 +7,7 @@@ #include "cache.h" #include "cache-tree.h" +#include "color.h" #include "dir.h" #include "builtin.h" #include "diff.h" @@@ -98,7 -97,7 +98,7 @@@ static struct option builtin_commit_opt OPT_BOOLEAN('a', "all", &all, "commit all changed files"), OPT_BOOLEAN('i', "include", &also, "add specified files to index for commit"), OPT_BOOLEAN(0, "interactive", &interactive, "interactively add files"), - OPT_BOOLEAN('o', "only", &only, ""), + OPT_BOOLEAN('o', "only", &only, "commit only specified files"), OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"), OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"), OPT_BOOLEAN(0, "untracked-files", &untracked_files, "show all untracked files"), @@@ -161,7 -160,7 +161,7 @@@ static int list_paths(struct path_list for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i]; - if (ce->ce_flags & htons(CE_UPDATE)) + if (ce->ce_flags & CE_UPDATE) continue; if (!pathspec_match(pattern, m, ce->name, 0)) continue; @@@ -198,8 -197,6 +198,8 @@@ static void create_base_index(void opts.head_idx = 1; opts.index_only = 1; opts.merge = 1; + opts.src_index = &the_index; + opts.dst_index = &the_index; opts.fn = oneway_merge; tree = parse_tree_indirect(head_sha1); @@@ -207,8 -204,7 +207,8 @@@ die("failed to unpack HEAD tree object"); parse_tree(tree); init_tree_desc(&t, tree->buffer, tree->size); - unpack_trees(1, &t, &opts); + if (unpack_trees(1, &t, &opts)) + exit(128); /* We've already reported the error, finish dying */ } static char *prepare_index(int argc, const char **argv, const char *prefix) @@@ -351,107 -347,45 +351,107 @@@ static int run_status(FILE *fp, const c return s.commitable; } +static int run_hook(const char *index_file, const char *name, ...) +{ + struct child_process hook; + const char *argv[10], *env[2]; + char index[PATH_MAX]; + va_list args; + int i; + + va_start(args, name); + argv[0] = git_path("hooks/%s", name); + i = 0; + do { + if (++i >= ARRAY_SIZE(argv)) + die ("run_hook(): too many arguments"); + argv[i] = va_arg(args, const char *); + } while (argv[i]); + va_end(args); + + snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); + env[0] = index; + env[1] = NULL; + + if (access(argv[0], X_OK) < 0) + return 0; + + memset(&hook, 0, sizeof(hook)); + hook.argv = argv; + hook.no_stdin = 1; + hook.stdout_to_stderr = 1; + hook.env = env; + + return run_command(&hook); +} + +static int is_a_merge(const unsigned char *sha1) +{ + struct commit *commit = lookup_commit(sha1); + if (!commit || parse_commit(commit)) + die("could not parse HEAD commit"); + return !!(commit->parents && commit->parents->next); +} + static const char sign_off_header[] = "Signed-off-by: "; -static int prepare_log_message(const char *index_file, const char *prefix) +static int prepare_to_commit(const char *index_file, const char *prefix) { struct stat statbuf; int commitable, saved_color_setting; struct strbuf sb; char *buffer; FILE *fp; + const char *hook_arg1 = NULL; + const char *hook_arg2 = NULL; + + if (!no_verify && run_hook(index_file, "pre-commit", NULL)) + return 0; strbuf_init(&sb, 0); if (message.len) { strbuf_addbuf(&sb, &message); + hook_arg1 = "message"; } else if (logfile && !strcmp(logfile, "-")) { if (isatty(0)) fprintf(stderr, "(reading log message from standard input)\n"); if (strbuf_read(&sb, 0, 0) < 0) die("could not read log from standard input"); + hook_arg1 = "message"; } else if (logfile) { if (strbuf_read_file(&sb, logfile, 0) < 0) die("could not read log file '%s': %s", logfile, strerror(errno)); + hook_arg1 = "message"; } else if (use_message) { buffer = strstr(use_message_buffer, "\n\n"); if (!buffer || buffer[2] == '\0') die("commit has empty message"); strbuf_add(&sb, buffer + 2, strlen(buffer + 2)); + hook_arg1 = "commit"; + hook_arg2 = use_message; } else if (!stat(git_path("MERGE_MSG"), &statbuf)) { if (strbuf_read_file(&sb, git_path("MERGE_MSG"), 0) < 0) die("could not read MERGE_MSG: %s", strerror(errno)); + hook_arg1 = "merge"; } else if (!stat(git_path("SQUASH_MSG"), &statbuf)) { if (strbuf_read_file(&sb, git_path("SQUASH_MSG"), 0) < 0) die("could not read SQUASH_MSG: %s", strerror(errno)); + hook_arg1 = "squash"; } else if (template_file && !stat(template_file, &statbuf)) { if (strbuf_read_file(&sb, template_file, 0) < 0) die("could not read %s: %s", template_file, strerror(errno)); + hook_arg1 = "template"; } + /* + * This final case does not modify the template message, + * it just sets the argument to the prepare-commit-msg hook. + */ + else if (in_merge) + hook_arg1 = "merge"; + fp = fopen(git_path(commit_editmsg), "w"); if (fp == NULL) die("could not open %s", git_path(commit_editmsg)); @@@ -483,38 -417,13 +483,38 @@@ strbuf_release(&sb); - if (!use_editor) { + if (use_editor) { + if (in_merge) + fprintf(fp, + "#\n" + "# It looks like you may be committing a MERGE.\n" + "# If this is not correct, please remove the file\n" + "# %s\n" + "# and try again.\n" + "#\n", + git_path("MERGE_HEAD")); + + fprintf(fp, + "\n" + "# Please enter the commit message for your changes.\n" + "# (Comment lines starting with '#' will "); + if (cleanup_mode == CLEANUP_ALL) + fprintf(fp, "not be included)\n"); + else /* CLEANUP_SPACE, that is. */ + fprintf(fp, "be kept.\n" + "# You can remove them yourself if you want to)\n"); + if (only_include_assumed) + fprintf(fp, "# %s\n", only_include_assumed); + + saved_color_setting = wt_status_use_color; + wt_status_use_color = 0; + commitable = run_status(fp, index_file, prefix, 1); + wt_status_use_color = saved_color_setting; + } else { struct rev_info rev; unsigned char sha1[20]; const char *parent = "HEAD"; - fclose(fp); - if (!active_nr && read_cache() < 0) die("Cannot read index"); @@@ -522,60 -431,48 +522,60 @@@ parent = "HEAD^1"; if (get_sha1(parent, sha1)) - return !!active_nr; + commitable = !!active_nr; + else { + init_revisions(&rev, ""); + rev.abbrev = 0; + setup_revisions(0, NULL, &rev, parent); + DIFF_OPT_SET(&rev.diffopt, QUIET); + DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS); + run_diff_index(&rev, 1 /* cached */); + + commitable = !!DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES); + } + } - init_revisions(&rev, ""); - rev.abbrev = 0; - setup_revisions(0, NULL, &rev, parent); - DIFF_OPT_SET(&rev.diffopt, QUIET); - DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS); - run_diff_index(&rev, 1 /* cached */); + fclose(fp); - return !!DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES); + if (!commitable && !in_merge && !allow_empty && + !(amend && is_a_merge(head_sha1))) { + run_status(stdout, index_file, prefix, 0); + unlink(commit_editmsg); + return 0; } - if (in_merge) - fprintf(fp, - "#\n" - "# It looks like you may be committing a MERGE.\n" - "# If this is not correct, please remove the file\n" - "# %s\n" - "# and try again.\n" - "#\n", - git_path("MERGE_HEAD")); - - fprintf(fp, - "\n" - "# Please enter the commit message for your changes.\n" - "# (Comment lines starting with '#' will "); - if (cleanup_mode == CLEANUP_ALL) - fprintf(fp, "not be included)\n"); - else /* CLEANUP_SPACE, that is. */ - fprintf(fp, "be kept.\n" - "# You can remove them yourself if you want to)\n"); - if (only_include_assumed) - fprintf(fp, "# %s\n", only_include_assumed); - - saved_color_setting = wt_status_use_color; - wt_status_use_color = 0; - commitable = run_status(fp, index_file, prefix, 1); - wt_status_use_color = saved_color_setting; + /* + * Re-read the index as pre-commit hook could have updated it, + * and write it out as a tree. We must do this before we invoke + * the editor and after we invoke run_status above. + */ + discard_cache(); + read_cache_from(index_file); + if (!active_cache_tree) + active_cache_tree = cache_tree(); + if (cache_tree_update(active_cache_tree, + active_cache, active_nr, 0, 0) < 0) { + error("Error building trees"); + return 0; + } - fclose(fp); + if (run_hook(index_file, "prepare-commit-msg", + git_path(commit_editmsg), hook_arg1, hook_arg2, NULL)) + return 0; + + if (use_editor) { + char index[PATH_MAX]; + const char *env[2] = { index, NULL }; + snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); + launch_editor(git_path(commit_editmsg), NULL, env); + } - return commitable; + if (!no_verify && + run_hook(index_file, "commit-msg", git_path(commit_editmsg), NULL)) { + return 0; + } + + return 1; } /* @@@ -672,8 -569,6 +672,8 @@@ static int parse_and_validate_options(i use_editor = 0; if (edit_flag) use_editor = 1; + if (!use_editor) + setenv("GIT_EDITOR", ":", 1); if (get_sha1("HEAD", head_sha1)) initial_commit = 1; @@@ -775,9 -670,6 +775,9 @@@ int cmd_status(int argc, const char **a git_config(git_status_config); + if (wt_status_use_color == -1) + wt_status_use_color = git_use_color_default; + argc = parse_and_validate_options(argc, argv, builtin_status_usage); index_file = prepare_index(argc, argv, prefix); @@@ -789,6 -681,31 +789,6 @@@ return commitable ? 0 : 1; } -static int run_hook(const char *index_file, const char *name, const char *arg) -{ - struct child_process hook; - const char *argv[3], *env[2]; - char index[PATH_MAX]; - - argv[0] = git_path("hooks/%s", name); - argv[1] = arg; - argv[2] = NULL; - snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); - env[0] = index; - env[1] = NULL; - - if (access(argv[0], X_OK) < 0) - return 0; - - memset(&hook, 0, sizeof(hook)); - hook.argv = argv; - hook.no_stdin = 1; - hook.stdout_to_stderr = 1; - hook.env = env; - - return run_command(&hook); -} - static void print_summary(const char *prefix, const unsigned char *sha1) { struct rev_info rev; @@@ -839,6 -756,14 +839,6 @@@ int git_commit_config(const char *k, co return git_status_config(k, v); } -static int is_a_merge(const unsigned char *sha1) -{ - struct commit *commit = lookup_commit(sha1); - if (!commit || parse_commit(commit)) - die("could not parse HEAD commit"); - return !!(commit->parents && commit->parents->next); -} - static const char commit_utf8_warn[] = "Warning: commit message does not conform to UTF-8.\n" "You may want to amend it after fixing the message, or set the config\n" @@@ -870,13 -795,33 +870,13 @@@ int cmd_commit(int argc, const char **a index_file = prepare_index(argc, argv, prefix); - if (!no_verify && run_hook(index_file, "pre-commit", NULL)) { + /* Set up everything for writing the commit object. This includes + running hooks, writing the trees, and interacting with the user. */ + if (!prepare_to_commit(index_file, prefix)) { rollback_index_files(); return 1; } - if (!prepare_log_message(index_file, prefix) && !in_merge && - !allow_empty && !(amend && is_a_merge(head_sha1))) { - run_status(stdout, index_file, prefix, 0); - rollback_index_files(); - unlink(commit_editmsg); - return 1; - } - - /* - * Re-read the index as pre-commit hook could have updated it, - * and write it out as a tree. - */ - discard_cache(); - read_cache_from(index_file); - if (!active_cache_tree) - active_cache_tree = cache_tree(); - if (cache_tree_update(active_cache_tree, - active_cache, active_nr, 0, 0) < 0) { - rollback_index_files(); - die("Error building trees"); - } - /* * The commit object */ @@@ -928,8 -873,19 +928,8 @@@ strbuf_addf(&sb, "encoding %s\n", git_commit_encoding); strbuf_addch(&sb, '\n'); - /* Get the commit message and validate it */ + /* Finally, get the commit message */ header_len = sb.len; - if (use_editor) { - char index[PATH_MAX]; - const char *env[2] = { index, NULL }; - snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); - launch_editor(git_path(commit_editmsg), NULL, env); - } - if (!no_verify && - run_hook(index_file, "commit-msg", git_path(commit_editmsg))) { - rollback_index_files(); - exit(1); - } if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) { rollback_index_files(); die("could not read commit message"); diff --combined git-bisect.sh index 48fb92d612,c8be9f7e8a..6644b10e36 --- a/git-bisect.sh +++ b/git-bisect.sh @@@ -151,20 -151,16 +151,16 @@@ bisect_state() rev=$(git rev-parse --verify HEAD) || die "Bad rev input: HEAD" bisect_write "$state" "$rev" ;; - 2,bad) - rev=$(git rev-parse --verify "$2^{commit}") || - die "Bad rev input: $2" - bisect_write "$state" "$rev" ;; - *,good|*,skip) + 2,bad|*,good|*,skip) shift - revs=$(git rev-parse --revs-only --no-flags "$@") && - test '' != "$revs" || die "Bad rev input: $@" - for rev in $revs + for rev in "$@" do rev=$(git rev-parse --verify "$rev^{commit}") || - die "Bad rev commit: $rev^{commit}" + die "Bad rev input: $rev" bisect_write "$state" "$rev" done ;; + *,bad) + die "'git bisect bad' can take only one argument." ;; *) usage ;; esac @@@ -293,14 -289,14 +289,14 @@@ bisect_next() bisect_next_check good skip=$(git for-each-ref --format='%(objectname)' \ - "refs/bisect/skip-*" | tr '[\012]' ' ') || exit + "refs/bisect/skip-*" | tr '\012' ' ') || exit BISECT_OPT='' test -n "$skip" && BISECT_OPT='--bisect-all' bad=$(git rev-parse --verify refs/bisect/bad) && good=$(git for-each-ref --format='^%(objectname)' \ - "refs/bisect/good-*" | tr '[\012]' ' ') && + "refs/bisect/good-*" | tr '\012' ' ') && eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" && eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" && eval=$(filter_skipped "$eval" "$skip") && @@@ -333,9 -329,9 +329,9 @@@ bisect_visualize() if test $# = 0 then - case "${DISPLAY+set}" in + case "${DISPLAY+set}${MSYSTEM+set}${SECURITYSESSIONID+set}" in '') set git log ;; - set) set gitk ;; + set*) set gitk ;; esac else case "$1" in diff --combined revision.c index 196fedc9d1,d79f2b3a7b..ffbed3fbf2 --- a/revision.c +++ b/revision.c @@@ -46,8 -46,6 +46,8 @@@ void add_object(struct object *obj static void mark_blob_uninteresting(struct blob *blob) { + if (!blob) + return; if (blob->object.flags & UNINTERESTING) return; blob->object.flags |= UNINTERESTING; @@@ -59,8 -57,6 +59,8 @@@ void mark_tree_uninteresting(struct tre struct name_entry entry; struct object *obj = &tree->object; + if (!tree) + return; if (obj->flags & UNINTERESTING) return; obj->flags |= UNINTERESTING; @@@ -177,8 -173,6 +177,8 @@@ static struct commit *handle_commit(str struct tag *tag = (struct tag *) object; if (revs->tag_objects && !(flags & UNINTERESTING)) add_pending_object(revs, object, tag->tag); + if (!tag->tagged) + die("bad tag"); object = parse_object(tag->tagged->sha1); if (!object) die("bad object %s", sha1_to_hex(tag->tagged->sha1)); @@@ -564,39 -558,8 +564,39 @@@ static void cherry_pick_list(struct com free_patch_ids(&ids); } +/* How many extra uninteresting commits we want to see.. */ +#define SLOP 5 + +static int still_interesting(struct commit_list *src, unsigned long date, int slop) +{ + /* + * No source list at all? We're definitely done.. + */ + if (!src) + return 0; + + /* + * Does the destination list contain entries with a date + * before the source list? Definitely _not_ done. + */ + if (date < src->item->date) + return SLOP; + + /* + * Does the source list still have interesting commits in + * it? Definitely not done.. + */ + if (!everybody_uninteresting(src)) + return SLOP; + + /* Ok, we're closing in.. */ + return slop-1; +} + static int limit_list(struct rev_info *revs) { + int slop = SLOP; + unsigned long date = ~0ul; struct commit_list *list = revs->commits; struct commit_list *newlist = NULL; struct commit_list **p = &newlist; @@@ -616,19 -579,12 +616,19 @@@ return -1; if (obj->flags & UNINTERESTING) { mark_parents_uninteresting(commit); - if (everybody_uninteresting(list)) - break; - continue; + if (revs->show_all) + p = &commit_list_insert(commit, p)->next; + slop = still_interesting(list, date, slop); + if (slop) + continue; + /* If showing all, add the whole pending list to the end */ + if (revs->show_all) + *p = list; + break; } if (revs->min_age != -1 && (commit->date > revs->min_age)) continue; + date = commit->date; p = &commit_list_insert(commit, p)->next; show = show_early_output; @@@ -661,13 -617,12 +661,13 @@@ static int handle_one_ref(const char *p return 0; } -static void handle_all(struct rev_info *revs, unsigned flags) +static void handle_refs(struct rev_info *revs, unsigned flags, + int (*for_each)(each_ref_fn, void *)) { struct all_refs_cb cb; cb.all_revs = revs; cb.all_flags = flags; - for_each_ref(handle_one_ref, &cb); + for_each(handle_one_ref, &cb); } static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data) @@@ -730,8 -685,6 +730,8 @@@ static int add_parents_only(struct rev_ it = get_reference(revs, arg, sha1, 0); if (it->type != OBJ_TAG) break; + if (!((struct tag*)it)->tagged) + return 0; hashcpy(sha1, ((struct tag*)it)->tagged->sha1); } if (it->type != OBJ_COMMIT) @@@ -767,10 -720,6 +767,10 @@@ void init_revisions(struct rev_info *re revs->commit_format = CMIT_FMT_DEFAULT; diff_setup(&revs->diffopt); + if (prefix && !revs->diffopt.prefix) { + revs->diffopt.prefix = prefix; + revs->diffopt.prefix_length = strlen(prefix); + } } static void add_pending_commit_list(struct rev_info *revs, @@@ -971,7 -920,6 +971,7 @@@ int setup_revisions(int argc, const cha int left = 1; int all_match = 0; int regflags = 0; + int fixed = 0; /* First, search for "--" */ seen_dashdash = 0; @@@ -1040,19 -988,7 +1040,19 @@@ continue; } if (!strcmp(arg, "--all")) { - handle_all(revs, flags); + handle_refs(revs, flags, for_each_ref); + continue; + } + if (!strcmp(arg, "--branches")) { + handle_refs(revs, flags, for_each_branch_ref); + continue; + } + if (!strcmp(arg, "--tags")) { + handle_refs(revs, flags, for_each_tag_ref); + continue; + } + if (!strcmp(arg, "--remotes")) { + handle_refs(revs, flags, for_each_remote_ref); continue; } if (!strcmp(arg, "--first-parent")) { @@@ -1083,6 -1019,7 +1083,7 @@@ continue; } if (!strcmp(arg, "--topo-order")) { + revs->lifo = 1; revs->topo_order = 1; continue; } @@@ -1115,10 -1052,6 +1116,10 @@@ revs->dense = 0; continue; } + if (!strcmp(arg, "--show-all")) { + revs->show_all = 1; + continue; + } if (!strcmp(arg, "--remove-empty")) { revs->remove_empty_trees = 1; continue; @@@ -1280,11 -1213,6 +1281,11 @@@ regflags |= REG_ICASE; continue; } + if (!strcmp(arg, "--fixed-strings") || + !strcmp(arg, "-F")) { + fixed = 1; + continue; + } if (!strcmp(arg, "--all-match")) { all_match = 1; continue; @@@ -1340,10 -1268,8 +1341,10 @@@ } } - if (revs->grep_filter) + if (revs->grep_filter) { revs->grep_filter->regflags |= regflags; + revs->grep_filter->fixed = fixed; + } if (show_merge) prepare_show_merge(revs); @@@ -1509,8 -1435,6 +1510,8 @@@ enum commit_action simplify_commit(stru return commit_ignore; if (revs->unpacked && has_sha1_pack(commit->object.sha1, revs->ignore_packed)) return commit_ignore; + if (revs->show_all) + return commit_show; if (commit->object.flags & UNINTERESTING) return commit_ignore; if (revs->min_age != -1 && (commit->date > revs->min_age)) diff --combined t/t6030-bisect-porcelain.sh index f471c1526f,dc87f13558..32d6118183 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@@ -69,6 -69,19 +69,19 @@@ test_expect_success 'bisect start with git bisect good $HASH1 && git bisect bad $HASH4 && git bisect next + ' + + test_expect_success 'bisect good and bad fails if not given only revs' ' + git bisect reset && + git bisect start && + test_must_fail git bisect good foo $HASH1 && + test_must_fail git bisect good $HASH1 bar && + test_must_fail git bisect bad frotz && + test_must_fail git bisect bad $HASH3 $HASH4 && + test_must_fail git bisect skip bar $HASH3 && + test_must_fail git bisect skip $HASH1 foo && + git bisect good $HASH1 && + git bisect bad $HASH4 ' test_expect_success 'bisect reset: back in the master branch' ' @@@ -219,7 -232,7 +232,7 @@@ test_expect_success 'bisect run & skip add_line_into_file "6: Yet a line." hello && HASH6=$(git rev-parse --verify HEAD) && echo "#"\!"/bin/sh" > test_script.sh && - echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh && + echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh && echo "grep line hello > /dev/null" >> test_script.sh && echo "test \$? -ne 0" >> test_script.sh && chmod +x test_script.sh && @@@ -244,8 -257,8 +257,8 @@@ test_expect_success 'bisect run & skip add_line_into_file "7: Should be the last line." hello && HASH7=$(git rev-parse --verify HEAD) && echo "#"\!"/bin/sh" > test_script.sh && - echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh && - echo "tail -1 hello | grep day > /dev/null && exit 125" >> test_script.sh && + echo "sed -ne \\\$p hello | grep Ciao > /dev/null && exit 125" >> test_script.sh && + echo "sed -ne \\\$p hello | grep day > /dev/null && exit 125" >> test_script.sh && echo "grep Yet hello > /dev/null" >> test_script.sh && echo "test \$? -ne 0" >> test_script.sh && chmod +x test_script.sh &&