ifnull
6/11/2013 - 10:17 PM

git add alias for git annex that excludes selected file extensions from master and adds them to annex.

git add alias for git annex that excludes selected file extensions from master and adds them to annex.

#######################
# Setup
#######################
mkdir annex-test
cd annex-test
git init
git annex init master

#######################
# Fab setup task
#######################
git config --local core.excludesfile ./.gitignore_large_binaries
git config --local alias.a '! sh ./git-add.sh'

#######################
# git a (git-add.sh)
#######################

# Generate annex include arg from .gitignore_large_binaries
include_str="--include='.lazy'";

while read line
do
    if [[ "$line" != *"#"* ]] && [[ "$line" != "" ]]; then 
        include_str="$include_str --or --include=${line}";
    fi
done < "./.gitignore_large_binaries"

# git annex add
git config --local core.excludesfile ./.gitignore;
git annex add $1 $include_str;

# git add
git config --local core.excludesfile ./.gitignore_large_binaries;
git add $1