Code

Merge branch 'kf/askpass-config'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Sep 2010 16:17:01 +0000 (09:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Sep 2010 16:17:01 +0000 (09:17 -0700)
* kf/askpass-config:
  Extend documentation of core.askpass and GIT_ASKPASS.
  Allow core.askpass to override SSH_ASKPASS.
  Add a new option 'core.askpass'.

1  2 
Documentation/config.txt
Documentation/git.txt
cache.h
config.c
environment.c
git.c

diff --combined Documentation/config.txt
index cda6721013ac3f01e7a3b6a7e770266852cef131,12b7ebfafc9fe604ae64f4a46f2a3b39f152d7af..d294dd6dcd29bf4bad21a51011d85c7d2cf85f19
@@@ -128,7 -128,7 +128,7 @@@ advice.*:
                when writing commit messages. Default: true.
        commitBeforeMerge::
                Advice shown when linkgit:git-merge[1] refuses to
 -              merge to avoid overwritting local changes.
 +              merge to avoid overwriting local changes.
                Default: true.
        resolveConflict::
                Advices shown by various commands when conflicts
@@@ -418,7 -418,7 +418,7 @@@ Common unit suffixes of 'k', 'm', or 'g
  
  core.deltaBaseCacheLimit::
        Maximum number of bytes to reserve for caching base objects
 -      that multiple deltafied objects reference.  By storing the
 +      that may be referenced by multiple deltified objects.  By storing the
        entire decompressed base objects in a cache Git is able
        to avoid unpacking and decompressing frequently used base
        objects multiple times.
@@@ -450,6 -450,15 +450,15 @@@ core.excludesfile:
        to the value of `$HOME` and "{tilde}user/" to the specified user's
        home directory.  See linkgit:gitignore[5].
  
+ core.askpass::
+       Some commands (e.g. svn and http interfaces) that interactively
+       ask for a password can be told to use an external program given
+       via the value of this variable. Can be overridden by the 'GIT_ASKPASS'
+       environment variable. If not set, fall back to the value of the
+       'SSH_ASKPASS' environment variable or, failing that, a simple password
+       prompt. The external program shall be given a suitable prompt as
+       command line argument and write the password on its STDOUT.
  core.editor::
        Commands such as `commit` and `tag` that lets you edit
        messages by launching an editor uses the value of this
@@@ -563,7 -572,7 +572,7 @@@ not necessarily be the current director
  am.keepcr::
        If true, git-am will call git-mailsplit for patches in mbox format
        with parameter '--keep-cr'. In this case git-mailsplit will
 -      not remove `\r` from lines ending with `\r\n`. Can be overrriden
 +      not remove `\r` from lines ending with `\r\n`. Can be overridden
        by giving '--no-keep-cr' from the command line.
        See linkgit:git-am[1], linkgit:git-mailsplit[1].
  
@@@ -826,12 -835,6 +835,12 @@@ diff.renames:
        will enable basic rename detection.  If set to "copies" or
        "copy", it will detect copies, as well.
  
 +diff.ignoreSubmodules::
 +      Sets the default value of --ignore-submodules. Note that this
 +      affects only 'git diff' Porcelain, and not lower level 'diff'
 +      commands such as 'git diff-files'. 'git checkout' also honors
 +      this setting when reporting uncommitted changes.
 +
  diff.suppressBlankEmpty::
        A boolean to inhibit the standard behavior of printing a space
        before each empty output line. Defaults to false.
@@@ -1008,7 -1011,7 +1017,7 @@@ gitcvs.usecrlfattr:
        If true, the server will look up the end-of-line conversion
        attributes for files to determine the '-k' modes to use. If
        the attributes force git to treat a file as text,
 -      the '-k' mode will be left blank so cvs clients will
 +      the '-k' mode will be left blank so CVS clients will
        treat it as text. If they suppress text conversion, the file
        will be set with '-kb' mode, which suppresses any newline munging
        the client might otherwise do. If the attributes do not allow
@@@ -1249,15 -1252,6 +1258,15 @@@ http.noEPSV:
        support EPSV mode. Can be overridden by the 'GIT_CURL_FTP_NO_EPSV'
        environment variable. Default is false (curl will use EPSV).
  
 +http.useragent::
 +      The HTTP USER_AGENT string presented to an HTTP server.  The default
 +      value represents the version of the client git such as git/1.7.1.
 +      This option allows you to override this value to a more common value
 +      such as Mozilla/4.0.  This may be necessary, for instance, if
 +      connecting through a firewall that restricts HTTP connections to a set
 +      of common USER_AGENT strings (but not including those like git/1.7.1).
 +      Can be overridden by the 'GIT_HTTP_USER_AGENT' environment variable.
 +
  i18n.commitEncoding::
        Character encoding the commit messages are stored in; git itself
        does not care per se, but this information is necessary e.g. when
@@@ -1290,9 -1284,7 +1299,9 @@@ instaweb.local:
        be bound to the local IP (127.0.0.1).
  
  instaweb.modulepath::
 -      The module path for an apache httpd used by linkgit:git-instaweb[1].
 +      The default module path for linkgit:git-instaweb[1] to use
 +      instead of /usr/lib/apache2/modules.  Only used if httpd
 +      is Apache.
  
  instaweb.port::
        The port number to bind the gitweb httpd to. See
@@@ -1306,11 -1298,10 +1315,11 @@@ interactive.singlekey:
        ignored if portable keystroke input is not available.
  
  log.date::
 -      Set default date-time mode for the log command. Setting log.date
 -      value is similar to using 'git log'\'s --date option. The value is one of the
 -      following alternatives: {relative,local,default,iso,rfc,short}.
 -      See linkgit:git-log[1].
 +      Set the default date-time mode for the 'log' command.
 +      Setting a value for log.date is similar to using 'git log''s
 +      `\--date` option.  Possible values are `relative`, `local`,
 +      `default`, `iso`, `rfc`, and `short`; see linkgit:git-log[1]
 +      for details.
  
  log.decorate::
        Print out the ref names of any commits that are shown by the log
@@@ -1551,9 -1542,6 +1560,9 @@@ rebase.stat:
        Whether to show a diffstat of what changed upstream since the last
        rebase. False by default.
  
 +rebase.autosquash::
 +      If set to true enable '--autosquash' option by default.
 +
  receive.autogc::
        By default, git-receive-pack will run "git-gc --auto" after
        receiving data from git-push and updating refs.  You can stop
@@@ -1579,10 -1567,6 +1588,10 @@@ receive.denyDeletes:
        If set to true, git-receive-pack will deny a ref update that deletes
        the ref. Use this to prevent such a ref deletion via a push.
  
 +receive.denyDeleteCurrent::
 +      If set to true, git-receive-pack will deny a ref update that
 +      deletes the currently checked out branch of a non-bare repository.
 +
  receive.denyCurrentBranch::
        If set to true or "refuse", git-receive-pack will deny a ref update
        to the currently checked out branch of a non-bare repository.
@@@ -1648,9 -1632,7 +1657,9 @@@ remote.<name>.tagopt:
        Setting this value to \--no-tags disables automatic tag following when
        fetching from remote <name>. Setting it to \--tags will fetch every
        tag from remote <name>, even if they are not reachable from remote
 -      branch heads.
 +      branch heads. Passing these flags directly to linkgit:git-fetch[1] can
 +      override this setting. See options \--tags and \--no-tags of
 +      linkgit:git-fetch[1].
  
  remote.<name>.vcs::
        Setting this to a value <vcs> will cause git to interact with
@@@ -1770,19 -1752,6 +1779,19 @@@ submodule.<name>.update:
        URL and other values found in the `.gitmodules` file.  See
        linkgit:git-submodule[1] and linkgit:gitmodules[5] for details.
  
 +submodule.<name>.ignore::
 +      Defines under what circumstances "git status" and the diff family show
 +      a submodule as modified. When set to "all", it will never be considered
 +      modified, "dirty" will ignore all changes to the submodules work tree and
 +      takes only differences between the HEAD of the submodule and the commit
 +      recorded in the superproject into account. "untracked" will additionally
 +      let submodules with modified tracked files in their work tree show up.
 +      Using "none" (the default when this option is not set) also shows
 +      submodules that have untracked files in their work tree as changed.
 +      This setting overrides any setting made in .gitmodules for this submodule,
 +      both settings can be overridden on the command line by using the
 +      "--ignore-submodules" option.
 +
  tar.umask::
        This variable can be used to restrict the permission bits of
        tar archive entries.  The default is 0002, which turns off the
diff --combined Documentation/git.txt
index 93e3b07c6cdf6c580cd7dff0d973478b91178481,39504e8d0a51e5d99725aa7ddd7539941648b86e..e341075078f4511d2a40dca0a2c8ae1d342e6b17
@@@ -44,25 -44,20 +44,25 @@@ unreleased) version of git, that is ava
  branch of the `git.git` repository.
  Documentation for older releases are available here:
  
 -* link:v1.7.2/git.html[documentation for release 1.7.2]
 +* link:v1.7.2.3/git.html[documentation for release 1.7.2.3]
  
  * release notes for
 +  link:RelNotes-1.7.2.3.txt[1.7.2.3],
 +  link:RelNotes-1.7.2.2.txt[1.7.2.2],
 +  link:RelNotes-1.7.2.1.txt[1.7.2.1],
    link:RelNotes-1.7.2.txt[1.7.2].
  
 -* link:v1.7.1.1/git.html[documentation for release 1.7.1.1]
 +* link:v1.7.1.2/git.html[documentation for release 1.7.1.2]
  
  * release notes for
 +  link:RelNotes-1.7.1.2.txt[1.7.1.2],
    link:RelNotes-1.7.1.1.txt[1.7.1.1],
    link:RelNotes-1.7.1.txt[1.7.1].
  
 -* link:v1.7.0.6/git.html[documentation for release 1.7.0.6]
 +* link:v1.7.0.7/git.html[documentation for release 1.7.0.7]
  
  * release notes for
 +  link:RelNotes-1.7.0.7.txt[1.7.0.7],
    link:RelNotes-1.7.0.6.txt[1.7.0.6],
    link:RelNotes-1.7.0.5.txt[1.7.0.5],
    link:RelNotes-1.7.0.4.txt[1.7.0.4],
@@@ -639,6 -634,13 +639,13 @@@ Usually it is easier to configure any d
  personal `.ssh/config` file.  Please consult your ssh documentation
  for further details.
  
+ 'GIT_ASKPASS'::
+       If this environment variable is set, then git commands which need to
+       acquire passwords or passphrases (e.g. for HTTP or IMAP authentication)
+       will call this program with a suitable prompt as command line argument
+       and read the password from its STDOUT. See also the 'core.askpass'
+       option in linkgit:git-config[1].
  'GIT_FLUSH'::
        If this environment variable is set to "1", then commands such
        as 'git blame' (in incremental mode), 'git rev-list', 'git log',
@@@ -729,13 -731,6 +736,13 @@@ The documentation for git suite was sta
  <david@dgreaves.com>, and later enhanced greatly by the
  contributors on the git-list <git@vger.kernel.org>.
  
 +Reporting Bugs
 +--------------
 +
 +Report bugs to the Git mailing list <git@vger.kernel.org> where the
 +development and maintenance is primarily done.  You do not have to be
 +subscribed to the list to send a message there.
 +
  SEE ALSO
  --------
  linkgit:gittutorial[7], linkgit:gittutorial-2[7],
diff --combined cache.h
index abbe08303ec24c07051c5e4f789ba85393868b94,c74275727ebd2042b5631abf9eacfd2021c92e0f..2ef2fa3a5e166d94e5e981ca7c76afad13236e7e
+++ b/cache.h
@@@ -179,7 -179,8 +179,7 @@@ struct cache_entry 
  #define CE_UNHASHED  (0x200000)
  #define CE_CONFLICTED (0x800000)
  
 -/* Only remove in work directory, not index */
 -#define CE_WT_REMOVE (0x400000)
 +#define CE_WT_REMOVE (0x400000) /* remove in work directory */
  
  #define CE_UNPACKED  (0x1000000)
  
@@@ -378,7 -379,6 +378,7 @@@ static inline enum object_type object_t
  #define GRAFT_ENVIRONMENT "GIT_GRAFT_FILE"
  #define TEMPLATE_DIR_ENVIRONMENT "GIT_TEMPLATE_DIR"
  #define CONFIG_ENVIRONMENT "GIT_CONFIG"
 +#define CONFIG_DATA_ENVIRONMENT "GIT_CONFIG_PARAMETERS"
  #define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
  #define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES"
  #define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
   * environment creation or simple walk of the list.
   * The number of non-NULL entries is available as a macro.
   */
 -#define LOCAL_REPO_ENV_SIZE 8
 +#define LOCAL_REPO_ENV_SIZE 9
  extern const char *const local_repo_env[LOCAL_REPO_ENV_SIZE + 1];
  
  extern int is_bare_repository_cfg;
@@@ -449,7 -449,7 +449,7 @@@ extern int init_db(const char *template
                                alloc = alloc_nr(alloc); \
                        x = xrealloc((x), alloc * sizeof(*(x))); \
                } \
 -      } while(0)
 +      } while (0)
  
  /* Initialize and use the cache information */
  extern int read_index(struct index_state *);
@@@ -641,9 -641,6 +641,9 @@@ extern char *git_pathdup(const char *fm
  /* Return a statically allocated filename matching the sha1 signature */
  extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
  extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
 +extern char *git_path_submodule(const char *path, const char *fmt, ...)
 +      __attribute__((format (printf, 2, 3)));
 +
  extern char *sha1_file_name(const unsigned char *sha1);
  extern char *sha1_pack_name(const unsigned char *sha1);
  extern char *sha1_pack_index_name(const unsigned char *sha1);
@@@ -814,7 -811,6 +814,7 @@@ const char *show_date_relative(unsigne
                               char *timebuf,
                               size_t timebuf_size);
  int parse_date(const char *date, char *buf, int bufsize);
 +int parse_date_basic(const char *date, unsigned long *timestamp, int *offset);
  void datestamp(char *buf, int bufsize);
  #define approxidate(s) approxidate_careful((s), NULL)
  unsigned long approxidate_careful(const char *, int *);
@@@ -974,9 -970,7 +974,9 @@@ extern int update_server_info(int)
  typedef int (*config_fn_t)(const char *, const char *, void *);
  extern int git_default_config(const char *, const char *, void *);
  extern int git_config_from_file(config_fn_t fn, const char *, void *);
 +extern void git_config_push_parameter(const char *text);
  extern int git_config_parse_parameter(const char *text);
 +extern int git_config_parse_environment(void);
  extern int git_config_from_parameters(config_fn_t fn, void *data);
  extern int git_config(config_fn_t fn, void *);
  extern int git_parse_ulong(const char *, unsigned long *);
@@@ -1035,6 -1029,7 +1035,7 @@@ extern int pager_in_use(void)
  extern int pager_use_color;
  
  extern const char *editor_program;
+ extern const char *askpass_program;
  extern const char *excludes_file;
  
  /* base85 */
@@@ -1060,7 -1055,6 +1061,7 @@@ extern void trace_argv_printf(const cha
  extern int convert_to_git(const char *path, const char *src, size_t len,
                            struct strbuf *dst, enum safe_crlf checksafe);
  extern int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst);
 +extern int renormalize_buffer(const char *path, const char *src, size_t len, struct strbuf *dst);
  
  /* add */
  /*
@@@ -1103,14 -1097,6 +1104,14 @@@ void overlay_tree_on_cache(const char *
  
  char *alias_lookup(const char *alias);
  int split_cmdline(char *cmdline, const char ***argv);
 +/* Takes a negative value returned by split_cmdline */
 +const char *split_cmdline_strerror(int cmdline_errno);
 +
 +/* git.c */
 +struct startup_info {
 +      int have_repository;
 +};
 +extern struct startup_info *startup_info;
  
  /* builtin/merge.c */
  int checkout_fast_forward(const unsigned char *from, const unsigned char *to);
diff --combined config.c
index c2c995f16df31a3553c3260f9d32e1572b1d45eb,ac55730fa712e899773be8b53596d4203e057784..4b0a82040e7982ab936ed52b2bb3405bc85b80f8
+++ b/config.c
@@@ -8,7 -8,6 +8,7 @@@
  #include "cache.h"
  #include "exec_cmd.h"
  #include "strbuf.h"
 +#include "quote.h"
  
  #define MAXNAME (256)
  
@@@ -35,19 -34,6 +35,19 @@@ static void lowercase(char *p
                *p = tolower(*p);
  }
  
 +void git_config_push_parameter(const char *text)
 +{
 +      struct strbuf env = STRBUF_INIT;
 +      const char *old = getenv(CONFIG_DATA_ENVIRONMENT);
 +      if (old) {
 +              strbuf_addstr(&env, old);
 +              strbuf_addch(&env, ' ');
 +      }
 +      sq_quote_buf(&env, text);
 +      setenv(CONFIG_DATA_ENVIRONMENT, env.buf, 1);
 +      strbuf_release(&env);
 +}
 +
  int git_config_parse_parameter(const char *text)
  {
        struct config_item *ct;
        return 0;
  }
  
 +int git_config_parse_environment(void) {
 +      const char *env = getenv(CONFIG_DATA_ENVIRONMENT);
 +      char *envw;
 +      const char **argv = NULL;
 +      int nr = 0, alloc = 0;
 +      int i;
 +
 +      if (!env)
 +              return 0;
 +      /* sq_dequote will write over it */
 +      envw = xstrdup(env);
 +
 +      if (sq_dequote_to_argv(envw, &argv, &nr, &alloc) < 0) {
 +              free(envw);
 +              return error("bogus format in " CONFIG_DATA_ENVIRONMENT);
 +      }
 +
 +      for (i = 0; i < nr; i++) {
 +              if (git_config_parse_parameter(argv[i]) < 0) {
 +                      error("bogus config parameter: %s", argv[i]);
 +                      free(argv);
 +                      free(envw);
 +                      return -1;
 +              }
 +      }
 +
 +      free(argv);
 +      free(envw);
 +      return 0;
 +}
 +
  static int get_next_char(void)
  {
        int c;
@@@ -605,6 -560,9 +605,9 @@@ static int git_default_core_config(cons
        if (!strcmp(var, "core.editor"))
                return git_config_string(&editor_program, var, value);
  
+       if (!strcmp(var, "core.askpass"))
+               return git_config_string(&askpass_program, var, value);
        if (!strcmp(var, "core.excludesfile"))
                return git_config_pathname(&excludes_file, var, value);
  
@@@ -818,14 -776,7 +821,14 @@@ int git_config_global(void
  
  int git_config_from_parameters(config_fn_t fn, void *data)
  {
 +      static int loaded_environment;
        const struct config_item *ct;
 +
 +      if (!loaded_environment) {
 +              if (git_config_parse_environment() < 0)
 +                      return -1;
 +              loaded_environment = 1;
 +      }
        for (ct = config_parameters; ct; ct = ct->next)
                if (fn(ct->name, ct->value, data) < 0)
                        return -1;
@@@ -864,9 -815,10 +867,9 @@@ int git_config(config_fn_t fn, void *da
        }
        free(repo_config);
  
 -      if (config_parameters) {
 -              ret += git_config_from_parameters(fn, data);
 +      ret += git_config_from_parameters(fn, data);
 +      if (config_parameters)
                found += 1;
 -      }
  
        if (found == 0)
                return -1;
diff --combined environment.c
index 9425606443241b76afd95aec02a6fa44a5a4b85d,e7760d8198323e26c647b2854d3bc3a780b8443d..2d0c3153791d7cceffb12f50dd5a7716b8c0a8c0
@@@ -37,6 -37,7 +37,7 @@@ size_t delta_base_cache_limit = 16 * 10
  const char *pager_program;
  int pager_use_color = 1;
  const char *editor_program;
+ const char *askpass_program;
  const char *excludes_file;
  enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
  int read_replace_refs = 1;
@@@ -53,7 -54,6 +54,7 @@@ enum object_creation_mode object_creati
  char *notes_ref_name;
  int grafts_replace_parents = 1;
  int core_apply_sparse_checkout;
 +struct startup_info *startup_info;
  
  /* Parallel index stat data preload? */
  int core_preload_index = 0;
@@@ -73,7 -73,6 +74,7 @@@ static char *git_object_dir, *git_index
  const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {
        ALTERNATE_DB_ENVIRONMENT,
        CONFIG_ENVIRONMENT,
 +      CONFIG_DATA_ENVIRONMENT,
        DB_ENVIRONMENT,
        GIT_DIR_ENVIRONMENT,
        GIT_WORK_TREE_ENVIRONMENT,
diff --combined git.c
index d64ab1a24d0c491e032860477e00eb27efc5383a,19a93fb9a2b5a95750154ebe352a43435ad1b47c..ce4bcfec03bb4371d01b3f39bf93764eda337ce7
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -8,13 -8,12 +8,13 @@@ const char git_usage_string[] 
        "git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n"
        "           [-p|--paginate|--no-pager] [--no-replace-objects]\n"
        "           [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n"
 -      "           [-c name=value\n"
 -      "           [--help] COMMAND [ARGS]";
 +      "           [-c name=value] [--help]\n"
 +      "           COMMAND [ARGS]";
  
  const char git_more_info_string[] =
        "See 'git help COMMAND' for more information on a specific command.";
  
 +static struct startup_info git_startup_info;
  static int use_pager = -1;
  struct pager_config {
        const char *cmd;
@@@ -56,9 -55,6 +56,6 @@@ static int handle_options(const char **
  {
        int handled = 0;
  
-       if (!getenv("GIT_ASKPASS") && getenv("SSH_ASKPASS"))
-               setenv("GIT_ASKPASS", getenv("SSH_ASKPASS"), 1);
        while (*argc > 0) {
                const char *cmd = (*argv)[0];
                if (cmd[0] != '-')
                                fprintf(stderr, "-c expects a configuration string\n" );
                                usage(git_usage_string);
                        }
 -                      git_config_parse_parameter((*argv)[1]);
 +                      git_config_push_parameter((*argv)[1]);
                        (*argv)++;
                        (*argc)--;
                } else {
@@@ -189,8 -185,7 +186,8 @@@ static int handle_alias(int *argcp, con
                }
                count = split_cmdline(alias_string, &new_argv);
                if (count < 0)
 -                      die("Bad alias.%s string", alias_command);
 +                      die("Bad alias.%s string: %s", alias_command,
 +                          split_cmdline_strerror(count));
                option_count = handle_options(&new_argv, &count, &envchanged);
                if (envchanged)
                        die("alias '%s' changes environment variables\n"
  
  const char git_version_string[] = GIT_VERSION;
  
 -#define RUN_SETUP     (1<<0)
 -#define USE_PAGER     (1<<1)
 +#define RUN_SETUP             (1<<0)
 +#define RUN_SETUP_GENTLY      (1<<1)
 +#define USE_PAGER             (1<<2)
  /*
   * require working tree to be present -- anything uses this needs
   * RUN_SETUP for reading from the configuration file.
   */
 -#define NEED_WORK_TREE        (1<<2)
 +#define NEED_WORK_TREE                (1<<3)
  
  struct cmd_struct {
        const char *cmd;
@@@ -257,12 -251,8 +254,12 @@@ static int run_builtin(struct cmd_struc
        if (!help) {
                if (p->option & RUN_SETUP)
                        prefix = setup_git_directory();
 +              if (p->option & RUN_SETUP_GENTLY) {
 +                      int nongit_ok;
 +                      prefix = setup_git_directory_gently(&nongit_ok);
 +              }
  
 -              if (use_pager == -1 && p->option & RUN_SETUP)
 +              if (use_pager == -1 && p->option & (RUN_SETUP | RUN_SETUP_GENTLY))
                        use_pager = check_pager_config(p->cmd);
                if (use_pager == -1 && p->option & USE_PAGER)
                        use_pager = 1;
@@@ -302,12 -292,12 +299,12 @@@ static void handle_internal_command(in
                { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
                { "stage", cmd_add, RUN_SETUP | NEED_WORK_TREE },
                { "annotate", cmd_annotate, RUN_SETUP },
 -              { "apply", cmd_apply },
 +              { "apply", cmd_apply, RUN_SETUP_GENTLY },
                { "archive", cmd_archive },
                { "bisect--helper", cmd_bisect__helper, RUN_SETUP | NEED_WORK_TREE },
                { "blame", cmd_blame, RUN_SETUP },
                { "branch", cmd_branch, RUN_SETUP },
 -              { "bundle", cmd_bundle },
 +              { "bundle", cmd_bundle, RUN_SETUP_GENTLY },
                { "cat-file", cmd_cat_file, RUN_SETUP },
                { "checkout", cmd_checkout, RUN_SETUP | NEED_WORK_TREE },
                { "checkout-index", cmd_checkout_index,
                { "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE },
                { "commit", cmd_commit, RUN_SETUP | NEED_WORK_TREE },
                { "commit-tree", cmd_commit_tree, RUN_SETUP },
 -              { "config", cmd_config },
 +              { "config", cmd_config, RUN_SETUP_GENTLY },
                { "count-objects", cmd_count_objects, RUN_SETUP },
                { "describe", cmd_describe, RUN_SETUP },
                { "diff", cmd_diff },
                { "fsck-objects", cmd_fsck, RUN_SETUP },
                { "gc", cmd_gc, RUN_SETUP },
                { "get-tar-commit-id", cmd_get_tar_commit_id },
 -              { "grep", cmd_grep },
 +              { "grep", cmd_grep, RUN_SETUP_GENTLY },
                { "hash-object", cmd_hash_object },
                { "help", cmd_help },
 -              { "index-pack", cmd_index_pack },
 +              { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
                { "init", cmd_init_db },
                { "init-db", cmd_init_db },
 -              { "log", cmd_log, RUN_SETUP | USE_PAGER },
 +              { "log", cmd_log, RUN_SETUP },
                { "ls-files", cmd_ls_files, RUN_SETUP },
                { "ls-tree", cmd_ls_tree, RUN_SETUP },
 -              { "ls-remote", cmd_ls_remote },
 +              { "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
                { "mailinfo", cmd_mailinfo },
                { "mailsplit", cmd_mailsplit },
                { "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
                { "merge-base", cmd_merge_base, RUN_SETUP },
 -              { "merge-file", cmd_merge_file },
 +              { "merge-file", cmd_merge_file, RUN_SETUP_GENTLY },
                { "merge-index", cmd_merge_index, RUN_SETUP },
                { "merge-ours", cmd_merge_ours, RUN_SETUP },
                { "merge-recursive", cmd_merge_recursive, RUN_SETUP | NEED_WORK_TREE },
                { "pack-objects", cmd_pack_objects, RUN_SETUP },
                { "pack-redundant", cmd_pack_redundant, RUN_SETUP },
                { "patch-id", cmd_patch_id },
 -              { "peek-remote", cmd_ls_remote },
 +              { "peek-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
                { "pickaxe", cmd_blame, RUN_SETUP },
                { "prune", cmd_prune, RUN_SETUP },
                { "prune-packed", cmd_prune_packed, RUN_SETUP },
                { "reflog", cmd_reflog, RUN_SETUP },
                { "remote", cmd_remote, RUN_SETUP },
                { "replace", cmd_replace, RUN_SETUP },
 -              { "repo-config", cmd_config },
 +              { "repo-config", cmd_config, RUN_SETUP_GENTLY },
                { "rerere", cmd_rerere, RUN_SETUP },
                { "reset", cmd_reset, RUN_SETUP },
                { "rev-list", cmd_rev_list, RUN_SETUP },
                { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
                { "rm", cmd_rm, RUN_SETUP },
                { "send-pack", cmd_send_pack, RUN_SETUP },
 -              { "shortlog", cmd_shortlog, USE_PAGER },
 +              { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
                { "show-branch", cmd_show_branch, RUN_SETUP },
 -              { "show", cmd_show, RUN_SETUP | USE_PAGER },
 +              { "show", cmd_show, RUN_SETUP },
                { "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
                { "stripspace", cmd_stripspace },
                { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
                { "update-ref", cmd_update_ref, RUN_SETUP },
                { "update-server-info", cmd_update_server_info, RUN_SETUP },
                { "upload-archive", cmd_upload_archive },
 -              { "var", cmd_var },
 +              { "var", cmd_var, RUN_SETUP_GENTLY },
                { "verify-tag", cmd_verify_tag, RUN_SETUP },
                { "version", cmd_version },
 -              { "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
 +              { "whatchanged", cmd_whatchanged, RUN_SETUP },
                { "write-tree", cmd_write_tree, RUN_SETUP },
                { "verify-pack", cmd_verify_pack },
                { "show-ref", cmd_show_ref, RUN_SETUP },
@@@ -496,8 -486,6 +493,8 @@@ int main(int argc, const char **argv
  {
        const char *cmd;
  
 +      startup_info = &git_startup_info;
 +
        cmd = git_extract_argv0_path(argv[0]);
        if (!cmd)
                cmd = "git-help";