|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
#!/bin/bash
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
# Author: Pratima Singh <prati.86@gmail.com>, Nilesh Bairagi <nileshbairagi@gmail.com>, Madhurranjan Mohaan <madhurranjan.mohaan@gmail.com>
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
# Testing Git clone by comparing SHAs
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
rm -rf /tmp/temprepo/ /tmp/cloned_repo/ /tmp/testing_clone_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
temp_repo="/tmp/temprepo"
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
SHA1=`echo "hello world" | git hash-object --stdin`
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
mkdir -p $temp_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
cd $temp_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
git init . --bare
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
cd /tmp
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
git clone $temp_repo cloned_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
cd cloned_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
echo "hello world" > hello
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
git add hello
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
git commit -m "Temp commit"
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
git push origin master
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
git clone $temp_repo /tmp/testing_clone_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
cd /tmp/testing_clone_repo
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
SHA2=`cat hello | git hash-object --stdin`
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
expr $SHA1 == $SHA2 2>&1
|
|
Pratima, Madhurranjan, Nilesh |
aa2e40 |
t_CheckExitStatus $?
|