提交 5ef1862a 编写于 作者: J Junio C Hamano

Merge branch 'lt-dense'

...@@ -28,7 +28,7 @@ static const char rev_list_usage[] = ...@@ -28,7 +28,7 @@ static const char rev_list_usage[] =
" --merge-order [ --show-breaks ]\n" " --merge-order [ --show-breaks ]\n"
" --topo-order"; " --topo-order";
static int dense = 0; static int dense = 1;
static int unpacked = 0; static int unpacked = 0;
static int bisect_list = 0; static int bisect_list = 0;
static int tag_objects = 0; static int tag_objects = 0;
...@@ -613,13 +613,10 @@ static void add_pending_object(struct object *obj, const char *name) ...@@ -613,13 +613,10 @@ static void add_pending_object(struct object *obj, const char *name)
add_object(obj, &pending_objects, name); add_object(obj, &pending_objects, name);
} }
static struct commit *get_commit_reference(const char *name, unsigned int flags) static struct commit *get_commit_reference(const char *name, const unsigned char *sha1, unsigned int flags)
{ {
unsigned char sha1[20];
struct object *object; struct object *object;
if (get_sha1(name, sha1))
usage(rev_list_usage);
object = parse_object(sha1); object = parse_object(sha1);
if (!object) if (!object)
die("bad object %s", name); die("bad object %s", name);
...@@ -697,7 +694,7 @@ static struct commit_list **global_lst; ...@@ -697,7 +694,7 @@ static struct commit_list **global_lst;
static int include_one_commit(const char *path, const unsigned char *sha1) static int include_one_commit(const char *path, const unsigned char *sha1)
{ {
struct commit *com = get_commit_reference(path, 0); struct commit *com = get_commit_reference(path, sha1, 0);
handle_one_commit(com, global_lst); handle_one_commit(com, global_lst);
return 0; return 0;
} }
...@@ -720,6 +717,7 @@ int main(int argc, const char **argv) ...@@ -720,6 +717,7 @@ int main(int argc, const char **argv)
const char *arg = argv[i]; const char *arg = argv[i];
char *dotdot; char *dotdot;
struct commit *commit; struct commit *commit;
unsigned char sha1[20];
if (!strncmp(arg, "--max-count=", 12)) { if (!strncmp(arg, "--max-count=", 12)) {
max_count = atoi(arg + 12); max_count = atoi(arg + 12);
...@@ -793,12 +791,12 @@ int main(int argc, const char **argv) ...@@ -793,12 +791,12 @@ int main(int argc, const char **argv)
dense = 1; dense = 1;
continue; continue;
} }
if (!strcmp(arg, "--sparse")) {
dense = 0;
continue;
}
if (!strcmp(arg, "--")) { if (!strcmp(arg, "--")) {
paths = get_pathspec(prefix, argv + i + 1); i++;
if (paths) {
limited = 1;
diff_tree_setup_paths(paths);
}
break; break;
} }
...@@ -808,15 +806,19 @@ int main(int argc, const char **argv) ...@@ -808,15 +806,19 @@ int main(int argc, const char **argv)
flags = 0; flags = 0;
dotdot = strstr(arg, ".."); dotdot = strstr(arg, "..");
if (dotdot) { if (dotdot) {
unsigned char from_sha1[20];
char *next = dotdot + 2; char *next = dotdot + 2;
struct commit *exclude = NULL;
struct commit *include = NULL;
*dotdot = 0; *dotdot = 0;
if (!*next) if (!*next)
next = "HEAD"; next = "HEAD";
exclude = get_commit_reference(arg, UNINTERESTING); if (!get_sha1(arg, from_sha1) && !get_sha1(next, sha1)) {
include = get_commit_reference(next, 0); struct commit *exclude;
if (exclude && include) { struct commit *include;
exclude = get_commit_reference(arg, from_sha1, UNINTERESTING);
include = get_commit_reference(next, sha1, 0);
if (!exclude || !include)
die("Invalid revision range %s..%s", arg, next);
limited = 1; limited = 1;
handle_one_commit(exclude, &list); handle_one_commit(exclude, &list);
handle_one_commit(include, &list); handle_one_commit(include, &list);
...@@ -829,10 +831,21 @@ int main(int argc, const char **argv) ...@@ -829,10 +831,21 @@ int main(int argc, const char **argv)
arg++; arg++;
limited = 1; limited = 1;
} }
commit = get_commit_reference(arg, flags); if (get_sha1(arg, sha1) < 0)
break;
commit = get_commit_reference(arg, sha1, flags);
handle_one_commit(commit, &list); handle_one_commit(commit, &list);
} }
if (!list)
usage(rev_list_usage);
paths = get_pathspec(prefix, argv + i);
if (paths) {
limited = 1;
diff_tree_setup_paths(paths);
}
save_commit_buffer = verbose_header; save_commit_buffer = verbose_header;
track_object_refs = 0; track_object_refs = 0;
......
...@@ -153,6 +153,7 @@ static void show_datestring(const char *flag, const char *datestr) ...@@ -153,6 +153,7 @@ static void show_datestring(const char *flag, const char *datestr)
static void show_file(const char *arg) static void show_file(const char *arg)
{ {
show_default();
if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV)) if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
show(arg); show(arg);
} }
...@@ -174,7 +175,6 @@ int main(int argc, char **argv) ...@@ -174,7 +175,6 @@ int main(int argc, char **argv)
if (*arg == '-') { if (*arg == '-') {
if (!strcmp(arg, "--")) { if (!strcmp(arg, "--")) {
as_is = 1; as_is = 1;
show_default();
/* Pass on the "--" if we show anything but files.. */ /* Pass on the "--" if we show anything but files.. */
if (filter & (DO_FLAGS | DO_REVS)) if (filter & (DO_FLAGS | DO_REVS))
show_file(arg); show_file(arg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册