Code

Merge branch 'nd/setup'
authorJunio C Hamano <gitster@pobox.com>
Tue, 28 Dec 2010 19:26:55 +0000 (11:26 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Dec 2010 19:26:55 +0000 (11:26 -0800)
* nd/setup: (47 commits)
  setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
  git.txt: correct where --work-tree path is relative to
  Revert "Documentation: always respect core.worktree if set"
  t0001: test git init when run via an alias
  Remove all logic from get_git_work_tree()
  setup: rework setup_explicit_git_dir()
  setup: clean up setup_discovered_git_dir()
  t1020-subdirectory: test alias expansion in a subdirectory
  setup: clean up setup_bare_git_dir()
  setup: limit get_git_work_tree()'s to explicit setup case only
  Use git_config_early() instead of git_config() during repo setup
  Add git_config_early()
  git-rev-parse.txt: clarify --git-dir
  t1510: setup case #31
  t1510: setup case #30
  t1510: setup case #29
  t1510: setup case #28
  t1510: setup case #27
  t1510: setup case #26
  t1510: setup case #25
  ...

1  2 
.gitignore
Documentation/config.txt
Documentation/git.txt
Makefile
cache.h
config.c
environment.c
git.c
setup.c
t/t0001-init.sh
trace.c

diff --cc .gitignore
Simple merge
Simple merge
Simple merge
diff --cc Makefile
Simple merge
diff --cc cache.h
Simple merge
diff --cc config.c
index d73b090b6a60d05b18309755dee4ce3b6e055b2d,c431f41c5a0d0645a53242e046350ff95a8b48f5..625e0518767712583f917762634c2fc852c4d2eb
+++ b/config.c
@@@ -888,9 -868,23 +885,21 @@@ int git_config_early(config_fn_t fn, vo
        if (config_parameters)
                found += 1;
  
 -      if (found == 0)
 -              return -1;
 -      return ret;
 +      return ret == 0 ? found : ret;
  }
  
+ int git_config(config_fn_t fn, void *data)
+ {
+       char *repo_config = NULL;
+       int ret;
+       repo_config = git_pathdup("config");
+       ret = git_config_early(fn, data, repo_config);
+       if (repo_config)
+               free(repo_config);
+       return ret;
+ }
  /*
   * Find all the stuff for git_config_set() below.
   */
diff --cc environment.c
Simple merge
diff --cc git.c
Simple merge
diff --cc setup.c
Simple merge
diff --cc t/t0001-init.sh
index d44194c35fe5de72af0721a05bb1038f1720b4ac,28c1858c2b6834ed5a21285609f97b7a28a3e9a5..af8b9c52a9d4c899a05f8d2877de005cb4d1437d
@@@ -33,9 -33,65 +33,65 @@@ test_expect_success 'plain' 
        check_config plain/.git false unset
  '
  
+ test_expect_success 'plain nested in bare' '
+       (
+               unset GIT_DIR GIT_WORK_TREE &&
+               git init --bare bare-ancestor.git &&
+               cd bare-ancestor.git &&
+               mkdir plain-nested &&
+               cd plain-nested &&
+               git init
+       ) &&
+       check_config bare-ancestor.git/plain-nested/.git false unset
+ '
+ test_expect_success 'plain through aliased command, outside any git repo' '
+       (
+               unset GIT_DIR GIT_WORK_TREE GIT_CONFIG_NOGLOBAL &&
+               HOME=$(pwd)/alias-config &&
+               export HOME &&
+               mkdir alias-config &&
+               echo "[alias] aliasedinit = init" >alias-config/.gitconfig &&
+               GIT_CEILING_DIRECTORIES=$(pwd) &&
+               export GIT_CEILING_DIRECTORIES &&
+               mkdir plain-aliased &&
+               cd plain-aliased &&
+               git aliasedinit
+       ) &&
+       check_config plain-aliased/.git false unset
+ '
+ test_expect_failure 'plain nested through aliased command' '
+       (
+               unset GIT_DIR GIT_WORK_TREE &&
+               git init plain-ancestor-aliased &&
+               cd plain-ancestor-aliased &&
+               echo "[alias] aliasedinit = init" >>.git/config &&
+               mkdir plain-nested &&
+               cd plain-nested &&
+               git aliasedinit
+       ) &&
+       check_config plain-ancestor-aliased/plain-nested/.git false unset
+ '
+ test_expect_failure 'plain nested in bare through aliased command' '
+       (
+               unset GIT_DIR GIT_WORK_TREE &&
+               git init --bare bare-ancestor-aliased.git &&
+               cd bare-ancestor-aliased.git &&
+               echo "[alias] aliasedinit = init" >>config &&
+               mkdir plain-nested &&
+               cd plain-nested &&
+               git aliasedinit
+       ) &&
+       check_config bare-ancestor-aliased.git/plain-nested/.git false unset
+ '
  test_expect_success 'plain with GIT_WORK_TREE' '
        if (
 -              unset GIT_DIR
 +              sane_unset GIT_DIR &&
                mkdir plain-wt &&
                cd plain-wt &&
                GIT_WORK_TREE=$(pwd) git init
diff --cc trace.c
Simple merge