Re: [PATCH] Add core.symlinks to mark filesystems that do not support symbolic links.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

> 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:

> @@ -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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]