Re: [PATCH v2 3/4] cat-file --textconv/--filters: allow specifying the path separately
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 24, 2016, 17:49 UTC
- Message-ID
- <xmqqinuqqcor.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <d9e9d8b111efd161986aee32bb3ae0baec0dcf34.1472041389.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 12 quoted lines
> @@ -65,6 +68,11 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
> if (get_sha1_with_context(obj_name, 0, sha1, &obj_context))
> die("Not a valid object name %s", obj_name);
>
> + if (!path)
> + path = obj_context.path;
> + else if (obj_context.mode == S_IFINVALID)
> + obj_context.mode = 0100644;
> +
> buf = NULL;
> switch (opt) {
> case 't':Mentioned elsewhere, but I think the above should be
if (!path)
path = obj_context.path; if (obj_context.mode == S_IFINVALID)
obj_context.mode = 0100644;IOW, even when there is an explicit path supplied, we should fall back to assumed "regular blob" mode, so that
git cat-file --filters --path=README $(git rev-parse :README)
would work as expected.