@@ -68,42 +68,36 @@ static int parse_options_cmd_bundle(int argc,
68
68
}
69
69
70
70
static int cmd_bundle_create (int argc , const char * * argv , const char * prefix ) {
71
- int all_progress_implied = 1 ;
72
- int progress = isatty (STDERR_FILENO );
73
- struct strvec pack_opts ;
71
+ struct strvec pack_opts = STRVEC_INIT ;
74
72
int version = -1 ;
75
73
int ret ;
76
74
struct option options [] = {
77
- OPT_SET_INT ('q' , "quiet" , & progress ,
78
- N_ ("do not show progress meter" ), 0 ),
79
- OPT_SET_INT (0 , "progress" , & progress ,
80
- N_ ("show progress meter" ), 1 ),
81
- OPT_SET_INT_F (0 , "all-progress" , & progress ,
82
- N_ ("historical; same as --progress" ), 2 ,
83
- PARSE_OPT_HIDDEN ),
84
- OPT_HIDDEN_BOOL (0 , "all-progress-implied" ,
85
- & all_progress_implied ,
86
- N_ ("historical; does nothing" )),
75
+ OPT_PASSTHRU_ARGV ('q' , "quiet" , & pack_opts , NULL ,
76
+ N_ ("do not show progress meter" ),
77
+ PARSE_OPT_NOARG ),
78
+ OPT_PASSTHRU_ARGV (0 , "progress" , & pack_opts , NULL ,
79
+ N_ ("show progress meter" ),
80
+ PARSE_OPT_NOARG ),
81
+ OPT_PASSTHRU_ARGV (0 , "all-progress" , & pack_opts , NULL ,
82
+ N_ ("historical; same as --progress" ),
83
+ PARSE_OPT_NOARG | PARSE_OPT_HIDDEN ),
84
+ OPT_PASSTHRU_ARGV (0 , "all-progress-implied" , & pack_opts , NULL ,
85
+ N_ ("historical; does nothing" ),
86
+ PARSE_OPT_NOARG | PARSE_OPT_HIDDEN ),
87
87
OPT_INTEGER (0 , "version" , & version ,
88
88
N_ ("specify bundle format version" )),
89
89
OPT_END ()
90
90
};
91
91
char * bundle_file ;
92
92
93
+ if (isatty (STDERR_FILENO ))
94
+ strvec_push (& pack_opts , "--progress" );
95
+ strvec_push (& pack_opts , "--all-progress-implied" );
96
+
93
97
argc = parse_options_cmd_bundle (argc , argv , prefix ,
94
98
builtin_bundle_create_usage , options , & bundle_file );
95
99
/* bundle internals use argv[1] as further parameters */
96
100
97
- strvec_init (& pack_opts );
98
- if (progress == 0 )
99
- strvec_push (& pack_opts , "--quiet" );
100
- else if (progress == 1 )
101
- strvec_push (& pack_opts , "--progress" );
102
- else if (progress == 2 )
103
- strvec_push (& pack_opts , "--all-progress" );
104
- if (progress && all_progress_implied )
105
- strvec_push (& pack_opts , "--all-progress-implied" );
106
-
107
101
if (!startup_info -> have_repository )
108
102
die (_ ("Need a repository to create a bundle." ));
109
103
ret = !!create_bundle (the_repository , bundle_file , argc , argv , & pack_opts , version );
0 commit comments