Code

Merge branch 'sp/maint-push-sideband' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Mar 2010 06:54:50 +0000 (22:54 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Mar 2010 06:54:50 +0000 (22:54 -0800)
* sp/maint-push-sideband:
  receive-pack: Send internal errors over side-band #2
  t5401: Use a bare repository for the remote peer
  receive-pack: Send hook output over side band #2
  receive-pack: Wrap status reports inside side-band-64k
  receive-pack: Refactor how capabilities are shown to the client
  send-pack: demultiplex a sideband stream with status data
  run-command: support custom fd-set in async
  run-command: Allow stderr to be a caller supplied pipe

Conflicts:
builtin-receive-pack.c
run-command.c
t/t5401-update-hooks.sh

1  2 
Documentation/technical/api-run-command.txt
builtin-receive-pack.c
builtin-send-pack.c
convert.c
remote-curl.c
run-command.c
run-command.h

index 4320c93e700a08911e42e3e949656af67b675244,a5543f9918c3150e1581108b770a4d4c281e812c..0559fcc871894548050e99c8c258561a0dcad5c9
@@@ -204,47 -286,59 +286,47 @@@ static int is_ref_checked_out(const cha
        return !strcmp(head_name, ref);
  }
  
 -static char *warn_unconfigured_deny_msg[] = {
 -      "Updating the currently checked out branch may cause confusion,",
 -      "as the index and work tree do not reflect changes that are in HEAD.",
 -      "As a result, you may see the changes you just pushed into it",
 -      "reverted when you run 'git diff' over there, and you may want",
 -      "to run 'git reset --hard' before starting to work to recover.",
 +static char *refuse_unconfigured_deny_msg[] = {
 +      "By default, updating the current branch in a non-bare repository",
 +      "is denied, because it will make the index and work tree inconsistent",
 +      "with what you pushed, and will require 'git reset --hard' to match",
 +      "the work tree to HEAD.",
        "",
        "You can set 'receive.denyCurrentBranch' configuration variable to",
 -      "'refuse' in the remote repository to forbid pushing into its",
 -      "current branch."
 +      "'ignore' or 'warn' in the remote repository to allow pushing into",
 +      "its current branch; however, this is not recommended unless you",
 +      "arranged to update its work tree to match what you pushed in some",
 +      "other way.",
        "",
 -      "To allow pushing into the current branch, you can set it to 'ignore';",
 -      "but this is not recommended unless you arranged to update its work",
 -      "tree to match what you pushed in some other way.",
 -      "",
 -      "To squelch this message, you can set it to 'warn'.",
 -      "",
 -      "Note that the default will change in a future version of git",
 -      "to refuse updating the current branch unless you have the",
 -      "configuration variable set to either 'ignore' or 'warn'."
 +      "To squelch this message and still keep the default behaviour, set",
 +      "'receive.denyCurrentBranch' configuration variable to 'refuse'."
  };
  
 -static void warn_unconfigured_deny(void)
 +static void refuse_unconfigured_deny(void)
  {
        int i;
 -      for (i = 0; i < ARRAY_SIZE(warn_unconfigured_deny_msg); i++)
 -              rp_warning("%s", warn_unconfigured_deny_msg[i]);
 +      for (i = 0; i < ARRAY_SIZE(refuse_unconfigured_deny_msg); i++)
-               error("%s", refuse_unconfigured_deny_msg[i]);
++              rp_error("%s", refuse_unconfigured_deny_msg[i]);
  }
  
 -static char *warn_unconfigured_deny_delete_current_msg[] = {
 -      "Deleting the current branch can cause confusion by making the next",
 -      "'git clone' not check out any file.",
 +static char *refuse_unconfigured_deny_delete_current_msg[] = {
 +      "By default, deleting the current branch is denied, because the next",
 +      "'git clone' won't result in any file checked out, causing confusion.",
        "",
        "You can set 'receive.denyDeleteCurrent' configuration variable to",
 -      "'refuse' in the remote repository to disallow deleting the current",
 -      "branch.",
 -      "",
 -      "You can set it to 'ignore' to allow such a delete without a warning.",
 +      "'warn' or 'ignore' in the remote repository to allow deleting the",
 +      "current branch, with or without a warning message.",
        "",
 -      "To make this warning message less loud, you can set it to 'warn'.",
 -      "",
 -      "Note that the default will change in a future version of git",
 -      "to refuse deleting the current branch unless you have the",
 -      "configuration variable set to either 'ignore' or 'warn'."
 +      "To squelch this message, you can set it to 'refuse'."
  };
  
 -static void warn_unconfigured_deny_delete_current(void)
 +static void refuse_unconfigured_deny_delete_current(void)
  {
        int i;
        for (i = 0;
 -           i < ARRAY_SIZE(warn_unconfigured_deny_delete_current_msg);
 +           i < ARRAY_SIZE(refuse_unconfigured_deny_delete_current_msg);
             i++)
-               error("%s", refuse_unconfigured_deny_delete_current_msg[i]);
 -              rp_warning("%s", warn_unconfigured_deny_delete_current_msg[i]);
++              rp_error("%s", refuse_unconfigured_deny_delete_current_msg[i]);
  }
  
  static const char *update(struct command *cmd)
                switch (deny_current_branch) {
                case DENY_IGNORE:
                        break;
 -              case DENY_UNCONFIGURED:
                case DENY_WARN:
-                       warning("updating the current branch");
+                       rp_warning("updating the current branch");
 -                      if (deny_current_branch == DENY_UNCONFIGURED)
 -                              warn_unconfigured_deny();
                        break;
                case DENY_REFUSE:
-                       error("refusing to update checked out branch: %s", name);
 +              case DENY_UNCONFIGURED:
+                       rp_error("refusing to update checked out branch: %s", name);
 +                      if (deny_current_branch == DENY_UNCONFIGURED)
 +                              refuse_unconfigured_deny();
                        return "branch is currently checked out";
                }
        }
                        case DENY_IGNORE:
                                break;
                        case DENY_WARN:
-                               warning("deleting the current branch");
 -                      case DENY_UNCONFIGURED:
 -                              if (deny_delete_current == DENY_UNCONFIGURED)
 -                                      warn_unconfigured_deny_delete_current();
+                               rp_warning("deleting the current branch");
                                break;
                        case DENY_REFUSE:
-                               error("refusing to delete the current branch: %s", name);
 +                      case DENY_UNCONFIGURED:
 +                              if (deny_delete_current == DENY_UNCONFIGURED)
 +                                      refuse_unconfigured_deny_delete_current();
+                               rp_error("refusing to delete the current branch: %s", name);
                                return "deletion of the current branch prohibited";
                        }
                }
Simple merge
diff --cc convert.c
index 27acce58bc4bec60a394f03db1f6e60e1e4cfc3e,e70ee094a76d850cd655338d406a7c4efc37c7d5..4f8fcb7bbb00b66f1eaa354119784e6ef57e1eb4
+++ b/convert.c
@@@ -253,9 -253,8 +253,9 @@@ static int filter_buffer(int in, int ou
  
        memset(&child_process, 0, sizeof(child_process));
        child_process.argv = argv;
 +      child_process.use_shell = 1;
        child_process.in = -1;
-       child_process.out = fd;
+       child_process.out = out;
  
        if (start_command(&child_process))
                return error("cannot fork to run external filter %s", params->cmd);
diff --cc remote-curl.c
Simple merge
diff --cc run-command.c
index 2feb493951322617692085998ac8507cdba9dd30,0d95340833aa999ecee58ad70c1c61a832fcdf38..0cd7f02ffe597d3708873d4f3d6b4c0e88e8fae7
@@@ -314,26 -142,41 +317,28 @@@ fail_pipe
        const char **sargv = cmd->argv;
        char **env = environ;
  
 -      if (cmd->no_stdin) {
 -              s0 = dup(0);
 -              dup_devnull(0);
 -      } else if (need_in) {
 -              s0 = dup(0);
 -              dup2(fdin[0], 0);
 -      } else if (cmd->in) {
 -              s0 = dup(0);
 -              dup2(cmd->in, 0);
 -      }
 -
 -      if (cmd->no_stderr) {
 -              s2 = dup(2);
 -              dup_devnull(2);
 -      } else if (need_err) {
 -              s2 = dup(2);
 -              dup2(fderr[1], 2);
 -      } else if (cmd->err > 2) {
 -              s2 = dup(2);
 -              dup2(cmd->err, 2);
 -      }
 -
 -      if (cmd->no_stdout) {
 -              s1 = dup(1);
 -              dup_devnull(1);
 -      } else if (cmd->stdout_to_stderr) {
 -              s1 = dup(1);
 -              dup2(2, 1);
 -      } else if (need_out) {
 -              s1 = dup(1);
 -              dup2(fdout[1], 1);
 -      } else if (cmd->out > 1) {
 -              s1 = dup(1);
 -              dup2(cmd->out, 1);
 -      }
 +      if (cmd->no_stdin)
 +              fhin = open("/dev/null", O_RDWR);
 +      else if (need_in)
 +              fhin = dup(fdin[0]);
 +      else if (cmd->in)
 +              fhin = dup(cmd->in);
 +
 +      if (cmd->no_stderr)
 +              fherr = open("/dev/null", O_RDWR);
 +      else if (need_err)
 +              fherr = dup(fderr[1]);
++      else if (cmd->err > 2)
++              fherr = dup(cmd->err);
 +
 +      if (cmd->no_stdout)
 +              fhout = open("/dev/null", O_RDWR);
 +      else if (cmd->stdout_to_stderr)
 +              fhout = dup(fherr);
 +      else if (need_out)
 +              fhout = dup(fdout[1]);
 +      else if (cmd->out > 1)
 +              fhout = dup(cmd->out);
  
        if (cmd->dir)
                die("chdir in start_command() not implemented");
diff --cc run-command.h
Simple merge