much snippage below, keeping just enough context to see which file,
function, etc:
On Thu, Jun 25, 2020 at 5:49 AM Alban Gruin [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/builtin/merge-one-file.c b/builtin/merge-one-file.c
new file mode 100644
index 0000000000..4992a6cd30
--- /dev/null
+++ b/builtin/merge-one-file.c
quoted hunk ↗ jump to hunk
+static int do_merge_one_file(const struct object_id *orig_blob,
+ const struct object_id *our_blob,
+ const struct object_id *their_blob, const char *path,
+ unsigned int orig_mode, unsigned int our_mode, unsigned int their_mode)
+{
+ int ret, source, dest;
quoted hunk ↗ jump to hunk
+ source = open(src1.buf, O_RDONLY);
+ dest = open(path, O_WRONLY | O_TRUNC);
+
+ copy_fd(source, dest);
+
+ close(source);
+ close(dest);
+
+ unlink(orig.buf);
+ unlink(src1.buf);
+ unlink(src2.buf);
Some of this goes away in subsequent patches, but most of these calls
should be checked for error returns, especially the two `open`s in case
someone has messed with permissions.
Chris