Re: unexplained behavior/issue with git archive?
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:05:52
John Keeping [off-list ref] writes:
With a small number of items, there should only be one output line, but if xargs invokes the command multiple times there will be multiple lines. For example (using -L2 to force a maximum of two arguments per invocation): $ printf '%s\n' a b c | xargs -d'\n' echo | wc -l 1 $ printf '%s\n' a b c | xargs -d'\n' -L2 echo | wc -l 2
Yup, I think this thread is mistitled; it looks like an "unexpected behaviour with xargs". Or "common pitfalls with xargs", perhaps. Now, what would be a reasonable workaround. To work around command line length limits (not necessarily for xargs, but the exact same issue would arise if you are trying to specify too many pathspecs on the command line), many of our commands take paths from their standard input. Would it be reasonable to teach "git archive" to also do so? Or would it make sense to teach "git archive -o" a new mode to append to an existing archive, so that repeated invocations of "git archive" via such a use of "xargs" would create in the first invocation and then keep appending to the same archive in the subsequent invocations?