On Mon, Apr 18, 2011 at 9:57 AM, Pieter Praet <pieter@praet.org> wrote: > On Fri, 1 Apr 2011 11:47:25 +0300, Amit Kucheria <amit.kucheria@verdurent.com> wrote: >> Hi, >> >> I am wondering how developers on this list handle the case of grabbing >> a patch series posted to the list and using something like git-am to >> apply it to their local trees. > > See id:"m2vd3p3u78.fsf@kcals.maillard.im" > >> Several patches in the series could have replies to them and hence >> they need to be filtered out. >> >> e.g. I use notmuch show --output=mbox thread:000000000000eb4e to get >> the basic series. But I'd appreciate any tips on filtering out the >> replies. > > Something like this might work: > > noreplieskthxbye() { > thread_id=${1} > target_dir=/tmp/${thread_id} > test -d ${target_dir} && echo "Patch queue dirty. Remove ${target_dir}" && return 1 > mkdir -p ${target_dir} > notmuch show --format=mbox ${thread_id} | git mailsplit -o${target_dir} > grep -l "^diff --git" ${target_dir}/* | xargs git am -3 > rm -rf ${target_dir} # "Danger, Will Robinson!" > } > > noreplieskthxbye thread:000000000000eb4e > > But I'd be suprised beyond belief if there weren't a *sane* way to do > this. I might also need some coffee first... I haven't found a 'sane way' yet. Your scripting hack looks like a good way to start though.