<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/progress.c, branch v2.16.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.16.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.16.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-12-19T19:33:55Z</updated>
<entry>
<title>Merge branch 'en/rename-progress'</title>
<updated>2017-12-19T19:33:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-12-19T19:33:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=646685460c26d56b149da91544e76150119d9c9b'/>
<id>urn:sha1:646685460c26d56b149da91544e76150119d9c9b</id>
<content type='text'>
Historically, the diff machinery for rename detection had a
hardcoded limit of 32k paths; this is being lifted to allow users
trade cycles with a (possibly) easier to read result.

* en/rename-progress:
  diffcore-rename: make diff-tree -l0 mean -l&lt;large&gt;
  sequencer: show rename progress during cherry picks
  diff: remove silent clamp of renameLimit
  progress: fix progress meters when dealing with lots of work
  sequencer: warn when internal merge may be suboptimal due to renameLimit
</content>
</entry>
<entry>
<title>progress: drop delay-threshold code</title>
<updated>2017-12-04T22:22:18Z</updated>
<author>
<name>Lars Schneider</name>
<email>larsxschneider@gmail.com</email>
</author>
<published>2017-12-04T22:07:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9c5951cacf5cf2a4828480176921ca0307d22746'/>
<id>urn:sha1:9c5951cacf5cf2a4828480176921ca0307d22746</id>
<content type='text'>
Since 180a9f2268 (provide a facility for "delayed" progress
reporting, 2007-04-20), the progress code has allowed
callers to skip showing progress if they have reached a
percentage-threshold of the total work before the delay
period passes.

But since 8aade107dd (progress: simplify "delayed" progress
API, 2017-08-19), that parameter is not available to outside
callers (we always passed zero after that commit, though
that was corrected in the previous commit to "100%").

Let's drop the threshold code, which never triggers in
any meaningful way.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: set default delay threshold to 100%, not 0%</title>
<updated>2017-12-04T22:22:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-12-04T22:05:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ee85e41af3f87afedd9fba63617e74713449240c'/>
<id>urn:sha1:ee85e41af3f87afedd9fba63617e74713449240c</id>
<content type='text'>
Commit 8aade107dd (progress: simplify "delayed" progress
API, 2017-08-19) dropped the parameter by which callers
could say "show my progress only if I haven't passed M%
progress after N seconds". The intent was to just show
nothing for 2 seconds, and then always progress after that.

But we flipped the logic in the wrapper: it sets M=0,
meaning that we'd almost _never_ show progress after 2
seconds, since we'd generally have made some progress. This
should have been 100%, not 0%.

We were fooled by existing calls like:

  start_progress_delay("foo", 0, 0, 2);

which behaved this way. The trick is that the first "0"
there is "how many items total", and there zero means "we
don't know". And without knowing that, we cannot compute a
completed percent at all, and we ignored the threshold
parameter entirely! Modeling our wrapper after that broke
callers which pass a non-zero value for "total".

We can switch to the intended behavior by using "100" in the
wrapper call.

Reported-by: Lars Schneider &lt;larsxschneider@gmail.com&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: fix progress meters when dealing with lots of work</title>
<updated>2017-11-15T04:11:25Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2017-11-13T20:15:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d6861d0258df95987696eab6c9bbc138a07190b9'/>
<id>urn:sha1:d6861d0258df95987696eab6c9bbc138a07190b9</id>
<content type='text'>
The possibility of setting merge.renameLimit beyond 2^16 raises the
possibility that the values passed to progress can exceed 2^32.
Use uint64_t, because it "ought to be enough for anybody".  :-)

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: simplify "delayed" progress API</title>
<updated>2017-08-19T21:01:34Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-08-19T17:39:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8aade107dd84dcaff3f23caae80a013878db2de7'/>
<id>urn:sha1:8aade107dd84dcaff3f23caae80a013878db2de7</id>
<content type='text'>
We used to expose the full power of the delayed progress API to the
callers, so that they can specify, not just the message to show and
expected total amount of work that is used to compute the percentage
of work performed so far, the percent-threshold parameter P and the
delay-seconds parameter N.  The progress meter starts to show at N
seconds into the operation only if we have not yet completed P per-cent
of the total work.

Most callers used either (0%, 2s) or (50%, 1s) as (P, N), but there
are oddballs that chose more random-looking values like 95%.

For a smoother workload, (50%, 1s) would allow us to start showing
the progress meter earlier than (0%, 2s), while keeping the chance
of not showing progress meter for long running operation the same as
the latter.  For a task that would take 2s or more to complete, it
is likely that less than half of it would complete within the first
second, if the workload is smooth.  But for a spiky workload whose
earlier part is easier, such a setting is likely to fail to show the
progress meter entirely and (0%, 2s) is more appropriate.

But that is merely a theory.  Realistically, it is of dubious value
to ask each codepath to carefully consider smoothness of their
workload and specify their own setting by passing two extra
parameters.  Let's simplify the API by dropping both parameters and
have everybody use (0%, 2s).

Oh, by the way, the percent-threshold parameter and the structure
member were consistently misspelled, which also is now fixed ;-)

Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: show overall rate in last update</title>
<updated>2017-07-09T16:54:20Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-07-08T16:43:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0fae1e072a925b76f35666c9bcd965ea5e3e5574'/>
<id>urn:sha1:0fae1e072a925b76f35666c9bcd965ea5e3e5574</id>
<content type='text'>
The values in struct throughput are only updated every 0.5 seconds.  If
we're all done before that time span then the final update will show a
rate of 0 bytes/s, which is misleading if some bytes had been handled.
Remember the start time and show the total throughput instead.

And avoid division by zero by enforcing a minimum time span value of 1
(unit: 1/1024th of a second).  That makes the resulting rate an
underestimation, but it's closer to the actual value than the currently
shown 0 bytes/s.

Reported-by: 積丹尼 Dan Jacobson &lt;jidanni@jidanni.org&gt;
Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stop_progress_msg: convert xsnprintf to xstrfmt</title>
<updated>2017-02-16T19:28:02Z</updated>
<author>
<name>Maxim Moseychuk</name>
<email>franchesko.salias.hudro.pedros@gmail.com</email>
</author>
<published>2017-02-16T17:07:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fbd09439c097123346d9823b88c87438bf5a11ae'/>
<id>urn:sha1:fbd09439c097123346d9823b88c87438bf5a11ae</id>
<content type='text'>
Simplify code by replacing buffer allocation with a call to xstrfmt().

Signed-off-by: Maxim Moseychuk &lt;franchesko.salias.hudro.pedros@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>use xmallocz to avoid size arithmetic</title>
<updated>2016-02-22T22:51:09Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-22T22:44:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3733e6946465d4a3a1d89026a5ec911d3af339ab'/>
<id>urn:sha1:3733e6946465d4a3a1d89026a5ec911d3af339ab</id>
<content type='text'>
We frequently allocate strings as xmalloc(len + 1), where
the extra 1 is for the NUL terminator. This can be done more
simply with xmallocz, which also checks for integer
overflow.

There's no case where switching xmalloc(n+1) to xmallocz(n)
is wrong; the result is the same length, and malloc made no
guarantees about what was in the buffer anyway. But in some
cases, we can stop manually placing NUL at the end of the
allocated buffer. But that's only safe if it's clear that
the contents will always fill the buffer.

In each case where this patch does so, I manually examined
the control flow, and I tried to err on the side of caution.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>stop_progress_msg: convert sprintf to xsnprintf</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:06:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f5691aa640ae2c1c5f85037e093de7f310c0eac7'/>
<id>urn:sha1:f5691aa640ae2c1c5f85037e093de7f310c0eac7</id>
<content type='text'>
The usual arguments for using xsnprintf over sprintf apply,
but this case is a little tricky. We print to a fixed-size
buffer if we have room, and otherwise to an allocated
buffer. So there should be no overflow here, but it is still
good to communicate our intention, as well as to check our
earlier math for how much space the string will need.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>progress: store throughput display in a strbuf</title>
<updated>2015-09-25T17:18:18Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T21:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3131977de1476185209d4d56a0494f5b30ee5557'/>
<id>urn:sha1:3131977de1476185209d4d56a0494f5b30ee5557</id>
<content type='text'>
Coverity noticed that we strncpy() into a fixed-size buffer
without making sure that it actually ended up
NUL-terminated. This is unlikely to be a bug in practice,
since throughput strings rarely hit 32 characters, but it
would be nice to clean it up.

The most obvious way to do so is to add a NUL-terminator.
But instead, this patch switches the fixed-size buffer out
for a strbuf. At first glance this seems much less
efficient, until we realize that filling in the fixed-size
buffer is done by writing into a strbuf and copying the
result!

By writing straight to the buffer, we actually end up more
efficient:

  1. We avoid an extra copy of the bytes.

  2. Rather than malloc/free each time progress is shown, we
     can strbuf_reset and use the same buffer each time.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
