/**
* Returns 1 if there are unstaged changes, 0 otherwise.
*/
-int has_unstaged_changes(void)
+int has_unstaged_changes(int ignore_submodules)
{
struct rev_info rev_info;
int result;
init_revisions(&rev_info, NULL);
- DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
+ if (ignore_submodules)
+ DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
DIFF_OPT_SET(&rev_info.diffopt, QUICK);
diff_setup_done(&rev_info.diffopt);
result = run_diff_files(&rev_info, 0);
/**
* Returns 1 if there are uncommitted changes, 0 otherwise.
*/
-int has_uncommitted_changes(void)
+int has_uncommitted_changes(int ignore_submodules)
{
struct rev_info rev_info;
int result;
return 0;
init_revisions(&rev_info, NULL);
- DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
+ if (ignore_submodules)
+ DIFF_OPT_SET(&rev_info.diffopt, IGNORE_SUBMODULES);
DIFF_OPT_SET(&rev_info.diffopt, QUICK);
add_head_to_pending(&rev_info);
diff_setup_done(&rev_info.diffopt);
* If the work tree has unstaged or uncommitted changes, dies with the
* appropriate message.
*/
-int require_clean_work_tree(const char *action, const char *hint, int gently)
+int require_clean_work_tree(const char *action, const char *hint, int ignore_submodules, int gently)
{
struct lock_file *lock_file = xcalloc(1, sizeof(*lock_file));
int err = 0;
update_index_if_able(&the_index, lock_file);
rollback_lock_file(lock_file);
- if (has_unstaged_changes()) {
+ if (has_unstaged_changes(ignore_submodules)) {
/* TRANSLATORS: the action is e.g. "pull with rebase" */
error(_("Cannot %s: You have unstaged changes."), _(action));
err = 1;
}
- if (has_uncommitted_changes()) {
+ if (has_uncommitted_changes(ignore_submodules)) {
if (err)
error(_("Additionally, your index contains uncommitted changes."));
else
void status_printf(struct wt_status *s, const char *color, const char *fmt, ...);
/* The following functions expect that the caller took care of reading the index. */
-int has_unstaged_changes(void);
-int has_uncommitted_changes(void);
-int require_clean_work_tree(const char *action, const char *hint, int gently);
+int has_unstaged_changes(int ignore_submodules);
+int has_uncommitted_changes(int ignore_submodules);
+int require_clean_work_tree(const char *action, const char *hint,
+ int ignore_submodules, int gently);
#endif /* STATUS_H */