Re: [PATCH 3/3] get_sha1: support relative path ":path" syntax

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

 



2010/11/11 Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>:
> Currently :path and ref:path can be used to refer to a specific object
> in index or ref respectively. "path" component is absolute path. This
> patch allows "path" to be written as "./path" or "../path", which is
> relative to user's original cwd.
>
> This does not work in commands for which startup_info is NULL
> (i.e. non-builtin ones, it seems none of them needs this anyway).
>
> Signed-off-by: Nguyán ThÃi Ngác Duy <pclouds@xxxxxxxxx>
> ---
> Âsha1_name.c          Â|  37 ++++++++++++++++++++++--
> Ât/t1506-rev-parse-diagnosis.sh | Â 62 ++++++++++++++++++++++++++++++++++++++++
> Â2 files changed, 96 insertions(+), 3 deletions(-)
>
> diff --git a/sha1_name.c b/sha1_name.c
> index 484081d..22c1df9 100644
> --- a/sha1_name.c
> +++ b/sha1_name.c
> @@ -1046,6 +1046,23 @@ int get_sha1_with_mode_1(const char *name, unsigned char *sha1, unsigned *mode,
> Â Â Â Âreturn ret;
> Â}
>
> +static char *resolve_relative_path(const char *rel)
> +{
> + Â Â Â if (prefixcmp(rel, "./") && prefixcmp(rel, "../"))
> + Â Â Â Â Â Â Â return NULL;
> +
> + Â Â Â if (!startup_info)
> + Â Â Â Â Â Â Â die("Relative path syntax is not supported in this command. Please report.");
Is the "Please report." necessary? Report to who? Where? (I know we
know these answers, but maybe a new user won't know them).

> +
> + Â Â Â if (!is_inside_work_tree())
> + Â Â Â Â Â Â Â die("relative path syntax can't be used outside working tree.");
nit: s/relative/Relative ?
--
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]