git-rev-list: make --dense the default (and introduce "--sparse")
This actually does three things: - make "--dense" the default for git-rev-list. Since dense is a no-op if no filenames are given, this doesn't actually change any historical behaviour, but it's logically the right default (if we want to prune on filenames, do it fully. The sparse "merge-only" thing may be useful, but it's not what you'd normally expect) - make "git-rev-parse" show the default revision control before it shows any pathnames. This was a real bug, but nobody would ever have noticed, because the default thing tends to only make sense for git-rev-list, and git-rev-list didn't use to take pathnames. - it changes "git-rev-list" to match the other commands that take a mix of revisions and filenames - it no longer requires the "--" before filenames (although you still need to do it if a filename could be confused with a revision name, eg "gitk" in the git archive) This all just makes for much more pleasant and obvous usage. Just doing a gitk t/ does the obvious thing: it will show the history as it concerns the "t/" subdirectory. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>maint
parent
bd321bcc51
commit
7b34c2fae0
25
rev-list.c
25
rev-list.c
|
@ -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;
|
||||||
|
@ -619,7 +619,7 @@ static struct commit *get_commit_reference(const char *name, unsigned int flags)
|
||||||
struct object *object;
|
struct object *object;
|
||||||
|
|
||||||
if (get_sha1(name, sha1))
|
if (get_sha1(name, sha1))
|
||||||
usage(rev_list_usage);
|
return NULL;
|
||||||
object = parse_object(sha1);
|
object = parse_object(sha1);
|
||||||
if (!object)
|
if (!object)
|
||||||
die("bad object %s", name);
|
die("bad object %s", name);
|
||||||
|
@ -793,12 +793,12 @@ int main(int argc, const char **argv)
|
||||||
dense = 1;
|
dense = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--")) {
|
if (!strcmp(arg, "--sparse")) {
|
||||||
paths = get_pathspec(prefix, argv + i + 1);
|
dense = 0;
|
||||||
if (paths) {
|
continue;
|
||||||
limited = 1;
|
|
||||||
diff_tree_setup_paths(paths);
|
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--")) {
|
||||||
|
i++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,9 +830,20 @@ int main(int argc, const char **argv)
|
||||||
limited = 1;
|
limited = 1;
|
||||||
}
|
}
|
||||||
commit = get_commit_reference(arg, flags);
|
commit = get_commit_reference(arg, flags);
|
||||||
|
if (!commit)
|
||||||
|
break;
|
||||||
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)
|
||||||
|
|
||||||
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)
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue