Merge branch 'cc/replace'
authorJunio C Hamano <gitster@pobox.com>
Tue, 24 Nov 2009 06:24:01 +0000 (22:24 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Nov 2009 06:24:01 +0000 (22:24 -0800)
* cc/replace:
Documentation: talk a little bit about GIT_NO_REPLACE_OBJECTS
Documentation: fix typos and spelling in replace documentation
replace: use a GIT_NO_REPLACE_OBJECTS env variable

1  2 
cache.h
connect.c
environment.c
git.c
diff --combined cache.h
index 14c88e65c301bf6f47f36b43c8b339a765f3ec41,bc7790924f6378a59e5f470f8288551674145960..bf468e52352c193b355222b718d9f5125c26052c
+++ b/cache.h
@@@ -369,11 -369,10 +369,12 @@@ static inline enum object_type object_t
  #define CONFIG_ENVIRONMENT "GIT_CONFIG"
  #define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
  #define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES"
+ #define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
  #define GITATTRIBUTES_FILE ".gitattributes"
  #define INFOATTRIBUTES_FILE "info/attributes"
  #define ATTRIBUTE_MACRO_PREFIX "[attr]"
 +#define GIT_NOTES_REF_ENVIRONMENT "GIT_NOTES_REF"
 +#define GIT_NOTES_DEFAULT_REF "refs/notes/commits"
  
  extern int is_bare_repository_cfg;
  extern int is_bare_repository(void);
@@@ -570,8 -569,6 +571,8 @@@ enum object_creation_mode 
  
  extern enum object_creation_mode object_creation_mode;
  
 +extern char *notes_ref_name;
 +
  extern int grafts_replace_parents;
  
  #define GIT_REPO_VERSION 0
@@@ -649,7 -646,6 +650,7 @@@ int set_shared_perm(const char *path, i
  #define adjust_shared_perm(path) set_shared_perm((path), 0)
  int safe_create_leading_directories(char *path);
  int safe_create_leading_directories_const(const char *path);
 +extern char *expand_user_path(const char *path);
  char *enter_repo(char *path, int strict);
  static inline int is_absolute_path(const char *path)
  {
@@@ -662,7 -658,6 +663,7 @@@ const char *make_relative_path(const ch
  int normalize_path_copy(char *dst, const char *src);
  int longest_ancestor_length(const char *path, const char *prefix_list);
  char *strip_path_suffix(const char *path, const char *suffix);
 +int daemon_avoid_alias(const char *path);
  
  /* Read and unpack a sha1 file into memory, write memory to a sha1 file */
  extern int sha1_object_info(const unsigned char *, unsigned long *);
@@@ -757,8 -752,6 +758,8 @@@ extern const char *git_author_info(int)
  extern const char *git_committer_info(int);
  extern const char *fmt_ident(const char *name, const char *email, const char *date_str, int);
  extern const char *fmt_name(const char *name, const char *email);
 +extern const char *git_editor(void);
 +extern const char *git_pager(void);
  
  struct checkout {
        const char *base_dir;
@@@ -865,6 -858,7 +866,6 @@@ extern struct ref *find_ref_by_name(con
  extern struct child_process *git_connect(int fd[2], const char *url, const char *prog, int flags);
  extern int finish_connect(struct child_process *conn);
  extern int path_match(const char *path, int nr, char **match);
 -extern int get_ack(int fd, unsigned char *result_sha1);
  struct extra_have_objects {
        int nr, alloc;
        unsigned char (*array)[20];
@@@ -910,7 -904,6 +911,7 @@@ extern unsigned long git_config_ulong(c
  extern int git_config_bool_or_int(const char *, const char *, int *);
  extern int git_config_bool(const char *, const char *);
  extern int git_config_string(const char **, const char *, const char *);
 +extern int git_config_pathname(const char **, const char *, const char *);
  extern int git_config_set(const char *, const char *);
  extern int git_config_set_multivar(const char *, const char *, const char *, int);
  extern int git_config_rename_section(const char *, const char *);
@@@ -969,9 -962,7 +970,9 @@@ extern void *alloc_object_node(void)
  extern void alloc_report(void);
  
  /* trace.c */
 +__attribute__((format (printf, 1, 2)))
  extern void trace_printf(const char *format, ...);
 +__attribute__((format (printf, 2, 3)))
  extern void trace_argv_printf(const char **argv, const char *format, ...);
  
  /* convert.c */
diff --combined connect.c
index 839a1037057d5224b4d35e0065168283d29f4cb2,c4f134f07aa44d6b2133c805f668b2e4e89bb6a8..db965c9982f1f2ae7e08331d3fa1d40e194a6520
+++ b/connect.c
@@@ -107,6 -107,27 +107,6 @@@ int server_supports(const char *feature
                strstr(server_capabilities, feature) != NULL;
  }
  
 -int get_ack(int fd, unsigned char *result_sha1)
 -{
 -      static char line[1000];
 -      int len = packet_read_line(fd, line, sizeof(line));
 -
 -      if (!len)
 -              die("git fetch-pack: expected ACK/NAK, got EOF");
 -      if (line[len-1] == '\n')
 -              line[--len] = 0;
 -      if (!strcmp(line, "NAK"))
 -              return 0;
 -      if (!prefixcmp(line, "ACK ")) {
 -              if (!get_sha1_hex(line+4, result_sha1)) {
 -                      if (strstr(line+45, "continue"))
 -                              return 2;
 -                      return 1;
 -              }
 -      }
 -      die("git fetch_pack: expected ACK/NAK, got '%s'", line);
 -}
 -
  int path_match(const char *path, int nr, char **match)
  {
        int i;
@@@ -609,6 -630,7 +609,7 @@@ struct child_process *git_connect(int f
                        GIT_WORK_TREE_ENVIRONMENT,
                        GRAFT_ENVIRONMENT,
                        INDEX_ENVIRONMENT,
+                       NO_REPLACE_OBJECTS_ENVIRONMENT,
                        NULL
                };
                conn->env = env;
diff --combined environment.c
index 571ab56b7e58e2db9e1182de7e78fd2d7596e872,5946f385f57d4be47c2ab02585a90ba8da723f1f..5171d9f9a4a30054983638e9e19e61f422724373
@@@ -49,7 -49,6 +49,7 @@@ enum push_default_type push_default = P
  #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
  #endif
  enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
 +char *notes_ref_name;
  int grafts_replace_parents = 1;
  
  /* Parallel index stat data preload? */
@@@ -84,6 -83,8 +84,8 @@@ static void setup_git_env(void
        git_graft_file = getenv(GRAFT_ENVIRONMENT);
        if (!git_graft_file)
                git_graft_file = git_pathdup("info/grafts");
+       if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
+               read_replace_refs = 0;
  }
  
  int is_bare_repository(void)
diff --combined git.c
index 743ee57100ac49aca8d90892b1abec5f18eb18c1,d50bbc3e43694eb9d55db666ba5ca2ecb778e25c..11544cdb4037715b1e9edc14689896d99d6e3284
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -89,6 -89,9 +89,9 @@@ static int handle_options(const char **
                                *envchanged = 1;
                } else if (!strcmp(cmd, "--no-replace-objects")) {
                        read_replace_refs = 0;
+                       setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);
+                       if (envchanged)
+                               *envchanged = 1;
                } else if (!strcmp(cmd, "--git-dir")) {
                        if (*argc < 2) {
                                fprintf(stderr, "No directory given for --git-dir.\n" );
@@@ -229,24 -232,21 +232,24 @@@ struct cmd_struct 
  
  static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
  {
 -      int status;
 +      int status, help;
        struct stat st;
        const char *prefix;
  
        prefix = NULL;
 -      if (p->option & RUN_SETUP)
 -              prefix = setup_git_directory();
 -
 -      if (use_pager == -1 && p->option & RUN_SETUP)
 -              use_pager = check_pager_config(p->cmd);
 -      if (use_pager == -1 && p->option & USE_PAGER)
 -              use_pager = 1;
 +      help = argc == 2 && !strcmp(argv[1], "-h");
 +      if (!help) {
 +              if (p->option & RUN_SETUP)
 +                      prefix = setup_git_directory();
 +
 +              if (use_pager == -1 && p->option & RUN_SETUP)
 +                      use_pager = check_pager_config(p->cmd);
 +              if (use_pager == -1 && p->option & USE_PAGER)
 +                      use_pager = 1;
 +      }
        commit_pager_choice();
  
 -      if (p->option & NEED_WORK_TREE)
 +      if (!help && p->option & NEED_WORK_TREE)
                setup_work_tree();
  
        trace_argv_printf(argv, "trace: built-in: git");
@@@ -307,6 -307,7 +310,6 @@@ static void handle_internal_command(in
                { "fast-export", cmd_fast_export, RUN_SETUP },
                { "fetch", cmd_fetch, RUN_SETUP },
                { "fetch-pack", cmd_fetch_pack, RUN_SETUP },
 -              { "fetch--tool", cmd_fetch__tool, RUN_SETUP },
                { "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },
                { "for-each-ref", cmd_for_each_ref, RUN_SETUP },
                { "format-patch", cmd_format_patch, RUN_SETUP },