specifying ranges: we did not mean to make ".." an empty set
Either end of revision range operator can be omitted to default to HEAD, as in "origin.." (what did I do since I forked) or "..origin" (what did they do since I forked). But the current parser interprets ".." as an empty range "HEAD..HEAD", and worse yet, because ".." does exist on the filesystem, we get this annoying output: $ cd Documentation/howto $ git log .. ;# give me recent commits that touch Documentation/ area. fatal: ambiguous argument '..': both revision and filename Use '--' to separate filenames from revisions Surely we could say "git log ../" or even "git log -- .." to disambiguate, but we shouldn't have to. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
16
revision.c
16
revision.c
@ -1132,15 +1132,27 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs,
|
||||
const char *this = arg;
|
||||
int symmetric = *next == '.';
|
||||
unsigned int flags_exclude = flags ^ UNINTERESTING;
|
||||
static const char head_by_default[] = "HEAD";
|
||||
unsigned int a_flags;
|
||||
|
||||
*dotdot = 0;
|
||||
next += symmetric;
|
||||
|
||||
if (!*next)
|
||||
next = "HEAD";
|
||||
next = head_by_default;
|
||||
if (dotdot == arg)
|
||||
this = "HEAD";
|
||||
this = head_by_default;
|
||||
if (this == head_by_default && next == head_by_default &&
|
||||
!symmetric) {
|
||||
/*
|
||||
* Just ".."? That is not a range but the
|
||||
* pathspec for the parent directory.
|
||||
*/
|
||||
if (!cant_be_filename) {
|
||||
*dotdot = '.';
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!get_sha1(this, from_sha1) &&
|
||||
!get_sha1(next, sha1)) {
|
||||
struct commit *a, *b;
|
||||
|
||||
Reference in New Issue
Block a user