The core of the helper script is a loop reading commands. After most commands, we want to read more, until we get an empty command that signals we're done. The "export" command is different, though; all of the rest of the input goes to fast-import, and there is nothing left for us to read. This caused us to print a warning that we got EOF, even though it is expected in this case. This was just a warning, so it didn't cause any tests to fail, but the testgit helper is supposed to act as a reference implementation. We should try to set a good example. This patch lets each command handler tell the main loop whether it should expect more commands or not; the handler exits gracefully if no more are expected. Signed-off-by: Jeff King <peff@xxxxxxxx> --- git-remote-testgit.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/git-remote-testgit.py b/git-remote-testgit.py index df9d512..937b858 100644 --- a/git-remote-testgit.py +++ b/git-remote-testgit.py @@ -74,6 +74,7 @@ def do_capabilities(repo, args): print "refspec refs/heads/*:%s*" % repo.prefix print # end capabilities + return True def do_list(repo, args): @@ -96,6 +97,7 @@ def do_list(repo, args): print "@refs/heads/master HEAD" print # end list + return True def update_local_repo(repo): @@ -123,6 +125,7 @@ def do_import(repo, args): repo = update_local_repo(repo) repo.exporter.export_repo(repo.gitdir) + return True def do_export(repo, args): @@ -148,6 +151,7 @@ def do_export(repo, args): update_local_repo(repo) repo.importer.do_import(repo.gitdir) repo.non_local.push(repo.gitdir) + return False def do_gitdir(repo, args): @@ -158,6 +162,7 @@ def do_gitdir(repo, args): die("gitdir needs an argument") repo.gitdir = ' '.join(args) + return True COMMANDS = { @@ -203,7 +208,8 @@ def read_one_line(repo): die("Unknown command, %s", cmd) func = COMMANDS[cmd] - func(repo, cmdline) + if not func(repo, cmdline): + return False sys.stdout.flush() return True -- 1.7.6.rc0.35.gc40cb -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html