@@ -32,7 +32,7 @@ static const char * const builtin_log_usage =
32
32
" or: git show [options] <object>..." ;
33
33
34
34
static void cmd_log_init (int argc , const char * * argv , const char * prefix ,
35
- struct rev_info * rev )
35
+ struct rev_info * rev , struct setup_revision_opt * opt )
36
36
{
37
37
int i ;
38
38
int decoration_style = 0 ;
@@ -56,7 +56,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
56
56
*/
57
57
if (argc == 2 && !strcmp (argv [1 ], "-h" ))
58
58
usage (builtin_log_usage );
59
- argc = setup_revisions (argc , argv , rev , "HEAD" );
59
+ argc = setup_revisions (argc , argv , rev , opt );
60
60
61
61
if (!rev -> show_notes_given && !rev -> pretty_given )
62
62
rev -> show_notes = 1 ;
@@ -262,6 +262,7 @@ static int git_log_config(const char *var, const char *value, void *cb)
262
262
int cmd_whatchanged (int argc , const char * * argv , const char * prefix )
263
263
{
264
264
struct rev_info rev ;
265
+ struct setup_revision_opt opt ;
265
266
266
267
git_config (git_log_config , NULL );
267
268
@@ -271,7 +272,9 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
271
272
init_revisions (& rev , prefix );
272
273
rev .diff = 1 ;
273
274
rev .simplify_history = 0 ;
274
- cmd_log_init (argc , argv , prefix , & rev );
275
+ memset (& opt , 0 , sizeof (opt ));
276
+ opt .def = "HEAD" ;
277
+ cmd_log_init (argc , argv , prefix , & rev , & opt );
275
278
if (!rev .diffopt .output_format )
276
279
rev .diffopt .output_format = DIFF_FORMAT_RAW ;
277
280
return cmd_log_walk (& rev );
@@ -328,6 +331,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
328
331
{
329
332
struct rev_info rev ;
330
333
struct object_array_entry * objects ;
334
+ struct setup_revision_opt opt ;
331
335
int i , count , ret = 0 ;
332
336
333
337
git_config (git_log_config , NULL );
@@ -342,7 +346,9 @@ int cmd_show(int argc, const char **argv, const char *prefix)
342
346
rev .always_show_header = 1 ;
343
347
rev .ignore_merges = 0 ;
344
348
rev .no_walk = 1 ;
345
- cmd_log_init (argc , argv , prefix , & rev );
349
+ memset (& opt , 0 , sizeof (opt ));
350
+ opt .def = "HEAD" ;
351
+ cmd_log_init (argc , argv , prefix , & rev , & opt );
346
352
347
353
count = rev .pending .nr ;
348
354
objects = rev .pending .objects ;
@@ -405,6 +411,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
405
411
int cmd_log_reflog (int argc , const char * * argv , const char * prefix )
406
412
{
407
413
struct rev_info rev ;
414
+ struct setup_revision_opt opt ;
408
415
409
416
git_config (git_log_config , NULL );
410
417
@@ -415,7 +422,9 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
415
422
init_reflog_walk (& rev .reflog_info );
416
423
rev .abbrev_commit = 1 ;
417
424
rev .verbose_header = 1 ;
418
- cmd_log_init (argc , argv , prefix , & rev );
425
+ memset (& opt , 0 , sizeof (opt ));
426
+ opt .def = "HEAD" ;
427
+ cmd_log_init (argc , argv , prefix , & rev , & opt );
419
428
420
429
/*
421
430
* This means that we override whatever commit format the user gave
@@ -438,6 +447,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
438
447
int cmd_log (int argc , const char * * argv , const char * prefix )
439
448
{
440
449
struct rev_info rev ;
450
+ struct setup_revision_opt opt ;
441
451
442
452
git_config (git_log_config , NULL );
443
453
@@ -446,7 +456,9 @@ int cmd_log(int argc, const char **argv, const char *prefix)
446
456
447
457
init_revisions (& rev , prefix );
448
458
rev .always_show_header = 1 ;
449
- cmd_log_init (argc , argv , prefix , & rev );
459
+ memset (& opt , 0 , sizeof (opt ));
460
+ opt .def = "HEAD" ;
461
+ cmd_log_init (argc , argv , prefix , & rev , & opt );
450
462
return cmd_log_walk (& rev );
451
463
}
452
464
@@ -887,6 +899,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
887
899
struct commit * commit ;
888
900
struct commit * * list = NULL ;
889
901
struct rev_info rev ;
902
+ struct setup_revision_opt s_r_opt ;
890
903
int nr = 0 , total , i ;
891
904
int use_stdout = 0 ;
892
905
int start_number = -1 ;
@@ -964,8 +977,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
964
977
rev .combine_merges = 0 ;
965
978
rev .ignore_merges = 1 ;
966
979
DIFF_OPT_SET (& rev .diffopt , RECURSIVE );
967
-
968
980
rev .subject_prefix = fmt_patch_subject_prefix ;
981
+ memset (& s_r_opt , 0 , sizeof (s_r_opt ));
982
+ s_r_opt .def = "HEAD" ;
969
983
970
984
if (default_attach ) {
971
985
rev .mime_boundary = default_attach ;
@@ -1037,7 +1051,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1037
1051
if (keep_subject && subject_prefix )
1038
1052
die ("--subject-prefix and -k are mutually exclusive." );
1039
1053
1040
- argc = setup_revisions (argc , argv , & rev , "HEAD" );
1054
+ argc = setup_revisions (argc , argv , & rev , & s_r_opt );
1041
1055
if (argc > 1 )
1042
1056
die ("unrecognized argument: %s" , argv [1 ]);
1043
1057
0 commit comments