Merge branch 'jc/clone'
authorJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 21:56:14 +0000 (13:56 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 20 Dec 2006 21:56:14 +0000 (13:56 -0800)
* jc/clone:
Move "no merge candidate" warning into git-pull
Use preprocessor constants for environment variable names.
Do not create $GIT_DIR/remotes/ directory anymore.
Introduce GIT_TEMPLATE_DIR
Revert "fix testsuite: make sure they use templates freshly built from the source"
fix testsuite: make sure they use templates freshly built from the source
git-clone: lose the traditional 'no-separate-remote' layout
git-clone: lose the artificial "first" fetch refspec
git-pull: refuse default merge without branch.*.merge
git-clone: use wildcard specification for tracking branches

1  2 
builtin-repo-config.c
config.c
merge-recursive.c
diff --combined builtin-repo-config.c
index a7ab4cee58fcd316497d10a766602e9fbd577998,4885930ca460ba1143089c9a050ff55f4682a912..90633119d4ae873ed30889e93dbb4307af0ae0d1
@@@ -1,5 -1,6 +1,5 @@@
  #include "builtin.h"
  #include "cache.h"
 -#include <regex.h>
  
  static const char git_config_set_usage[] =
  "git-repo-config [ --global ] [ --bool | --int ] [--get | --get-all | --get-regexp | --replace-all | --add | --unset | --unset-all] name [value [value_regex]] | --rename-section old_name new_name | --list";
@@@ -66,10 -67,10 +66,10 @@@ static int get_value(const char* key_, 
        char *global = NULL, *repo_config = NULL;
        const char *local;
  
-       local = getenv("GIT_CONFIG");
+       local = getenv(CONFIG_ENVIRONMENT);
        if (!local) {
                const char *home = getenv("HOME");
-               local = getenv("GIT_CONFIG_LOCAL");
+               local = getenv(CONFIG_LOCAL_ENVIRONMENT);
                if (!local)
                        local = repo_config = xstrdup(git_path("config"));
                if (home)
diff --combined config.c
index e86b2328abe11a7e1c299e65086a0dbcca721a6c,6a4224e98cf51f8ced2b8e942231012b42aaeef7..1662a4626e569b07d96c622b357928216a24538c
+++ b/config.c
@@@ -6,6 -6,7 +6,6 @@@
   *
   */
  #include "cache.h"
 -#include <regex.h>
  
  #define MAXNAME (256)
  
@@@ -349,10 -350,10 +349,10 @@@ int git_config(config_fn_t fn
         * $GIT_CONFIG_LOCAL will make it process it in addition to the
         * global config file, the same way it would the per-repository
         * config file otherwise. */
-       filename = getenv("GIT_CONFIG");
+       filename = getenv(CONFIG_ENVIRONMENT);
        if (!filename) {
                home = getenv("HOME");
-               filename = getenv("GIT_CONFIG_LOCAL");
+               filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
                if (!filename)
                        filename = repo_config = xstrdup(git_path("config"));
        }
@@@ -543,9 -544,9 +543,9 @@@ int git_config_set_multivar(const char
        char* lock_file;
        const char* last_dot = strrchr(key, '.');
  
-       config_filename = getenv("GIT_CONFIG");
+       config_filename = getenv(CONFIG_ENVIRONMENT);
        if (!config_filename) {
-               config_filename = getenv("GIT_CONFIG_LOCAL");
+               config_filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
                if (!config_filename)
                        config_filename  = git_path("config");
        }
@@@ -748,28 -749,24 +748,28 @@@ out_free
  int git_config_rename_section(const char *old_name, const char *new_name)
  {
        int ret = 0;
 -      const char *config_filename;
 +      char *config_filename;
        struct lock_file *lock = xcalloc(sizeof(struct lock_file), 1);
        int out_fd;
        char buf[1024];
  
-       config_filename = getenv("GIT_CONFIG");
+       config_filename = getenv(CONFIG_ENVIRONMENT);
        if (!config_filename) {
-               config_filename = getenv("GIT_CONFIG_LOCAL");
+               config_filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
                if (!config_filename)
                        config_filename  = git_path("config");
        }
        config_filename = xstrdup(config_filename);
        out_fd = hold_lock_file_for_update(lock, config_filename, 0);
 -      if (out_fd < 0)
 -              return error("Could not lock config file!");
 +      if (out_fd < 0) {
 +              ret = error("Could not lock config file!");
 +              goto out;
 +      }
  
 -      if (!(config_file = fopen(config_filename, "rb")))
 -              return error("Could not open config file!");
 +      if (!(config_file = fopen(config_filename, "rb"))) {
 +              ret = error("Could not open config file!");
 +              goto out;
 +      }
  
        while (fgets(buf, sizeof(buf), config_file)) {
                int i;
                }
                write(out_fd, buf, strlen(buf));
        }
 +      fclose(config_file);
        if (close(out_fd) || commit_lock_file(lock) < 0)
 -              return error("Cannot commit config file!");
 +              ret = error("Cannot commit config file!");
 + out:
 +      free(config_filename);
        return ret;
  }
  
diff --combined merge-recursive.c
index 1de273ea1e4f309b542c8ebfce706ba422e1cd74,ae4dcfbe5b0b8b1e9a03df128b9d0b67706a371b..ae7ae4cd2a9ce392945ad8ed27e4289c27ee24bd
@@@ -3,6 -3,13 +3,6 @@@
   * Fredrik Kuivinen.
   * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
   */
 -#include <stdarg.h>
 -#include <string.h>
 -#include <assert.h>
 -#include <sys/wait.h>
 -#include <sys/types.h>
 -#include <sys/stat.h>
 -#include <time.h>
  #include "cache.h"
  #include "cache-tree.h"
  #include "commit.h"
@@@ -1272,7 -1279,7 +1272,7 @@@ int main(int argc, char *argv[]
        struct commit *result, *h1, *h2;
  
        git_config(git_default_config); /* core.filemode */
-       original_index_file = getenv("GIT_INDEX_FILE");
+       original_index_file = getenv(INDEX_ENVIRONMENT);
  
        if (!original_index_file)
                original_index_file = xstrdup(git_path("index"));