X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=revision.c;h=f5771c7898a939e34effb8c757c5a237830075b9;hb=7ee3760e2c8f181f22d4b80afc03309e4f764385;hp=8603c145817488a4ce80111051129d4d715c597b;hpb=84b96278cc164b748b2c9dbe489f8d7b30bbbc4e;p=git.git diff --git a/revision.c b/revision.c index 8603c1458..f5771c789 100644 --- a/revision.c +++ b/revision.c @@ -994,16 +994,6 @@ static void add_message_grep(struct rev_info *revs, const char *pattern) add_grep(revs, pattern, GREP_PATTERN_BODY); } -static void add_ignore_packed(struct rev_info *revs, const char *name) -{ - int num = ++revs->num_ignore_packed; - - revs->ignore_packed = xrealloc(revs->ignore_packed, - sizeof(const char *) * (num + 1)); - revs->ignore_packed[num-1] = name; - revs->ignore_packed[num] = NULL; -} - static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv, int *unkc, const char **unkv) { @@ -1116,12 +1106,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->edge_hint = 1; } else if (!strcmp(arg, "--unpacked")) { revs->unpacked = 1; - free(revs->ignore_packed); - revs->ignore_packed = NULL; - revs->num_ignore_packed = 0; - } else if (!prefixcmp(arg, "--unpacked=")) { + revs->kept_pack_only = 0; + } else if (!strcmp(arg, "--kept-pack-only")) { revs->unpacked = 1; - add_ignore_packed(revs, arg+11); + revs->kept_pack_only = 1; + } else if (!prefixcmp(arg, "--unpacked=")) { + die("--unpacked= no longer supported."); } else if (!strcmp(arg, "-r")) { revs->diff = 1; DIFF_OPT_SET(&revs->diffopt, RECURSIVE); @@ -1144,9 +1134,13 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg } else if (!strcmp(arg, "--pretty")) { revs->verbose_header = 1; get_commit_format(arg+8, revs); - } else if (!prefixcmp(arg, "--pretty=")) { + } else if (!prefixcmp(arg, "--pretty=") || !prefixcmp(arg, "--format=")) { revs->verbose_header = 1; get_commit_format(arg+9, revs); + } else if (!strcmp(arg, "--oneline")) { + revs->verbose_header = 1; + get_commit_format("oneline", revs); + revs->abbrev_commit = 1; } else if (!strcmp(arg, "--graph")) { revs->topo_order = 1; revs->rewrite_parents = 1; @@ -1685,7 +1679,10 @@ enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit) { if (commit->object.flags & SHOWN) return commit_ignore; - if (revs->unpacked && has_sha1_pack(commit->object.sha1, revs->ignore_packed)) + if (revs->unpacked && + (revs->kept_pack_only + ? has_sha1_kept_pack(commit->object.sha1) + : has_sha1_pack(commit->object.sha1))) return commit_ignore; if (revs->show_all) return commit_show; @@ -1738,14 +1735,16 @@ static struct commit *get_revision_1(struct rev_info *revs) (commit->date < revs->max_age)) continue; if (add_parents_to_list(revs, commit, &revs->commits, NULL) < 0) - return NULL; + die("Failed to traverse parents of commit %s", + sha1_to_hex(commit->object.sha1)); } switch (simplify_commit(revs, commit)) { case commit_ignore: continue; case commit_error: - return NULL; + die("Failed to simplify parents of commit %s", + sha1_to_hex(commit->object.sha1)); default: return commit; }