-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cleanliness checks more efficient #14
Comments
fwiw here is a code of that def dirty(self) -> bool:
"""Is the repository dirty?
Note: This provides a quick answer when you simply want to know if
there are any untracked changes or modifications in this repository or
its submodules. For finer-grained control and more detailed reporting,
use status() instead.
"""
stdout = self.call_git(
["status", "--porcelain",
# Ensure the result isn't influenced by status.showUntrackedFiles.
"--untracked-files=normal",
# Ensure the result isn't influenced by diff.ignoreSubmodules.
"--ignore-submodules=none"])
if bool(stdout.strip()):
# The quick `git status`-based check can give a different answer
# than `datalad status` for submodules on an adjusted branch.
st = self.diffstatus(fr="HEAD" if self.get_hexsha() else None,
to=None, untracked="normal")
return any(r.get("state") != "clean" for r in st.values())
return False |
@yarikoptic And what exactly does the call to |
well -- code is here : https://github.com/datalad/datalad/blob/HEAD/datalad/support/gitrepo.py#L3086 and your guess might be even better than mine ;) overall -- I do not think it is pertinent to our case really -- can't tell from that function description ... looking at datalad/datalad@4e18d1b which introduced that call -- just again talks about adjusted branches which we can forget about here since I do not think we coded with that in mind anywhere else. So -- direct call to |
Make cleanliness checks more efficient
Currently, when finishing up syncing of a Dandiset dataset, the code checks whether any changes have yet to be committed using DataLad's
status()
method, which (as I understand it) does more work than needed for our purposes. Could we achieve the same results (including checking of submodules) but more efficiently usinggit diff --cached --quiet
or by seeing whethergit status --porcelain
outputs anything?There are also some spots where the code checks for cleanliness using
ds.repo.dirty
. What's the difference? Why shouldrepo.dirty
be preferred overstatus()
or vice versa?CC @yarikoptic
The text was updated successfully, but these errors were encountered: