<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/wrapper.c, branch v2.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.6.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-08-25T19:48:39Z</updated>
<entry>
<title>write_file_v(): do not leave incomplete line at the end</title>
<updated>2015-08-25T19:48:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-24T16:39:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e7ffa38c6e726e8014b76297b06f78e008deb2d0'/>
<id>urn:sha1:e7ffa38c6e726e8014b76297b06f78e008deb2d0</id>
<content type='text'>
All existing callers to this function use it to produce a text file
or an empty file, and a new callsite that mimick them must end their
payload with a LF.  If they forget to do so, the resulting file will
end with an incomplete line.

Teach write_file_v() to complete the incomplete line, if exists, so
that the callers do not have to.

With this, the caller-side fix in builtin/am.c becomes unnecessary.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>write_file(): drop "fatal" parameter</title>
<updated>2015-08-24T20:09:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-24T20:03:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12d6ce1dba504dfc5279b8d24da3edb4865c2820'/>
<id>urn:sha1:12d6ce1dba504dfc5279b8d24da3edb4865c2820</id>
<content type='text'>
All callers except three passed 1 for the "fatal" parameter to ask
this function to die upon error, but to a casual reader of the code,
it was not all obvious what that 1 meant.  Instead, split the
function into two based on a common write_file_v() that takes the
flag, introduce write_file_gently() as a new way to attempt creating
a file without dying on error, and make three callers to call it.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper: implement xfopen()</title>
<updated>2015-08-05T05:02:11Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-08-04T13:51:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=260eec292736388831958637eccdcf1a8f00e14d'/>
<id>urn:sha1:260eec292736388831958637eccdcf1a8f00e14d</id>
<content type='text'>
A common usage pattern of fopen() is to check if it succeeded, and die()
if it failed:

	FILE *fp = fopen(path, "w");
	if (!fp)
		die_errno(_("could not open '%s' for writing"), path);

Implement a wrapper function xfopen() for the above, so that we can save
a few lines of code and make the die() messages consistent.

Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper: implement xopen()</title>
<updated>2015-08-05T05:02:11Z</updated>
<author>
<name>Paul Tan</name>
<email>pyokagan@gmail.com</email>
</author>
<published>2015-08-04T13:51:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ff53df7b4cbc331d302181d2d6644f4cb860a52'/>
<id>urn:sha1:3ff53df7b4cbc331d302181d2d6644f4cb860a52</id>
<content type='text'>
A common usage pattern of open() is to check if it was successful, and
die() if it was not:

	int fd = open(path, O_WRONLY | O_CREAT, 0777);
	if (fd &lt; 0)
		die_errno(_("Could not open '%s' for writing."), path);

Implement a wrapper function xopen() that does the above so that we can
save a few lines of code, and make the die() messages consistent.

Helped-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Paul Tan &lt;pyokagan@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>help.c: wrap wait-only poll() invocation in sleep_millisec()</title>
<updated>2015-06-05T22:00:32Z</updated>
<author>
<name>Johannes Sixt</name>
<email>j6t@kdbg.org</email>
</author>
<published>2015-06-05T19:45:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2024d3176536fd437b4c0a744161e96bc150a24e'/>
<id>urn:sha1:2024d3176536fd437b4c0a744161e96bc150a24e</id>
<content type='text'>
We want to use the new function elsewhere in a moment.

Signed-off-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Reviewed-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/multiple-work-trees'</title>
<updated>2015-05-11T21:23:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-11T21:23:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68a2e6a2c80303144807c8c91a087427e3c8e727'/>
<id>urn:sha1:68a2e6a2c80303144807c8c91a087427e3c8e727</id>
<content type='text'>
A replacement for contrib/workdir/git-new-workdir that does not
rely on symbolic links and make sharing of objects and refs safer
by making the borrowee and borrowers aware of each other.

* nd/multiple-work-trees: (41 commits)
  prune --worktrees: fix expire vs worktree existence condition
  t1501: fix test with split index
  t2026: fix broken &amp;&amp;-chain
  t2026 needs procondition SANITY
  git-checkout.txt: a note about multiple checkout support for submodules
  checkout: add --ignore-other-wortrees
  checkout: pass whole struct to parse_branchname_arg instead of individual flags
  git-common-dir: make "modules/" per-working-directory directory
  checkout: do not fail if target is an empty directory
  t2025: add a test to make sure grafts is working from a linked checkout
  checkout: don't require a work tree when checking out into a new one
  git_path(): keep "info/sparse-checkout" per work-tree
  count-objects: report unused files in $GIT_DIR/worktrees/...
  gc: support prune --worktrees
  gc: factor out gc.pruneexpire parsing code
  gc: style change -- no SP before closing parenthesis
  checkout: clean up half-prepared directories in --to mode
  checkout: reject if the branch is already checked out elsewhere
  prune: strategies for linked checkouts
  checkout: support checking out into a new working directory
  ...
</content>
</entry>
<entry>
<title>Merge branch 'jc/max-io-size-and-ssize-max'</title>
<updated>2015-02-25T23:40:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-02-25T23:40:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=81a535da88617e2ae24b79a9d7413008e0ebc23b'/>
<id>urn:sha1:81a535da88617e2ae24b79a9d7413008e0ebc23b</id>
<content type='text'>
Our default I/O size (8 MiB) for large files was too large for some
platforms with smaller SSIZE_MAX, leading to read(2)/write(2)
failures.

* jc/max-io-size-and-ssize-max:
  xread/xwrite: clip MAX_IO_SIZE to SSIZE_MAX
</content>
</entry>
<entry>
<title>xread/xwrite: clip MAX_IO_SIZE to SSIZE_MAX</title>
<updated>2015-02-12T19:01:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-02-11T21:13:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a983e6ac58094a3b2466ad3be13049ce213f9fc3'/>
<id>urn:sha1:a983e6ac58094a3b2466ad3be13049ce213f9fc3</id>
<content type='text'>
Since 0b6806b9 (xread, xwrite: limit size of IO to 8MB, 2013-08-20),
we chomp our calls to read(2) and write(2) into chunks of
MAX_IO_SIZE bytes (8 MiB), because a large IO results in a bad
latency when the program needs to be killed.  This also brought our
IO below SSIZE_MAX, which is a limit POSIX allows read(2) and
write(2) to fail when the IO size exceeds it, for OS X, where a
problem was originally reported.

However, there are other systems that define SSIZE_MAX smaller than
our default, and feeding 8 MiB to underlying read(2)/write(2) would
fail.  Make sure we clip our calls to the lower limit as well.

Reported-by: Joachim Schmitz &lt;jojo@schmitz-digital.de&gt;
Helped-by: Torsten Bögershausen &lt;tboegi@web.de&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper.c: wrapper to open a file, fprintf then close</title>
<updated>2014-12-01T19:00:16Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2014-11-30T08:24:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=316e53e68c7c4d89876524f7f010685ebfe7be1e'/>
<id>urn:sha1:316e53e68c7c4d89876524f7f010685ebfe7be1e</id>
<content type='text'>
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>wrapper.c: add a new function unlink_or_msg</title>
<updated>2014-10-15T17:47:21Z</updated>
<author>
<name>Ronnie Sahlberg</name>
<email>sahlberg@google.com</email>
</author>
<published>2014-07-16T18:20:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ccc0c089667e6dccc888590376f138521784e5e'/>
<id>urn:sha1:9ccc0c089667e6dccc888590376f138521784e5e</id>
<content type='text'>
This behaves like unlink_or_warn except that on failure it writes the message
to its 'err' argument, which the caller can display in an appropriate way or
ignore.

Signed-off-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Reviewed-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
