commit:     f11cabb3c9fe7d09d86f40cc716f14e9b0aed765
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 25 19:53:45 2020 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Mar 25 19:54:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f11cabb3

repoman.modules.vcs.git.changes: reindex only for commit mode (bug 712106)

Automatically reindex for commit mode, but not for other modes
were the user might not want changes to be staged in the index.

Bug: https://bugs.gentoo.org/712106
Suggested-by: Jeroen Roovers <jer <AT> gentoo.org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 repoman/lib/repoman/modules/vcs/git/changes.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/repoman/lib/repoman/modules/vcs/git/changes.py 
b/repoman/lib/repoman/modules/vcs/git/changes.py
index 550028434..9819831b5 100644
--- a/repoman/lib/repoman/modules/vcs/git/changes.py
+++ b/repoman/lib/repoman/modules/vcs/git/changes.py
@@ -29,7 +29,7 @@ class Changes(ChangesBase):
                '''
                super(Changes, self).__init__(options, repo_settings)
 
-       def _scan(self, _reindex=True):
+       def _scan(self, _reindex=None):
                '''
                VCS type scan function, looks for all detectable changes
 
@@ -39,6 +39,11 @@ class Changes(ChangesBase):
                        any other reason)
                @type _reindex: bool
                '''
+               # Automatically reindex for commit mode, but not for other modes
+               # were the user might not want changes to be staged in the 
index.
+               if _reindex is None and self.options.mode == 'commit':
+                       _reindex = True
+
                with repoman_popen(
                        "git diff-index --name-only "
                        "--relative --diff-filter=M HEAD") as f:

Reply via email to