From: Junio C Hamano Date: Wed, 24 Aug 2016 18:25:51 GMT Subject: Re: [PATCH v2 3/4] cat-file --textconv/--filters: allow specifying the path separately Message-ID: In-Reply-To: Junio C Hamano writes: > 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. Actually, I am reading the conditional the other way, but the conclusion "defaulting from unknown mode to regular blob is necessary whether the user gave us a path or not" is the same. The current code may fail if --path is not available and 40-hex that does not give us any context of look up is given because it won't be able to decide how to filter, so using "else if" would not have practical difference there, but conceptually it still is wrong.