| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -563,7 +563,8 @@ def _set_alternates(self, alts): | |||
| 563 | 563 | alternates = property(_get_alternates, _set_alternates, | |
| 564 | 564 | doc="Retrieve a list of alternates paths or set a list paths to be used as alternates") | |
| 565 | 565 | ||
| 566 | - def is_dirty(self, index=True, working_tree=True, untracked_files=False): | ||
| 566 | + def is_dirty(self, index=True, working_tree=True, untracked_files=False, | ||
| 567 | + submodules=True): | ||
| 567 | 568 | """ | |
| 568 | 569 | :return: | |
| 569 | 570 | ``True``, the repository is considered dirty. By default it will react | |
@@ -575,7 +576,9 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False): | |||
| 575 | 576 | return False | |
| 576 | 577 | ||
| 577 | 578 | # start from the one which is fastest to evaluate | |
| 578 | - default_args = ('--abbrev=40', '--full-index', '--raw') | ||
| 579 | + default_args = ['--abbrev=40', '--full-index', '--raw'] | ||
| 580 | + if not submodules: | ||
| 581 | + default_args.append('--ignore-submodules') | ||
| 579 | 582 | if index: | |
| 580 | 583 | # diff index against HEAD | |
| 581 | 584 | if isfile(self.index.path) and \ | |
@@ -588,7 +591,7 @@ def is_dirty(self, index=True, working_tree=True, untracked_files=False): | |||
| 588 | 591 | return True | |
| 589 | 592 | # END working tree handling | |
| 590 | 593 | if untracked_files: | |
| 591 | - if len(self.untracked_files): | ||
| 594 | + if len(self._get_untracked_files(ignore_submodules=not submodules)): | ||
| 592 | 595 | return True | |
| 593 | 596 | # END untracked files | |
| 594 | 597 | return False | |
@@ -604,10 +607,14 @@ def untracked_files(self): | |||
| 604 | 607 | ||
| 605 | 608 | :note: | |
| 606 | 609 | ignored files will not appear here, i.e. files mentioned in .gitignore""" | |
| 610 | + return self._get_untracked_files() | ||
| 611 | + | ||
| 612 | + def _get_untracked_files(self, **kwargs): | ||
| 607 | 613 | # make sure we get all files, no only untracked directores | |
| 608 | 614 | proc = self.git.status(porcelain=True, | |
| 609 | 615 | untracked_files=True, | |
| 610 | - as_process=True) | ||
| 616 | + as_process=True, | ||
| 617 | + **kwargs) | ||
| 611 | 618 | # Untracked files preffix in porcelain mode | |
| 612 | 619 | prefix = "?? " | |
| 613 | 620 | untracked_files = list() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments