Thread (1 message) 1 message, 1 author, 2016-09-09

Re: [PATCH v3 2/4] cat-file: introduce the --filters option

From: Junio C Hamano <hidden>
Date: 2016-09-09 16:08:18

Johannes Schindelin [off-list ref] writes:
quoted
quoted
+	if (type != OBJ_BLOB) {
+		free(*buf);
+		return error(_("blob expected for %s '%s'"),
+			sha1_to_hex(sha1), path);
+	}
+	if (S_ISREG(mode)) {
+		struct strbuf strbuf = STRBUF_INIT;
+		if (convert_to_working_tree(path, *buf, *size, &strbuf)) {
+			free(*buf);
+			*size = strbuf.len;
+			*buf = strbuf_detach(&strbuf, NULL);
+		}
+	}
This needs to error out when mode is not ISREG just like it errors
out when type is not BLOB.
Are you sure that this is desirable in batch mode?
I do not quite see a reason why we should not diagnose a bad input
that does not produce a filtered result.  In batch mode or not, it
diagnoses when the user feeds it a non-blob, and I think it should
do so for non-regular, too. Both are "you asked me to filter, but
you shouldn't have".


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