@@ -2214,13 +2214,14 @@ void wt_status_print(struct wt_status *s)
2214
2214
/**
2215
2215
* Returns 1 if there are unstaged changes, 0 otherwise.
2216
2216
*/
2217
- int has_unstaged_changes (void )
2217
+ int has_unstaged_changes (int ignore_submodules )
2218
2218
{
2219
2219
struct rev_info rev_info ;
2220
2220
int result ;
2221
2221
2222
2222
init_revisions (& rev_info , NULL );
2223
- DIFF_OPT_SET (& rev_info .diffopt , IGNORE_SUBMODULES );
2223
+ if (ignore_submodules )
2224
+ DIFF_OPT_SET (& rev_info .diffopt , IGNORE_SUBMODULES );
2224
2225
DIFF_OPT_SET (& rev_info .diffopt , QUICK );
2225
2226
diff_setup_done (& rev_info .diffopt );
2226
2227
result = run_diff_files (& rev_info , 0 );
@@ -2230,7 +2231,7 @@ int has_unstaged_changes(void)
2230
2231
/**
2231
2232
* Returns 1 if there are uncommitted changes, 0 otherwise.
2232
2233
*/
2233
- int has_uncommitted_changes (void )
2234
+ int has_uncommitted_changes (int ignore_submodules )
2234
2235
{
2235
2236
struct rev_info rev_info ;
2236
2237
int result ;
@@ -2239,7 +2240,8 @@ int has_uncommitted_changes(void)
2239
2240
return 0 ;
2240
2241
2241
2242
init_revisions (& rev_info , NULL );
2242
- DIFF_OPT_SET (& rev_info .diffopt , IGNORE_SUBMODULES );
2243
+ if (ignore_submodules )
2244
+ DIFF_OPT_SET (& rev_info .diffopt , IGNORE_SUBMODULES );
2243
2245
DIFF_OPT_SET (& rev_info .diffopt , QUICK );
2244
2246
add_head_to_pending (& rev_info );
2245
2247
diff_setup_done (& rev_info .diffopt );
@@ -2251,7 +2253,7 @@ int has_uncommitted_changes(void)
2251
2253
* If the work tree has unstaged or uncommitted changes, dies with the
2252
2254
* appropriate message.
2253
2255
*/
2254
- int require_clean_work_tree (const char * action , const char * hint , int gently )
2256
+ int require_clean_work_tree (const char * action , const char * hint , int ignore_submodules , int gently )
2255
2257
{
2256
2258
struct lock_file * lock_file = xcalloc (1 , sizeof (* lock_file ));
2257
2259
int err = 0 ;
@@ -2261,13 +2263,13 @@ int require_clean_work_tree(const char *action, const char *hint, int gently)
2261
2263
update_index_if_able (& the_index , lock_file );
2262
2264
rollback_lock_file (lock_file );
2263
2265
2264
- if (has_unstaged_changes ()) {
2266
+ if (has_unstaged_changes (ignore_submodules )) {
2265
2267
/* TRANSLATORS: the action is e.g. "pull with rebase" */
2266
2268
error (_ ("Cannot %s: You have unstaged changes." ), _ (action ));
2267
2269
err = 1 ;
2268
2270
}
2269
2271
2270
- if (has_uncommitted_changes ()) {
2272
+ if (has_uncommitted_changes (ignore_submodules )) {
2271
2273
if (err )
2272
2274
error (_ ("Additionally, your index contains uncommitted changes." ));
2273
2275
else
0 commit comments