mirror of
https://github.com/git/git
synced 2024-08-24 10:15:51 +00:00
Merge branch 'cc/replace-edit'
Teach "git replace" an "--edit" mode. * cc/replace-edit: replace: use argv_array in export_object avoid double close of descriptors handed to run_command replace: replace spaces with tabs in indentation
This commit is contained in:
commit
dcc1b38517
|
@ -193,22 +193,22 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f
|
||||||
*/
|
*/
|
||||||
static void export_object(const unsigned char *sha1, const char *filename)
|
static void export_object(const unsigned char *sha1, const char *filename)
|
||||||
{
|
{
|
||||||
const char *argv[] = { "--no-replace-objects", "cat-file", "-p", NULL, NULL };
|
struct child_process cmd = { NULL };
|
||||||
struct child_process cmd = { argv };
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
die_errno("unable to open %s for writing", filename);
|
die_errno("unable to open %s for writing", filename);
|
||||||
|
|
||||||
argv[3] = sha1_to_hex(sha1);
|
argv_array_push(&cmd.args, "--no-replace-objects");
|
||||||
|
argv_array_push(&cmd.args, "cat-file");
|
||||||
|
argv_array_push(&cmd.args, "-p");
|
||||||
|
argv_array_push(&cmd.args, sha1_to_hex(sha1));
|
||||||
cmd.git_cmd = 1;
|
cmd.git_cmd = 1;
|
||||||
cmd.out = fd;
|
cmd.out = fd;
|
||||||
|
|
||||||
if (run_command(&cmd))
|
if (run_command(&cmd))
|
||||||
die("cat-file reported failure");
|
die("cat-file reported failure");
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
1
daemon.c
1
daemon.c
|
@ -778,7 +778,6 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
|
||||||
logerror("unable to fork");
|
logerror("unable to fork");
|
||||||
else
|
else
|
||||||
add_child(&cld, addr, addrlen);
|
add_child(&cld, addr, addrlen);
|
||||||
close(incoming);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void child_handler(int signo)
|
static void child_handler(int signo)
|
||||||
|
|
Loading…
Reference in a new issue