From: Junio C Hamano Date: Wed, 12 Sep 2012 21:00:34 +0000 (-0700) Subject: Merge branch 'jc/dotdot-is-parent-directory' into maint-1.7.11 X-Git-Tag: v1.7.11.7~7 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/eaff724bbc9c8f838b6d65fff9959da968939c3a?hp=-c 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 --- eaff724bbc9c8f838b6d65fff9959da968939c3a diff --combined revision.c index 6d21ac7ee1,457868d647..72104962d3 --- a/revision.c +++ b/revision.c @@@ -345,7 -345,6 +345,7 @@@ static int tree_difference = REV_TREE_S static void file_add_remove(struct diff_options *options, int addremove, unsigned mode, const unsigned char *sha1, + int sha1_valid, const char *fullpath, unsigned dirty_submodule) { int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD; @@@ -359,7 -358,6 +359,7 @@@ static void file_change(struct diff_opt unsigned old_mode, unsigned new_mode, const unsigned char *old_sha1, const unsigned char *new_sha1, + int old_sha1_valid, int new_sha1_valid, const char *fullpath, unsigned old_dirty_submodule, unsigned new_dirty_submodule) { @@@ -1134,15 -1132,27 +1134,27 @@@ int handle_revision_arg(const char *arg 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; @@@ -1855,7 -1865,8 +1867,7 @@@ int setup_revisions(int argc, const cha if (revs->combine_merges) revs->ignore_merges = 0; revs->diffopt.abbrev = revs->abbrev; - if (diff_setup_done(&revs->diffopt) < 0) - die("diff_setup_done failed"); + diff_setup_done(&revs->diffopt); compile_grep_patterns(&revs->grep_filter);