@@ -21,6 +21,7 @@ static int debug; /* Display lots of verbose info */
2121static int all ; /* Any valid ref can be used */
2222static int tags ; /* Allow lightweight tags */
2323static int longformat ;
24+ static int first_parent ;
2425static int abbrev = -1 ; /* unspecified */
2526static int max_candidates = 10 ;
2627static struct hash_table names ;
@@ -336,6 +337,9 @@ static void describe(const char *arg, int last_one)
336337 commit_list_insert_by_date (p , & list );
337338 p -> object .flags |= c -> object .flags ;
338339 parents = parents -> next ;
340+
341+ if (first_parent )
342+ break ;
339343 }
340344 }
341345
@@ -404,6 +408,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
404408 OPT_BOOLEAN (0 , "all" , & all , N_ ("use any ref" )),
405409 OPT_BOOLEAN (0 , "tags" , & tags , N_ ("use any tag, even unannotated" )),
406410 OPT_BOOLEAN (0 , "long" , & longformat , N_ ("always use long format" )),
411+ OPT_BOOLEAN (0 , "first-parent" , & first_parent , N_ ("only follow first parent" )),
407412 OPT__ABBREV (& abbrev ),
408413 OPT_SET_INT (0 , "exact-match" , & max_candidates ,
409414 N_ ("only output exact matches" ), 0 ),
0 commit comments