From: "Torsten Bögershausen" <tboegi@web.de>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: t1503 broken ?
Date: Sat, 25 Mar 2017 20:41:41 +0100 [thread overview]
Message-ID: <d2c587c4-18ca-a685-a53f-02106b1527ee@web.de> (raw)
In-Reply-To: <20170325130549.GA20618@ash>
On 03/25/2017 02:05 PM, Duy Nguyen wrote:
> On Sat, Mar 25, 2017 at 07:26:14PM +0700, Duy Nguyen wrote:
>> On Sat, Mar 25, 2017 at 6:46 PM, Duy Nguyen <pclouds@gmail.com> wrote:
>>> On Sat, Mar 25, 2017 at 5:46 PM, Torsten Bögershausen <tboegi@web.de> wrote:
>>>> ./t1305-config-include.sh
>>>> seems to be broken:
>>>> not ok 19 - conditional include, $HOME expansion
>>>> not ok 21 - conditional include, relative path
>>> let me guess, your "git" directory is in a symlink path?
>> Yes I could reproduce it when I put my "git" in a symlink. There's a
>> note in document about "Symlinks in `$GIT_DIR` are not resolved before
>> matching" but failing tests is not acceptable. I'll fix it.
> The fix may be something like this. The problem is $GIT_DIR has symlinks
> resolved, but we don't do the same for other paths in this code. As a
> result, matching paths fails.
>
> I'm a bit concerned about the change in expand_user_path() because I'm
> not quite sure if it's a completely safe change. But at least could
> you try the patch and see if it passe the tests on your machine too?
>
> -- 8< --
> diff --git a/config.c b/config.c
> index 1a4d855..fc4eae9 100644
> --- a/config.c
> +++ b/config.c
> @@ -191,7 +191,7 @@ static int prepare_include_condition_pattern(struct strbuf *pat)
> return error(_("relative config include "
> "conditionals must come from files"));
>
> - strbuf_add_absolute_path(&path, cf->path);
> + strbuf_realpath(&path, cf->path, 1);
> slash = find_last_dir_sep(path.buf);
> if (!slash)
> die("BUG: how is this possible?");
> @@ -213,7 +213,7 @@ static int include_by_gitdir(const char *cond, size_t cond_len, int icase)
> struct strbuf pattern = STRBUF_INIT;
> int ret = 0, prefix;
>
> - strbuf_add_absolute_path(&text, get_git_dir());
> + strbuf_realpath(&text, get_git_dir(), 1);
> strbuf_add(&pattern, cond, cond_len);
> prefix = prepare_include_condition_pattern(&pattern);
>
> diff --git a/path.c b/path.c
> index 2224843..18eaac3 100644
> --- a/path.c
> +++ b/path.c
> @@ -654,7 +654,7 @@ char *expand_user_path(const char *path)
> const char *home = getenv("HOME");
> if (!home)
> goto return_null;
> - strbuf_addstr(&user_path, home);
> + strbuf_addstr(&user_path, real_path(home));
> #ifdef GIT_WINDOWS_NATIVE
> convert_slashes(user_path.buf);
> #endif
> -- 8< --
Thanks for the fast reply.
Yes, my path is a softlink - into a directory under NoBackup/ - to make
the backup shorter.
And I had forgotten about this :-(
And yes, your patch fixes it- tested under Linux.
next prev parent reply other threads:[~2017-03-25 19:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-25 10:46 t1503 broken ? Torsten Bögershausen
2017-03-25 11:46 ` Duy Nguyen
2017-03-25 12:26 ` Duy Nguyen
2017-03-25 13:05 ` Duy Nguyen
2017-03-25 19:41 ` Torsten Bögershausen [this message]
2017-03-30 11:37 ` [PATCH 1/2] path.c: and an option to call real_path() in expand_user_path() Nguyễn Thái Ngọc Duy
2017-03-30 11:37 ` [PATCH 2/2] config: resolve symlinks in conditional include's patterns Nguyễn Thái Ngọc Duy
2017-03-30 18:38 ` Junio C Hamano
2017-04-04 10:12 ` Duy Nguyen
2017-04-05 10:24 ` [PATCH v2 1/2] path.c: and an option to call real_path() in expand_user_path() Nguyễn Thái Ngọc Duy
2017-04-05 10:24 ` [PATCH v2 2/2] config: resolve symlinks in conditional include's patterns Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d2c587c4-18ca-a685-a53f-02106b1527ee@web.de \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).