summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-07 18:09:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-09-07 18:09:18 (GMT)
commit7764a3b35c53b6859963ddad92bfc90563ac8baa (patch)
tree2d0eaf020e1b06a608bfc0748368be7a511b7ae4 /revision.c
parent096bbd6537b8465d2123cea3361921793ce8a73a (diff)
parent003c84f6d2b9e9c4d5bbf5262cae994bac7190cb (diff)
downloadgit-7764a3b35c53b6859963ddad92bfc90563ac8baa.zip
git-7764a3b35c53b6859963ddad92bfc90563ac8baa.tar.gz
git-7764a3b35c53b6859963ddad92bfc90563ac8baa.tar.bz2
Merge branch 'jc/dotdot-is-parent-directory'
"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 442a945..cbcae10 100644
--- a/revision.c
+++ b/revision.c
@@ -1134,15 +1134,27 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
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_committish(this, from_sha1) &&
!get_sha1_committish(next, sha1)) {
struct commit *a, *b;