Re: [PATCH] dir.c: do not trip over difference in "/"

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

 



2011/3/25 Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>:
> get_relative_cwd() tries to determine a common prefix for dir and cwd.
> The fix in
> 490544b (get_cwd_relative(): do not misinterpret suffix as subdirectory, 2010-05-22)
> made the logic less naive (so that foo-bar is not misdetected as being
> within foo) but broke some other cases, in particular foo not being
> detected as being within foo/ any more.

I'd rather kill this function off. It's only used in is_inside_dir(),
we can be replaced with is_subdir_or_same() in my previous patch (more
or less the same function with get_relative_cwd, but less cryptic).

> diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
> index bd8b607..f0dbdd8 100755
> --- a/t/t1501-worktree.sh
> +++ b/t/t1501-worktree.sh
> @@ -63,6 +63,19 @@ cd sub/dir || exit 1
> Âtest_rev_parse 'subdirectory' false false true sub/dir/
> Âcd ../../.. || exit 1
>
> +say "core.worktree = absolute path/"
> +GIT_DIR=$(pwd)/repo.git
> +GIT_CONFIG=$GIT_DIR/config
> +git config core.worktree "$(pwd)/work/"
> +test_rev_parse 'outside' Â Â Âfalse false false
> +cd work2
> +test_rev_parse 'outside2' Â Â false false false
> +cd ../work || exit 1
> +test_rev_parse 'inside' Â Â Â false false true ''
> +cd sub/dir || exit 1
> +test_rev_parse 'subdirectory' false false true sub/dir/
> +cd ../../.. || exit 1
> +
> Âsay "GIT_WORK_TREE=relative path (override core.worktree)"
> ÂGIT_DIR=$(pwd)/repo.git
> ÂGIT_CONFIG=$GIT_DIR/config

I tried something similar (basically core.worktree = $(pwd)/work/) but
could not reproduce. Note that worktree will be normalized by
real_path() (or get_absolute_path() earlier) and the trailing '/' may
have been removed.
-- 
Duy
--
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]