Make the untracked+ignored warning accurate

If you have too many bytes of untracked+ignored data in your repo then
gclient sync will fail, confidently telling you how many bytes of this
type you have. The problem is, it lies. It reports the level as soon as
it is exceeded, even though it has not finished totaling up the file
sizes. This change makes the reporting accurate.

I noticed this problem because "gclient sync" told me I had 1049.9 MB
of untracked data. I deleted some and it then said I had 1563.9 MB of
untracked data. Hmmm.

Bug: 376099
Change-Id: I797a4279ad666d83c4a5fbd54bdf7ddbf0e7ad84
Reviewed-on: https://chromium-review.googlesource.com/850854
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
changes/54/850854/3
Bruce Dawson 8 years ago committed by Commit Bot
parent 1adc91f99f
commit 4bff3fdca7

@ -435,25 +435,25 @@ def freeze():
if limit_mb > 0: if limit_mb > 0:
if s.lstat == '?': if s.lstat == '?':
untracked_bytes += os.stat(os.path.join(root_path, f)).st_size untracked_bytes += os.stat(os.path.join(root_path, f)).st_size
if untracked_bytes > limit_mb * MB: if limit_mb > 0 and untracked_bytes > limit_mb * MB:
die("""\ die("""\
You appear to have too much untracked+unignored data in your git You appear to have too much untracked+unignored data in your git
checkout: %.1f / %d MB. checkout: %.1f / %d MB.
Run `git status` to see what it is. Run `git status` to see what it is.
In addition to making many git commands slower, this will prevent In addition to making many git commands slower, this will prevent
depot_tools from freezing your in-progress changes. depot_tools from freezing your in-progress changes.
You should add untracked data that you want to ignore to your repo's You should add untracked data that you want to ignore to your repo's
.git/info/exclude .git/info/exclude
file. See `git help ignore` for the format of this file. file. See `git help ignore` for the format of this file.
If this data is indended as part of your commit, you may adjust the If this data is indended as part of your commit, you may adjust the
freeze limit by running: freeze limit by running:
git config %s <new_limit> git config %s <new_limit>
Where <new_limit> is an integer threshold in megabytes.""", Where <new_limit> is an integer threshold in megabytes.""",
untracked_bytes / (MB * 1.0), limit_mb, key) untracked_bytes / (MB * 1.0), limit_mb, key)
try: try:
run('commit', '--no-verify', '-m', FREEZE + '.indexed') run('commit', '--no-verify', '-m', FREEZE + '.indexed')

Loading…
Cancel
Save