summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2019-06-13 12:42:39 -0400
committerMike Frysinger <vapier@google.com>2019-06-14 14:47:01 +0000
commit0c0e934b699cd4b6da623c208069c4ca40a0c405 (patch)
treee41998ba4236bbb63cd427c302670b9f5724c88f /subcmds/sync.py
parent9e71842fbfa2ee7ef7ffd54fed5815c31ccdef2d (diff)
downloadgit-repo-0c0e934b699cd4b6da623c208069c4ca40a0c405.tar.gz
sync: use integer division with job counts
Neither of the fields here expect floats so make sure we use integer division when calculating things. Bug: https://crbug.com/gerrit/10418 Change-Id: Ibda068b16a7bba7ff3efba442c4bbff4415caa6e
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 2e92584e..02cd3879 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -436,7 +436,7 @@ later is required to fix a server side protocol bug.
436 bare_git.gc('--auto') 436 bare_git.gc('--auto')
437 return 437 return
438 438
439 config = {'pack.threads': cpu_count / jobs if cpu_count > jobs else 1} 439 config = {'pack.threads': cpu_count // jobs if cpu_count > jobs else 1}
440 440
441 threads = set() 441 threads = set()
442 sem = _threading.Semaphore(jobs) 442 sem = _threading.Semaphore(jobs)
@@ -598,7 +598,7 @@ later is required to fix a server side protocol bug.
598 self.jobs = opt.jobs 598 self.jobs = opt.jobs
599 if self.jobs > 1: 599 if self.jobs > 1:
600 soft_limit, _ = _rlimit_nofile() 600 soft_limit, _ = _rlimit_nofile()
601 self.jobs = min(self.jobs, (soft_limit - 5) / 3) 601 self.jobs = min(self.jobs, (soft_limit - 5) // 3)
602 602
603 if opt.network_only and opt.detach_head: 603 if opt.network_only and opt.detach_head:
604 print('error: cannot combine -n and -d', file=sys.stderr) 604 print('error: cannot combine -n and -d', file=sys.stderr)