Merge branch 'rj/test-regex' into maint-1.7.11
[git.git] / revision.c
index 6d21ac7ee1ccb1aa014dc977955d7fce6d92ede2..72104962d36b9672fd9dfc6ec850c99ccfc3803c 100644 (file)
@@ -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;