summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-12 14:00:34 -0700
committerJunio C Hamano <gitster@pobox.com>2012-09-12 14:00:34 -0700
commiteaff724bbc9c8f838b6d65fff9959da968939c3a (patch)
tree34f4a3cdd4f3a79c5b4f96e3278b234a60386f88 /revision.c
parent1b8bc86b5eb86609c31cae48eb7569b24acacc90 (diff)
parent003c84f6d2b9e9c4d5bbf5262cae994bac7190cb (diff)
downloadgit-eaff724bbc9c8f838b6d65fff9959da968939c3a.tar.gz
Merge branch 'jc/dotdot-is-parent-directory' into maint-1.7.11
"git log .." errored out saying it is both rev range and a path when there is no disambiguating "--" is on the command line. Update the command line parser to interpret ".." as a path in such a case. * jc/dotdot-is-parent-directory: specifying ranges: we did not mean to make ".." an empty set
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 6d21ac7ee1..72104962d3 100644
--- a/revision.c
+++ b/revision.c
@@ -1134,15 +1134,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;