@@ -1690,8 +1690,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
16901690 revs -> max_count = atoi (argv [1 ]);
16911691 revs -> no_walk = 0 ;
16921692 return 2 ;
1693- } else if (starts_with (arg , "-n" )) {
1694- revs -> max_count = atoi (arg + 2 );
1693+ } else if (skip_prefix (arg , "-n" , & optarg )) {
1694+ revs -> max_count = atoi (optarg );
16951695 revs -> no_walk = 0 ;
16961696 } else if ((argcount = parse_long_opt ("max-age" , argv , & optarg ))) {
16971697 revs -> max_age = atoi (optarg );
@@ -1772,12 +1772,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
17721772 revs -> min_parents = 2 ;
17731773 } else if (!strcmp (arg , "--no-merges" )) {
17741774 revs -> max_parents = 1 ;
1775- } else if (starts_with (arg , "--min-parents=" )) {
1776- revs -> min_parents = atoi (arg + 14 );
1775+ } else if (skip_prefix (arg , "--min-parents=" , & optarg )) {
1776+ revs -> min_parents = atoi (optarg );
17771777 } else if (!strcmp (arg , "--no-min-parents" )) {
17781778 revs -> min_parents = 0 ;
1779- } else if (starts_with (arg , "--max-parents=" )) {
1780- revs -> max_parents = atoi (arg + 14 );
1779+ } else if (skip_prefix (arg , "--max-parents=" , & optarg )) {
1780+ revs -> max_parents = atoi (optarg );
17811781 } else if (!strcmp (arg , "--no-max-parents" )) {
17821782 revs -> max_parents = -1 ;
17831783 } else if (!strcmp (arg , "--boundary" )) {
@@ -1859,14 +1859,15 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
18591859 revs -> verbose_header = 1 ;
18601860 revs -> pretty_given = 1 ;
18611861 get_commit_format (NULL , revs );
1862- } else if (starts_with (arg , "--pretty=" ) || starts_with (arg , "--format=" )) {
1862+ } else if (skip_prefix (arg , "--pretty=" , & optarg ) ||
1863+ skip_prefix (arg , "--format=" , & optarg )) {
18631864 /*
18641865 * Detached form ("--pretty X" as opposed to "--pretty=X")
18651866 * not allowed, since the argument is optional.
18661867 */
18671868 revs -> verbose_header = 1 ;
18681869 revs -> pretty_given = 1 ;
1869- get_commit_format (arg + 9 , revs );
1870+ get_commit_format (optarg , revs );
18701871 } else if (!strcmp (arg , "--expand-tabs" )) {
18711872 revs -> expand_tabs_in_log = 8 ;
18721873 } else if (!strcmp (arg , "--no-expand-tabs" )) {
@@ -1884,26 +1885,23 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
18841885 revs -> show_signature = 1 ;
18851886 } else if (!strcmp (arg , "--no-show-signature" )) {
18861887 revs -> show_signature = 0 ;
1887- } else if (!strcmp (arg , "--show-linear-break" ) ||
1888- starts_with ( arg , "--show-linear-break=" )) {
1889- if ( starts_with ( arg , "--show-linear-break=" ))
1890- revs -> break_bar = xstrdup ( arg + 20 ) ;
1891- else
1892- revs -> break_bar = " .........." ;
1888+ } else if (!strcmp (arg , "--show-linear-break" )) {
1889+ revs -> break_bar = " .........." ;
1890+ revs -> track_linear = 1 ;
1891+ revs -> track_first_time = 1 ;
1892+ } else if ( skip_prefix ( arg , "--show-linear-break=" , & optarg )) {
1893+ revs -> break_bar = xstrdup ( optarg ) ;
18931894 revs -> track_linear = 1 ;
18941895 revs -> track_first_time = 1 ;
1895- } else if (starts_with (arg , "--show-notes=" ) ||
1896- starts_with (arg , "--notes=" )) {
1896+ } else if (skip_prefix (arg , "--show-notes=" , & optarg ) ||
1897+ skip_prefix (arg , "--notes=" , & optarg )) {
18971898 struct strbuf buf = STRBUF_INIT ;
18981899 revs -> show_notes = 1 ;
18991900 revs -> show_notes_given = 1 ;
1900- if (starts_with (arg , "--show-notes" )) {
1901- if (revs -> notes_opt .use_default_notes < 0 )
1902- revs -> notes_opt .use_default_notes = 1 ;
1903- strbuf_addstr (& buf , arg + 13 );
1904- }
1905- else
1906- strbuf_addstr (& buf , arg + 8 );
1901+ if (starts_with (arg , "--show-notes=" ) &&
1902+ revs -> notes_opt .use_default_notes < 0 )
1903+ revs -> notes_opt .use_default_notes = 1 ;
1904+ strbuf_addstr (& buf , optarg );
19071905 expand_notes_ref (& buf );
19081906 string_list_append (& revs -> notes_opt .extra_notes_refs ,
19091907 strbuf_detach (& buf , NULL ));
@@ -1940,8 +1938,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
19401938 revs -> abbrev = 0 ;
19411939 } else if (!strcmp (arg , "--abbrev" )) {
19421940 revs -> abbrev = DEFAULT_ABBREV ;
1943- } else if (starts_with (arg , "--abbrev=" )) {
1944- revs -> abbrev = strtoul (arg + 9 , NULL , 10 );
1941+ } else if (skip_prefix (arg , "--abbrev=" , & optarg )) {
1942+ revs -> abbrev = strtoul (optarg , NULL , 10 );
19451943 if (revs -> abbrev < MINIMUM_ABBREV )
19461944 revs -> abbrev = MINIMUM_ABBREV ;
19471945 else if (revs -> abbrev > 40 )
0 commit comments