Thread (10 messages) flat view 10 messages, 5 authors, 2016-06-15

Re: git log -z doesn't separate commits with NULs

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:53:08

Nikolaj Shurkaev [off-list ref] writes:
Thank you very much for your tips. They really helped me. I was trying
to create patches that would affect only some given files or
folders. By this moment I have the following:

GeneratePatches.sh
---------------------
#!/bin/bash
#parameter 1 - <since>..<to>
#parameter 2 - path to file
git log -z --reverse --format=email --patch "$1" -- "$2" | xargs
--null --max-args=1 ./CreatePatchFile.sh
---------------------

and CreatePatchFile.sh
---------------------
#!/bin/bash

myPatchNumber=$(ls ./*-patch.patch 2>/dev/null | wc -l)
let "myPatchNumber += 1"

patchFile="./"$(printf "%04d" $myPatchNumber)"-patch.patch"
echo "$@" > "$patchFile"
---------------------

I call
./GeneratePatches.sh HEAD~3..HEAD SomePath
and that produces something very similar to what I want.

Perhaps there is a better way to do that.
So what git-format-patch is lacking?

-- 
Jakub Narebski
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help