I would like to get a list of all files, which have changed betweet two commits including those in submodules.
I know I can do this:
git diff --name-
You can find out what version a submodule was at, as of a given parent module commit, using git ls-tree:
subcommit=$(git ls-tree $parentcommit $submodulepath | awk '{print $3}')
So here's a script that should get you much of the way there, up to output formatting and such:
#!/bin/sh
function compare {
if [[ -z "$3" ]];
then git diff --name-only --ignore-submodules=all --diff-filter=ACMR "$1" "$2"
else git diff --name-only --ignore-submodules=all --diff-filter=ACMR "$1" "$2" | awk -v r=$3 '{ print "" r "/" $0}'
fi
for submodule in `git submodule | awk '{print $2}'`
do
old=$(git ls-tree $1 $submodule | awk '{print $3}')
new=$(git ls-tree $2 $submodule | awk '{print $3}')
(cd $submodule; compare $old $new $submodule)
done
}
compare "$1" "$2"
This will output all files like this (although Base is a submodule): HtmlTemplates/Css/Screen.css Base/Php/Classes/Helper.php