Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- repo=$1
- log=$repo".repo_files/log.txt"
- #if there is no repo_files folder in the repo make on
- test -e $repo.repo_files/ || (mkdir $repo".repo_files/" && chmod ug+rw $repo".repo_files/")
- #Make ghost copies of the repo files if there is not a ghost repo located in the repo_files
- test -e $repo.repo_files/ghost_repo/ && echo 'Ghost Repo Found' || (mkdir $repo".repo_files/ghost_repo/" && chmod ug+rw $repo".repo_files/" && rsync -av --exclude=".*" $repo $repo".repo_files/ghost_repo")
- #Check to see if changes have been made
- #If there are changes note them down in a log file
- for f in $(ls $repo); do for f_ghost in $(ls $repo".repo_files/ghost_repo/"); do
- echo $f" "$f_ghost
- if ("$($f)" == "$($f_ghost)")
- then
- cat "#"$f": Changes"
- #lines added since last commit
- for line in $(comm -2 -3 $f $f_ghost); do
- ("[+]"$line) > $log
- done
- #lines removed since last commit
- for line in $(comm -1 -3 $f $f_ghost); do
- ("[-]"$line) > $log
- done
- fi
- done;
- for f in $($repo".repo_files/ghost_repo"); do
- test -e $repo..$f && "$("[Deleted File] "$f)" > $log
- done
- for f in $($repo); do
- if -e $repo/.repo_files/ghost_repo/$f; then
- "$("[Added File] "$f)" > $log
- "$("#"$f": Changes")" > $log
- for line in $f; do
- ("[+]"$line) > $log
- done
- fi
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment