Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit ea0159bd authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

dirstate: make it mandatory to provide parentfiledata in `set_clean`

Gathering the mode, size and mtime, independently from determining that the file
is clean is a race-machine. So we just make these information required arguments.

(note that the data is still gathered in a racy way in practice, but at least
the API is no longer encouraging it.)

Differential Revision:
parent 9f1b9e128788
......@@ -257,7 +257,7 @@ class gitdirstate(object):
if match(p):
yield p
def set_clean(self, f, parentfiledata=None):
def set_clean(self, f, parentfiledata):
"""Mark a file normal and clean."""
# TODO: for now we just let libgit2 re-stat the file. We can
# clearly do better.
......@@ -486,15 +486,12 @@ class dirstate(object):
return ret
def set_clean(self, filename, parentfiledata=None):
def set_clean(self, filename, parentfiledata):
"""record that the current state of the file on disk is known to be clean"""
self._dirty = True
if parentfiledata:
(mode, size, mtime) = parentfiledata
(mode, size, mtime) = self._get_filedata(filename)
if not self._map[filename].tracked:
(mode, size, mtime) = parentfiledata
self._map.set_clean(filename, mode, size, mtime)
if mtime > self._lastnormaltime:
# Remember the most recent modification timeslot for status(),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment