aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorDave Olszewski <cxreg@pobox.com>2010-03-13 14:47:05 -0800
committerJunio C Hamano <gitster@pobox.com>2010-03-13 21:23:43 -0800
commit8fcaca3ff29a193f50a44bb3d5734a503e0539a6 (patch)
tree849aa7f164afc9cabbc523b9730c0f55a6ed7f7a /revision.c
parent8ca788035644f2aaf7a951272ae16a7bd319554c (diff)
downloadgit-8fcaca3ff29a193f50a44bb3d5734a503e0539a6.tar.gz
git-8fcaca3ff29a193f50a44bb3d5734a503e0539a6.tar.xz
don't use default revision if a rev was specified
If a revision is specified, it happens not to have any commits, don't use the default revision. By doing so, surprising and undesired behavior can happen, such as showing the reflog for HEAD when a branch was specified. [jc: squashed a test from René] Signed-off-by: Dave Olszewski <cxreg@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/revision.c b/revision.c
index 29721ecf8..490b48408 100644
--- a/revision.c
+++ b/revision.c
@@ -1334,7 +1334,7 @@ static void append_prune_data(const char ***prune_data, const char **av)
*/
int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def)
{
- int i, flags, left, seen_dashdash, read_from_stdin;
+ int i, flags, left, seen_dashdash, read_from_stdin, got_rev_arg = 0;
const char **prune_data = NULL;
/* First, search for "--" */
@@ -1460,6 +1460,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
append_prune_data(&prune_data, argv + i);
break;
}
+ else
+ got_rev_arg = 1;
}
if (prune_data)
@@ -1469,7 +1471,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
revs->def = def;
if (revs->show_merge)
prepare_show_merge(revs);
- if (revs->def && !revs->pending.nr) {
+ if (revs->def && !revs->pending.nr && !got_rev_arg) {
unsigned char sha1[20];
struct object *object;
unsigned mode;