On Mon, Mar 25, 2013 at 02:10:38PM -0700, Jonathan Nieder wrote: > > +# convert "1234abcd" to ".git/objects/12/34abcd" > > +obj_to_file() { > > + echo "$(git rev-parse --git-dir)/objects/$(git rev-parse "$1" | sed 's,..,&/,')" > > +} > > Maybe this would be clearer in multiple lines? > > commit=$(git rev-parse --verify "$1") && > git_dir=$(git rev-parse --git-dir) && > tail=${commit#??} && > echo "$git_dir/objects/${commit%$tail}/$tail" Yeah, it started as: echo "$1" | sed 's,..,&/,' and kind of got out of hand as it grew features. I'd be fine with your version (though $commit is not right, as it is any object, and in fact the test uses blobs). > > + > > +# Convert byte at offset "$2" of object "$1" into '\0' > > +corrupt_byte() { > > + obj_file=$(obj_to_file "$1") && > > + chmod +w "$obj_file" && > > + printf '\0' | dd of="$obj_file" bs=1 seek="$2" > > Some other tests such as t4205 also rely on "printf" being > binary-safe. Phew. Yeah, I think it should be fine, though the choice of character does not actually matter, as long as it is different from what is currently at that position (for the sake of simplicity, I just determined experimentally that the given object is corrupted with the offset and character I chose). -Peff -- 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