On 05/14, Michael Haggerty wrote: > On 05/14/2012 05:01 PM, Thomas Gummerer wrote: > >Thanks a lot for your feedback. I've now refactored the code and > >thanks to your suggestions hopefully made it simpler and easier > >to read. The reader should now read exactly the data from the > >spec. > > Yes, the style is much better now. Here is the next round of feedback: > [...] > > >DIR_DATA_STRUCT = struct.Struct("!HIIIIII 20s") > > > > > >def read_dirs(f, ndir): > > dirs = list() > > for i in xrange(0, ndir): > > (pathname, partialcrc) = read_name(f) > > > > (filedata, partialcrc) = read_calc_crc(f, DIR_DATA_STRUCT.size, partialcrc) > > (flags, foffset, cr, ncr, nsubtrees, nfiles, > > nentries, objname) = DIR_DATA_STRUCT.unpack(filedata) > > # ... > > [...] Thanks again for your feedback. I've refactored the code again, thanks to your suggestions. If I'm correct it's fine to have the compiled structs global? > What is your plan for testing this code, and later the C version? > For example, you might want to have a suite of index files with > various contents, and compare the "git ls-files --debug" output with > the output that is expected. How would you create index files like > this? Via git commands? Or should one of your Python scripts be > taught how to do it? I thought of using real world examples for this, for example the WebKit index, which is pretty large, and some others, for example the git index and the linux kernel index. There would be some changes necessary to the output format of git ls-files --debug, to work with the new index format, but those should be fairly simple. > To make testing easier, you probably don't want to hard-code the > name of the input file in git-read-index-v5.py, so that you can use > it to read arbitrary files. For example, you might want to honor > the GIT_INDEX_FILES environment variable in some form, or to take > the name of the index file as a command-line argument. I've changed this in the script, which now takes a --file argument with the file name of the index file that should be read. (git-read-index-v5.py --file=FILENAME) -- Thomas -- 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