* Re: [gentoo-portage-dev] [PATCH] repoman.modules.vcs.git.changes: reindex (bug 712106)
@ 2020-03-11 16:37 99% ` Alec Warner
0 siblings, 0 replies; 1+ results
From: Alec Warner @ 2020-03-11 16:37 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]
On Wed, Mar 11, 2020 at 12:16 AM Zac Medico <zmedico@gentoo.org> wrote:
> For files returned by git diff-index, call git update-index in order
> to ensure that the index reflects the state on disk. This will prevent
> incorrect assumptions in cases where the index is missing or stale for
> some reason. Since repoman uses this information to decide when to
> update copyright header dates, this can prevent spurious copyright
> header updates.
>
> Signed-off-by: Zac Medico <zmedico@gentoo.org>
> Bug: https://bugs.gentoo.org/712106
> ---
> repoman/lib/repoman/modules/vcs/git/changes.py | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/repoman/lib/repoman/modules/vcs/git/changes.py
> b/repoman/lib/repoman/modules/vcs/git/changes.py
> index 7e9ac1eb5..ebf770d53 100644
> --- a/repoman/lib/repoman/modules/vcs/git/changes.py
> +++ b/repoman/lib/repoman/modules/vcs/git/changes.py
> @@ -29,8 +29,14 @@ class Changes(ChangesBase):
> '''
> super(Changes, self).__init__(options, repo_settings)
>
> - def _scan(self):
> - '''VCS type scan function, looks for all detectable
> changes'''
> + def _scan(self, _reindex=True):
>
Why the underscore prefix?
-A
> + '''
> + VCS type scan function, looks for all detectable changes
> +
> + @param _reindex: ensure that the git index reflects the
> state on
> + disk for files returned by git diff-index
> + @type _reindex: bool
> + '''
> with repoman_popen(
> "git diff-index --name-only "
> "--relative --diff-filter=M HEAD") as f:
> @@ -51,6 +57,9 @@ class Changes(ChangesBase):
> removed = f.readlines()
> self.removed = ["./" + elem[:-1] for elem in removed]
> del removed
> + if _reindex and (self.changed or self.new or self.removed):
> + self.update_index([], self.changed + self.new +
> self.removed)
> + self._scan(_reindex=False)
>
> @property
> def unadded(self):
> @@ -91,7 +100,7 @@ class Changes(ChangesBase):
> # of the working tree.
> myfiles = mymanifests + myupdates
> myfiles.sort()
> - update_index_cmd = ["git", "update-index"]
> + update_index_cmd = ["git", "update-index", "--add",
> "--remove"]
> update_index_cmd.extend(f.lstrip("./") for f in myfiles)
> if self.options.pretend:
> print("(%s)" % (" ".join(update_index_cmd),))
> --
> 2.24.1
>
>
>
[-- Attachment #2: Type: text/html, Size: 3924 bytes --]
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-03-11 7:13 [gentoo-portage-dev] [PATCH] repoman.modules.vcs.git.changes: reindex (bug 712106) Zac Medico
2020-03-11 16:37 99% ` Alec Warner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox