From: Felipe Contreras <felipe.contreras@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
Daniel Barkalow <barkalow@iabervon.org>
Subject: Re: [PATCH] Add new git-remote-hd helper
Date: Thu, 18 Oct 2012 07:18:49 +0200 [thread overview]
Message-ID: <CAMP44s1b=dNaCbm1WkFBv6368Y+jDYdkPuscEFdiUnVJBStfVg@mail.gmail.com> (raw)
In-Reply-To: <CAMP44s0+Fhtj2rMQ1Av-49Koa=DumX8JZs5angOFSRzqtDc+9Q@mail.gmail.com>
On Thu, Oct 18, 2012 at 5:44 AM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> On Thu, Oct 18, 2012 at 12:59 AM, Jeff King <peff@peff.net> wrote:
>> On Wed, Oct 17, 2012 at 02:58:41PM +0200, Felipe Contreras wrote:
>>
>>> I've looked at many hg<->git tools and none satisfy me. Too complicated, or too
>>> slow, or to difficult to setup, etc.
>>
>> I run into this every few months, evaluate all of the options, and come
>> to the same conclusion. So I am excited at the prospect of something
>> simple that just works out of the box.
>>
>> Unfortunately, when I tried it, it did not work for me. :(
Ok, I've fixed all those issues:
http://github.com/felipec/git/blob/fc-remote-hg/contrib/remote-hg/git-remote-hg
Right now I've just added an error when using remote repositories. But
it seems there's no way around it; if we want to have support for
remote repos, we need to make a local clone.
> But at the moment it should fail at this point, I wonder why you get
> the errors below.
>
>> error: refs/tags/VIMPERATOR_2_2_b1 does not point to a valid object!
>> error: refs/tags/muttator-0.5 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b1 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b2 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b3 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b4 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b4.1 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b4.2 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b4.3 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b5 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b5.1 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b6 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b7 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0b7.1 does not point to a valid object!
>> error: refs/tags/pentadactyl-1.0rc1 does not point to a valid object!
>> error: refs/tags/vimperator-0.4.1 does not point to a valid object!
>> error: refs/tags/vimperator-0.5 does not point to a valid object!
>> error: refs/tags/vimperator-0.5-branch-HEAD-merge-1 does not point to a valid object!
>> error: refs/tags/vimperator-0.5.1 does not point to a valid object!
>> error: refs/tags/vimperator-0.5.2 does not point to a valid object!
>> error: refs/tags/vimperator-0.5.3 does not point to a valid object!
>> error: refs/tags/vimperator-1.0 does not point to a valid object!
>> error: refs/tags/vimperator-1.1 does not point to a valid object!
>> error: refs/tags/vimperator-1.2 does not point to a valid object!
>> error: refs/tags/vimperator-2.0 does not point to a valid object!
>> error: refs/tags/vimperator-2.0a1 does not point to a valid object!
>> error: refs/tags/vimperator-2.1 does not point to a valid object!
>> error: refs/tags/vimperator-2.2 does not point to a valid object!
>> error: refs/tags/vimperator-2.2b1 does not point to a valid object!
>> error: refs/tags/xulmus-0.1 does not point to a valid object!
>
> This is weird.
I think I know why the errors above show up; even though the helper
dies, transport-helper doesn't check the status until the very end.
Something like this should do the trick:
diff --git a/run-command.c b/run-command.c
index 1101ef7..0a859ca 100644
--- a/run-command.c
+++ b/run-command.c
@@ -559,6 +559,21 @@ int run_command(struct child_process *cmd)
return finish_command(cmd);
}
+int check_command(struct child_process *cmd)
+{
+ int status;
+ pid_t pid;
+
+ pid = waitpid(cmd->pid, &status, WNOHANG);
+
+ if (pid != cmd->pid)
+ return -1;
+ if (WIFSIGNALED(status))
+ return WTERMSIG(status);
+ if (WIFEXITED(status))
+ return WEXITSTATUS(status);
+}
+
static void prepare_run_command_v_opt(struct child_process *cmd,
const char **argv,
int opt)
diff --git a/run-command.h b/run-command.h
index 44f7d2b..9019e38 100644
--- a/run-command.h
+++ b/run-command.h
@@ -45,6 +45,7 @@ struct child_process {
int start_command(struct child_process *);
int finish_command(struct child_process *);
int run_command(struct child_process *);
+int check_command(struct child_process *cmd);
extern int run_hook(const char *index_file, const char *name, ...);
diff --git a/transport-helper.c b/transport-helper.c
index cfe0988..bc1349d 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -441,6 +441,10 @@ static int fetch_with_import(struct transport *transport,
if (finish_command(&fastimport))
die("Error while running fast-import");
+
+ if (check_command(data->helper))
+ die("Error while running helper");
+
free(fastimport.argv);
fastimport.argv = NULL;
@@ -784,6 +788,10 @@ static int push_refs_with_export(struct transport
*transport,
if (finish_command(&exporter))
die("Error while running fast-export");
+
+ if (check_command(data->helper))
+ die("Error while running helper");
+
push_update_refs_status(data, remote_refs);
return 0;
}
--
Felipe Contreras
next prev parent reply other threads:[~2012-10-18 5:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 12:58 [PATCH] Add new git-remote-hd helper Felipe Contreras
2012-10-17 16:03 ` Johannes Schindelin
2012-10-17 16:38 ` Felipe Contreras
2012-10-17 17:39 ` Johannes Schindelin
2012-10-17 18:12 ` Felipe Contreras
2012-10-17 18:18 ` Sverre Rabbelier
2012-10-17 18:33 ` Felipe Contreras
2012-10-18 8:47 ` Johannes Schindelin
2012-10-18 9:03 ` Felipe Contreras
2012-10-18 9:10 ` Johannes Schindelin
2012-10-18 9:26 ` Junio C Hamano
2012-10-18 9:38 ` Felipe Contreras
2012-10-18 9:42 ` Matthieu Moy
2012-10-21 18:03 ` Felipe Contreras
2012-10-21 20:03 ` Johannes Schindelin
2012-10-21 20:31 ` Felipe Contreras
2012-10-17 22:59 ` Jeff King
2012-10-18 3:44 ` Felipe Contreras
2012-10-18 5:18 ` Felipe Contreras [this message]
2012-10-18 6:12 ` Sverre Rabbelier
2012-10-18 9:10 ` Felipe Contreras
2012-10-18 9:13 ` Johannes Schindelin
2012-10-18 9:22 ` Felipe Contreras
2012-10-26 9:02 ` Felipe Contreras
2012-10-18 8:48 ` Felipe Contreras
2012-10-18 13:18 ` Michael J Gruber
2012-10-18 14:26 ` Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMP44s1b=dNaCbm1WkFBv6368Y+jDYdkPuscEFdiUnVJBStfVg@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ilari.liusvaara@elisanet.fi \
--cc=peff@peff.net \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).