Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-07 22:09:18 +0400
committerJunio C Hamano <gitster@pobox.com>2012-09-07 22:09:18 +0400
commit7764a3b35c53b6859963ddad92bfc90563ac8baa (patch)
tree2d0eaf020e1b06a608bfc0748368be7a511b7ae4 /builtin/rev-parse.c
parent096bbd6537b8465d2123cea3361921793ce8a73a (diff)
parent003c84f6d2b9e9c4d5bbf5262cae994bac7190cb (diff)
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 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index bb3a5161bb..f267a1d3b5 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -230,6 +230,7 @@ static int try_difference(const char *arg)
const char *next;
const char *this;
int symmetric;
+ static const char head_by_default[] = "HEAD";
if (!(dotdot = strstr(arg, "..")))
return 0;
@@ -241,9 +242,20 @@ static int try_difference(const char *arg)
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.
+ */
+ *dotdot = '.';
+ return 0;
+ }
+
if (!get_sha1_committish(this, sha1) && !get_sha1_committish(next, end)) {
show_rev(NORMAL, end, next);
show_rev(symmetric ? NORMAL : REVERSED, sha1, this);