Re: [PATCH] Add core.symlinks to mark filesystems that do not support symbolic links.
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Mar 2, 2007, 21:35 UTC
- Message-ID
- <Pine.LNX.4.63.0703022219360.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <200703022211.30322.johannes.sixt@telecom.at>
Hi,
BTW since git.git's RelNotes is a symlink this patch is needed for MinGW. I tried to commit something yesterday, and had to use cygwin to do it, since MinGW Git always complained about "invalid tree d5e055...". For those who don't know: try "git show d5e055" in your Git repository.
On Fri, 2 Mar 2007, Johannes Sixt wrote:
Show 10 quoted lines
> diff --git a/cache.h b/cache.h
> index 04f8e63..6f932fe 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -108,7 +108,10 @@ static inline unsigned int create_ce_mode(unsigned int mode)
> }
> static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode)
> {
> - extern int trust_executable_bit;
> + extern int trust_executable_bit, has_symlinks;Would it not be better to move the global variables before this function? I.e. these:
Show 46 quoted lines
> @@ -202,6 +205,7 @@ extern int delete_ref(const char *, unsigned char *sha1); > /* Environment bits from configuration mechanism */ > extern int use_legacy_headers; > extern int trust_executable_bit; > +extern int has_symlinks; > extern int assume_unchanged; > extern int prefer_symlink_refs; > extern int log_all_ref_updates; > > [...] > > diff --git a/t/t2102-update-index-symlinks.sh b/t/t2102-update-index-symlinks.sh > new file mode 100644 > index 0000000..969ef89 > --- /dev/null > +++ b/t/t2102-update-index-symlinks.sh > @@ -0,0 +1,31 @@ > +#!/bin/sh > +# > +# Copyright (c) 2007 Johannes Sixt > +# > + > +test_description='git-update-index on filesystem w/o symlinks test. > + > +This tests that git-update-index keeps the symbolic link property > +even if a plain file is in the working tree if core.symlinks is false.' > + > +. ./test-lib.sh > + > +test_expect_success \ > +'preparation' ' > +git-config core.symlinks false && > +l=$(echo -n file | git-hash-object -t blob -w --stdin) && > +echo "120000 $l symlink" | git-update-index --index-info' > + > +test_expect_success \ > +'modify the symbolic link' ' > +echo -n new-file > symlink && > +git-update-index symlink' > + > +test_expect_success \ > +'the index entry must still be a symbolic link' ' > +case "`git-ls-files --stage --cached symlink`" in > +120000" "*symlink) echo ok;; > +*) echo fail; git-ls-files --stage --cached symlink; (exit 1);; > +esac'
Please test also what happens if you replace a supposed symlink with a directory and vice versa.
Ciao, Dscho