Skip to content

hash-object --literally

Junio C Hamano git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3hash-object: reduce file-scope staticsbuiltin/hash-object.c+23 -290 replies
2/3hash-object: pass 'write_object' as a flagbuiltin/hash-object.c+15 -170 replies
3/3hash-object: add --literally optionbuiltin/hash-object.c+36 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] hash-object --literally

Our toolset may have become too tight without leaving enough escape hatch to hinder further development. "hash-object" makes minimum sanity checks by default for a very good reason, but it means that we cannot deliberately create broken datastreams to test against fsck and other codepaths that are supposed to detect and report such broken data that we may encounter in the field, perhaps created by third-party tools.

These changes teach a new "--literally" option to "hash-object" to allow us throw any garbage to create a broken loose object. You can even do something horrible like

	git hash-object -t bogus --literally -w --stdin </dev/null

by any garbage typename if you wanted to.

It probably needs to be accompanied by "cat-file --literally" that does not take "-t <type>" option or does not complain even if the contents look unreasonable. But that is for another day (hint, hint).

The second patch is optional. I thought I may want to pass this as a new HASH_LITERALLY bit down the callchain to index_fd(), but I decided against it, as that will allow other codepaths to create broken datastream, spreading this debugging aid a bit too widely for my taste.

Junio C Hamano (3):
hash-object: reduce file-scope statics
hash-object: pass 'write_object' as a flag
hash-object: add --literally option

 builtin/hash-object.c | 103 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 61 insertions(+), 42 deletions(-)
Signature · 1 line
2.1.0-459-g1bc3b2b