10
10
static char const * const builtin_commit_graph_usage [] = {
11
11
N_ ("git commit-graph [--object-dir <objdir>]" ),
12
12
N_ ("git commit-graph read [--object-dir <objdir>]" ),
13
- N_ ("git commit-graph verify [--object-dir <objdir>] [--shallow]" ),
14
- N_ ("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] <split options>" ),
13
+ N_ ("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress] " ),
14
+ N_ ("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] [--[no-]progress] <split options>" ),
15
15
NULL
16
16
};
17
17
18
18
static const char * const builtin_commit_graph_verify_usage [] = {
19
- N_ ("git commit-graph verify [--object-dir <objdir>] [--shallow]" ),
19
+ N_ ("git commit-graph verify [--object-dir <objdir>] [--shallow] [--[no-]progress] " ),
20
20
NULL
21
21
};
22
22
@@ -26,7 +26,7 @@ static const char * const builtin_commit_graph_read_usage[] = {
26
26
};
27
27
28
28
static const char * const builtin_commit_graph_write_usage [] = {
29
- N_ ("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] <split options>" ),
29
+ N_ ("git commit-graph write [--object-dir <objdir>] [--append|--split] [--reachable|--stdin-packs|--stdin-commits] [--[no-]progress] <split options>" ),
30
30
NULL
31
31
};
32
32
@@ -38,6 +38,7 @@ static struct opts_commit_graph {
38
38
int append ;
39
39
int split ;
40
40
int shallow ;
41
+ int progress ;
41
42
} opts ;
42
43
43
44
static int graph_verify (int argc , const char * * argv )
@@ -55,9 +56,11 @@ static int graph_verify(int argc, const char **argv)
55
56
N_ ("The object directory to store the graph" )),
56
57
OPT_BOOL (0 , "shallow" , & opts .shallow ,
57
58
N_ ("if the commit-graph is split, only verify the tip file" )),
59
+ OPT_BOOL (0 , "progress" , & opts .progress , N_ ("force progress reporting" )),
58
60
OPT_END (),
59
61
};
60
62
63
+ opts .progress = isatty (2 );
61
64
argc = parse_options (argc , argv , NULL ,
62
65
builtin_commit_graph_verify_options ,
63
66
builtin_commit_graph_verify_usage , 0 );
@@ -66,7 +69,9 @@ static int graph_verify(int argc, const char **argv)
66
69
opts .obj_dir = get_object_directory ();
67
70
if (opts .shallow )
68
71
flags |= COMMIT_GRAPH_VERIFY_SHALLOW ;
69
-
72
+ if (opts .progress )
73
+ flags |= COMMIT_GRAPH_WRITE_PROGRESS ;
74
+
70
75
graph_name = get_commit_graph_filename (opts .obj_dir );
71
76
open_ok = open_commit_graph (graph_name , & fd , & st );
72
77
if (!open_ok && errno != ENOENT )
@@ -154,7 +159,7 @@ static int graph_write(int argc, const char **argv)
154
159
struct string_list * commit_hex = NULL ;
155
160
struct string_list lines ;
156
161
int result = 0 ;
157
- enum commit_graph_write_flags flags = COMMIT_GRAPH_WRITE_PROGRESS ;
162
+ enum commit_graph_write_flags flags = 0 ;
158
163
159
164
static struct option builtin_commit_graph_write_options [] = {
160
165
OPT_STRING (0 , "object-dir" , & opts .obj_dir ,
@@ -168,6 +173,7 @@ static int graph_write(int argc, const char **argv)
168
173
N_ ("start walk at commits listed by stdin" )),
169
174
OPT_BOOL (0 , "append" , & opts .append ,
170
175
N_ ("include all commits already in the commit-graph file" )),
176
+ OPT_BOOL (0 , "progress" , & opts .progress , N_ ("force progress reporting" )),
171
177
OPT_BOOL (0 , "split" , & opts .split ,
172
178
N_ ("allow writing an incremental commit-graph file" )),
173
179
OPT_INTEGER (0 , "max-commits" , & split_opts .max_commits ,
@@ -179,6 +185,7 @@ static int graph_write(int argc, const char **argv)
179
185
OPT_END (),
180
186
};
181
187
188
+ opts .progress = isatty (2 );
182
189
split_opts .size_multiple = 2 ;
183
190
split_opts .max_commits = 0 ;
184
191
split_opts .expire_time = 0 ;
@@ -195,6 +202,8 @@ static int graph_write(int argc, const char **argv)
195
202
flags |= COMMIT_GRAPH_WRITE_APPEND ;
196
203
if (opts .split )
197
204
flags |= COMMIT_GRAPH_WRITE_SPLIT ;
205
+ if (opts .progress )
206
+ flags |= COMMIT_GRAPH_WRITE_PROGRESS ;
198
207
199
208
read_replace_refs = 0 ;
200
209
0 commit comments