Merge branch 'db/remote-builtin' into jk/send-pack
authorJunio C Hamano <gitster@pobox.com>
Wed, 14 Nov 2007 11:09:52 +0000 (03:09 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Nov 2007 11:09:52 +0000 (03:09 -0800)
* db/remote-builtin:
  Reteach builtin-ls-remote to understand remotes
  Build in ls-remote
  Use built-in send-pack.
  Build-in send-pack, with an API for other programs to call.
  Build-in peek-remote, using transport infrastructure.
  Miscellaneous const changes and utilities

Conflicts:

transport.c

1  2 
Makefile
builtin-fetch.c
builtin-send-pack.c
cache.h
git.c
http-push.c
transport.c
transport.h

diff --cc Makefile
Simple merge
diff --cc builtin-fetch.c
Simple merge
Simple merge
diff --cc cache.h
Simple merge
diff --cc git.c
index 4a250f7e8b84f2334c84daaf93baa0fe1f0ca344,b173f227f0f61f05b2ca1bffd07a1948dc66de16..6c5f9af13af5a59606008efe29291d53b3c0cdc0
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -340,8 -347,9 +342,9 @@@ static void handle_internal_command(in
                { "rev-list", cmd_rev_list, RUN_SETUP },
                { "rev-parse", cmd_rev_parse, RUN_SETUP },
                { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
 -              { "rm", cmd_rm, RUN_SETUP | NEED_WORK_TREE },
 +              { "rm", cmd_rm, RUN_SETUP },
                { "runstatus", cmd_runstatus, RUN_SETUP | NEED_WORK_TREE },
+               { "send-pack", cmd_send_pack, RUN_SETUP },
                { "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER },
                { "show-branch", cmd_show_branch, RUN_SETUP },
                { "show", cmd_show, RUN_SETUP | USE_PAGER },
diff --cc http-push.c
Simple merge
diff --cc transport.c
index e8a2608372de06ef3f77d9a450776e3095057c9f,f4577b7fc6cc95260045403e075597e54dfce526..5cb809bff62a881e34942b2a26d7c04d46db2445
@@@ -649,53 -647,18 +650,19 @@@ static int fetch_refs_via_pack(struct t
        return 0;
  }
  
 -static int git_transport_push(struct transport *transport, int refspec_nr, const char **refspec, int flags) {
 +static int git_transport_push(struct transport *transport, int refspec_nr, const char **refspec, int flags)
 +{
        struct git_transport_data *data = transport->data;
-       const char **argv;
-       char *rem;
-       int argc;
-       int err;
+       struct send_pack_args args;
  
-       argv = xmalloc((refspec_nr + 12) * sizeof(char *));
-       argv[0] = "send-pack";
-       argc = 1;
-       if (flags & TRANSPORT_PUSH_ALL)
-               argv[argc++] = "--all";
-       if (flags & TRANSPORT_PUSH_FORCE)
-               argv[argc++] = "--force";
-       if (flags & TRANSPORT_PUSH_DRY_RUN)
-               argv[argc++] = "--dry-run";
-       if (flags & TRANSPORT_PUSH_VERBOSE)
-               argv[argc++] = "--verbose";
-       if (data->receivepack) {
-               char *rp = xmalloc(strlen(data->receivepack) + 16);
-               sprintf(rp, "--receive-pack=%s", data->receivepack);
-               argv[argc++] = rp;
-       }
-       if (data->thin)
-               argv[argc++] = "--thin";
-       rem = xmalloc(strlen(transport->remote->name) + 10);
-       sprintf(rem, "--remote=%s", transport->remote->name);
-       argv[argc++] = rem;
-       argv[argc++] = transport->url;
-       while (refspec_nr--)
-               argv[argc++] = *refspec++;
-       argv[argc] = NULL;
-       err = run_command_v_opt(argv, RUN_GIT_CMD);
-       switch (err) {
-       case -ERR_RUN_COMMAND_FORK:
-               error("unable to fork for %s", argv[0]);
-       case -ERR_RUN_COMMAND_EXEC:
-               error("unable to exec %s", argv[0]);
-               break;
-       case -ERR_RUN_COMMAND_WAITPID:
-       case -ERR_RUN_COMMAND_WAITPID_WRONG_PID:
-       case -ERR_RUN_COMMAND_WAITPID_SIGNAL:
-       case -ERR_RUN_COMMAND_WAITPID_NOEXIT:
-               error("%s died with strange error", argv[0]);
-       }
-       return !!err;
+       args.receivepack = data->receivepack;
+       args.send_all = !!(flags & TRANSPORT_PUSH_ALL);
+       args.force_update = !!(flags & TRANSPORT_PUSH_FORCE);
+       args.use_thin_pack = data->thin;
 -      args.verbose = transport->verbose;
++      args.verbose = !!(flags & TRANSPORT_PUSH_VERBOSE);
+       args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN);
+       return send_pack(&args, transport->url, transport->remote, refspec_nr, refspec);
  }
  
  static int disconnect_git(struct transport *transport)
diff --cc transport.h
Simple merge