Fix a seriously bad interaction between .git caching and repo cloning
authorYann Dirson <ydirson@altern.org>
Sun, 16 Apr 2006 10:52:39 +0000 (12:52 +0200)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 2 May 2006 20:30:45 +0000 (21:30 +0100)
commit608961c24ee007e7a19db6be020f3be0d8155511
tree0704eae7aaa6061074a9014b7db16cf3267eaf6d
parenta5f1eba2761eba8987c94bf61e0a4b7528afbb5f
Fix a seriously bad interaction between .git caching and repo cloning

Testcase 2 exhibits a problem with caching the location of .git while
cloning a repository.  Since basedir.get() is called before the clone is
built, a value may get stored in the cache if we are within a
git-controlled tree already.  Then when constructing the object for the
clone, a bogus .git is used, which can lead, when running tests in t/trash,
to corruption of the stgit .git repository.

Testcase 1 does not show any problem by chance, because since we have a
./.git prepared for use by the testsuite, value ".git" get cached, and it
happens that this value will be still valid after chdir'ing into the
newborn clone.

Clearing the cache at the appropriate place fixes the problem.

Signed-off-by: Yann Dirson <ydirson@altern.org>
stgit/basedir.py
stgit/commands/clone.py
t/t1100-clone-under.sh [new file with mode: 0755]