aboutsummaryrefslogtreecommitdiff
path: root/builtin/describe.c
diff options
context:
space:
mode:
authorMike Crowe <mac@mcrowe.com>2013-05-17 21:56:18 +0100
committerJunio C Hamano <gitster@pobox.com>2013-05-20 11:09:03 -0700
commite00dd1e9485c50f202cc97dfae19d510e108b565 (patch)
treee0ff1428e746e363c93ee9a5303e347c7aced797 /builtin/describe.c
parentde3a5c6da194928868b5eee4a9c4d538b4194727 (diff)
downloadgit-e00dd1e9485c50f202cc97dfae19d510e108b565.tar.gz
git-e00dd1e9485c50f202cc97dfae19d510e108b565.tar.xz
describe: Add --first-parent option
Only consider the first parent commit when walking the commit history. This is useful if you only wish to match tags on your branch after a merge. Signed-off-by: Mike Crowe <mac@mcrowe.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/describe.c')
-rw-r--r--builtin/describe.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/describe.c b/builtin/describe.c
index 6636a68cd..ad8471626 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -21,6 +21,7 @@ static int debug; /* Display lots of verbose info */
static int all; /* Any valid ref can be used */
static int tags; /* Allow lightweight tags */
static int longformat;
+static int first_parent;
static int abbrev = -1; /* unspecified */
static int max_candidates = 10;
static struct hash_table names;
@@ -336,6 +337,9 @@ static void describe(const char *arg, int last_one)
commit_list_insert_by_date(p, &list);
p->object.flags |= c->object.flags;
parents = parents->next;
+
+ if (first_parent)
+ break;
}
}
@@ -404,6 +408,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN(0, "all", &all, N_("use any ref")),
OPT_BOOLEAN(0, "tags", &tags, N_("use any tag, even unannotated")),
OPT_BOOLEAN(0, "long", &longformat, N_("always use long format")),
+ OPT_BOOLEAN(0, "first-parent", &first_parent, N_("only follow first parent")),
OPT__ABBREV(&abbrev),
OPT_SET_INT(0, "exact-match", &max_candidates,
N_("only output exact matches"), 0),