Re: [PATCH 04/11] tests: introduce test_ln_s and test_ln_s_add
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jun 1, 2013, 11:11 UTC
- Message-ID
- <CALkWK0nN2V3Cwi3n+DV7Bcme7jE=B+COFioqPFfHQgxGTWEtiA@mail.gmail.com>
- In-Reply-To
- <c7be5891891d1eeba540a5a24f07d58514345b2b.1370076477.git.j6t@kdbg.org>
Johannes Sixt wrote:
Show 11 quoted lines
> +test_ln_s_add () {
> + if test_have_prereq SYMLINKS
> + then
> + ln -s "$1" "$2" &&
> + git update-index --add "$2"
> + else
> + printf '%s' "$1" >"$2" &&
> + ln_s_obj=$(git hash-object -w "$2") &&
> + git update-index --add --cacheinfo 120000 $ln_s_obj "$2"
> + fi
> +}Nicely done. As far as git is concerned, a symlink is nothing but a plain file containing the destination filename (minus the newline) with mode 120000 in the index.
Show 8 quoted lines
> +test_ln_s () {
> + if test_have_prereq SYMLINKS
> + then
> + ln -s "$1" "$2"
> + else
> + printf '%s' "$1" >"$2"
> + fi
> +}What is this? We can't test_ln_s something and then 'git add' it, so what purpose does this serve?