I am currently working with a set of Git repositories with lots of 
committers across multiple operating systems, and committing from both Git 
and EGit/JGit. This makes for lots of opportunities to get variations in 
line endings in the repository. I implemented .gitattributes specifying 
which files were text files before I learned that JGit doesn't honor that 
(at least, not yet). However, it means that I do have an opportunity to 
check for line termination inconsistency by comparing to the output of git 
check-attr for any particular path, since I intend that to be canonical.

I thought I'd share the small shell script I cobbled together as an example 
of what can be done this way. It doesn't deal with weird filenames or do 
error checking, it's just an example of how to string together some git 
commands to perform this task.

[ -z "$1" ] && {
  echo "usage: $0 <tree-ish>"
  exit 1

git ls-tree -r $1 | grep 'blob' | \
    while read perm type hash file ; do
        if git check-attr text $file | grep -v 'unset$' >/dev/null ; then
            git cat-file blob $hash | od -a | grep ' cr ' && echo $file ;

Perhaps that might be useful to someone someday as a starting point.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit 
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to