@@ -618,18 +618,6 @@ static int batch_objects(struct batch_options *opt)
618
618
return retval ;
619
619
}
620
620
621
- static const char * const cat_file_usage [] = {
622
- N_ ("git cat-file <type> <object>" ),
623
- N_ ("git cat-file (-e | -p) <object>" ),
624
- N_ ("git cat-file ( -t | -s ) [--allow-unknown-type] <object>" ),
625
- N_ ("git cat-file (--batch | --batch-check) [--batch-all-objects]\n"
626
- " [--buffer] [--follow-symlinks] [--unordered]\n"
627
- " [--textconv | --filters]" ),
628
- N_ ("git cat-file (--textconv | --filters )\n"
629
- " [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]" ),
630
- NULL
631
- };
632
-
633
621
static int git_cat_file_config (const char * var , const char * value , void * cb )
634
622
{
635
623
if (userdiff_config (var , value ) < 0 )
@@ -664,6 +652,17 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
664
652
struct batch_options batch = {0 };
665
653
int unknown_type = 0 ;
666
654
655
+ const char * const usage [] = {
656
+ N_ ("git cat-file <type> <object>" ),
657
+ N_ ("git cat-file (-e | -p) <object>" ),
658
+ N_ ("git cat-file ( -t | -s ) [--allow-unknown-type] <object>" ),
659
+ N_ ("git cat-file (--batch | --batch-check) [--batch-all-objects]\n"
660
+ " [--buffer] [--follow-symlinks] [--unordered]\n"
661
+ " [--textconv | --filters]" ),
662
+ N_ ("git cat-file (--textconv | --filters )\n"
663
+ " [<rev>:<path|tree-ish> | --path=<path|tree-ish> <rev>]" ),
664
+ NULL
665
+ };
667
666
const struct option options [] = {
668
667
OPT_GROUP (N_ ("<type> can be one of: blob, tree, commit, tag" )),
669
668
OPT_CMDMODE ('t' , NULL , & opt , N_ ("show object type" ), 't' ),
@@ -700,43 +699,43 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
700
699
git_config (git_cat_file_config , NULL );
701
700
702
701
batch .buffer_output = -1 ;
703
- argc = parse_options (argc , argv , prefix , options , cat_file_usage , 0 );
702
+ argc = parse_options (argc , argv , prefix , options , usage , 0 );
704
703
705
704
if (opt ) {
706
705
if (batch .enabled && (opt == 'c' || opt == 'w' ))
707
706
batch .cmdmode = opt ;
708
707
else if (argc == 1 )
709
708
obj_name = argv [0 ];
710
709
else
711
- usage_with_options (cat_file_usage , options );
710
+ usage_with_options (usage , options );
712
711
}
713
712
if (!opt && !batch .enabled ) {
714
713
if (argc == 2 ) {
715
714
exp_type = argv [0 ];
716
715
obj_name = argv [1 ];
717
716
} else
718
- usage_with_options (cat_file_usage , options );
717
+ usage_with_options (usage , options );
719
718
}
720
719
if (batch .enabled ) {
721
720
if (batch .cmdmode != opt || argc )
722
- usage_with_options (cat_file_usage , options );
721
+ usage_with_options (usage , options );
723
722
if (batch .cmdmode && batch .all_objects )
724
723
die ("--batch-all-objects cannot be combined with "
725
724
"--textconv nor with --filters" );
726
725
}
727
726
728
727
if ((batch .follow_symlinks || batch .all_objects ) && !batch .enabled ) {
729
- usage_with_options (cat_file_usage , options );
728
+ usage_with_options (usage , options );
730
729
}
731
730
732
731
if (force_path && opt != 'c' && opt != 'w' ) {
733
732
error ("--path=<path> needs --textconv or --filters" );
734
- usage_with_options (cat_file_usage , options );
733
+ usage_with_options (usage , options );
735
734
}
736
735
737
736
if (force_path && batch .enabled ) {
738
737
error ("--path=<path> incompatible with --batch" );
739
- usage_with_options (cat_file_usage , options );
738
+ usage_with_options (usage , options );
740
739
}
741
740
742
741
if (batch .buffer_output < 0 )
0 commit comments