Re: [PATCH] remote-hg: fix path when cloning with tilde expansion

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] remote-hg: fix path when cloning with tilde expansion

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:23

Felipe Contreras [off-list ref] writes:
quoted
OK, I think I see why you are puzzled.

Cloning works fine because we "fix the path" *after* the clone is done
successfully, for the following reason:
So if we didn't store a different path, it would work. So instead of
expanding '~' ourselves, it would be better to don't expand anything,
and leave it as it is, but how to detect that in fix_path()?
I think that the patch relies on that os.path.expanduser(), if
url.path is such a path that begins with "~" (or "~whom"), returns
an absolute path.  When given an absolute path, or "~whom/path",
fix_path returns without running 'git config' on remote.<alias>.url
configuration.

Presumably this "git config" is to "fix" what is already there, and
in the case where the path is already absolute
(e.g. "/home/ap/hgrepo" as opposed to "~ap/hgrepo") the resulting
repository has a correct value for the variable set already without
the need to fix it (that is why the original code just returns from
the function), so doing the same for "~whom" case with this patch
should leave the setting, which presumably is "hg::~ap/hgrepo"?

Re: [PATCH] remote-hg: fix path when cloning with tilde expansion

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:23

On Fri, Aug 9, 2013 at 5:15 PM, Junio C Hamano [off-list ref] wrote:
Felipe Contreras [off-list ref] writes:
quoted
quoted
OK, I think I see why you are puzzled.

Cloning works fine because we "fix the path" *after* the clone is done
successfully, for the following reason:
So if we didn't store a different path, it would work. So instead of
expanding '~' ourselves, it would be better to don't expand anything,
and leave it as it is, but how to detect that in fix_path()?
I think that the patch relies on that os.path.expanduser(), if
url.path is such a path that begins with "~" (or "~whom"), returns
an absolute path.  When given an absolute path, or "~whom/path",
fix_path returns without running 'git config' on remote.<alias>.url
configuration.
I think ~whom/path would run 'git config'.

-- 
Felipe Contreras
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help