Merge pull request #63 from PKRoma/pk/usehttps
[msysgit.git] / share / msysGit / check-literal-copies.sh
blob90d457595b729d2adcdab77e41939dee5bb7ad55
1 #!/bin/sh
3 # This script will check for files that were literal copies in the
4 # parents of the given commits, but are no literal copies currently
5 # (ignoring those files that do no longer exist).
7 # Use it like this:
9 # $0 $(git rev-list HEAD -- mingw/bin/gcc.exe)
11 # This would check that literal copies were maintained in all the commits
12 # in the current branch that touched mingw/bin/gcc.exe.
14 for rev in "$@"
16 # Ignore initial commit
17 git rev-parse -q --verify $rev^ > /dev/null || continue
19 for f in $(git diff --name-only --diff-filter=RDM $rev^!)
21 test -f $f || continue
22 sha1=$(git rev-parse $rev^:$f)
23 matches="$(git ls-tree -r $rev^ | grep $sha1)"
24 test 1 -lt $(echo "$matches" | wc -l) && {
25 for f2 in $(echo "$matches" | sed "s/.* //")
27 test -f $f2 || continue
28 cmp $f $f2 || echo "$f != $f2"
29 done
31 done
32 done