On Thu, Feb 23, 2012 at 12:14:23PM +0300, Nikolaj Shurkaev wrote: > I wanted to generate several files with some statistics using "git > log -z" command. > I did something like this: > git log -z --patch HEAD~10..HEAD -- SomePathHere | xargs -0 > --max-chars=1000000 ~/1.sh I'm not sure what "1.sh" is expecting to take as input, but that will feed entire commits, including their commit message and entire diff, to the script on its command line. That seems like an awkward interface, but we don't really know what your script intends to do. Maybe it is worth sharing the contents of the script. > If I put echo "started" into the file ~/1.sh I see that the file is > called only once instead of multiple times. Yes. The point of xargs is usually to cram as many arguments into each invocation of "1.sh" as possible, splitting into multiple invocations only when we hit the argument-list memory limit that the OS imposes. If you want xargs to give each argument its own invocation of the script, use "xargs -n1". > I'm newbie to xargs, thus I tested with and that worked as I expected. > find . -type f -print0 | xargs -0 ./1.sh > That produced a lost of "started" lines. If you instrument your 1.sh more[1], you will find that is not executing once per file, but rather getting a large chunk of files per invocation. [1] Try adding: echo "got args: $*" > Thus I suspect there is a but in git log -z command and that doesn't > "Separate the commits with NULs instead of with new newlines." as > promised in the documents. You could verify that assertion by looking at the output. Try piping your "git log" command through "cat -A | less". When I try it, I see a NUL between each commit (cat -A will show it as "^@"). -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