Skip to content

Commit

Permalink
Merge branch 'tr/merge-recursive-flush'
Browse files Browse the repository at this point in the history
Remove unnecessary code.

* tr/merge-recursive-flush:
  merge-recursive: eliminate flush_buffer() in favor of write_in_full()
  • Loading branch information
gitster committed Aug 22, 2012
2 parents 64336eb + f633ea2 commit 8d35c11
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,23 +614,6 @@ static char *unique_path(struct merge_options *o, const char *path, const char *
return newpath;
}

static void flush_buffer(int fd, const char *buf, unsigned long size)
{
while (size > 0) {
long ret = write_in_full(fd, buf, size);
if (ret < 0) {
/* Ignore epipe */
if (errno == EPIPE)
break;
die_errno("merge-recursive");
} else if (!ret) {
die(_("merge-recursive: disk full?"));
}
size -= ret;
buf += ret;
}
}

static int dir_in_way(const char *path, int check_working_copy)
{
int pos, pathlen = strlen(path);
Expand Down Expand Up @@ -789,7 +772,7 @@ static void update_file_flags(struct merge_options *o,
fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode);
if (fd < 0)
die_errno(_("failed to open '%s'"), path);
flush_buffer(fd, buf, size);
write_in_full(fd, buf, size);
close(fd);
} else if (S_ISLNK(mode)) {
char *lnk = xmemdupz(buf, size);
Expand Down

0 comments on commit 8d35c11

Please sign in to comment.