Blame tests/p_git/11-test_git_clone.sh

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>
Christoph Galuschka 3002b6
#	  Christoph Galuschka <christoph.galuschka@chello.at>
Pratima, Madhurranjan, Nilesh aa2e40
Christoph Galuschka 3002b6
t_Log "Running $0 - testing a local git clone operation"
Pratima, Madhurranjan, Nilesh aa2e40
Christoph Galuschka aea50a
if [ $centos_ver == '6' ]
Christoph Galuschka 3002b6
  then
Christoph Galuschka 3002b6
  # Testing Git clone by comparing SHAs
Christoph Galuschka 3002b6
  workpath=$(pwd)
Christoph Galuschka 3002b6
  rm -rf /tmp/temprepo/ /tmp/cloned_repo/ /tmp/testing_clone_repo  
Christoph Galuschka 3002b6
  temp_repo="/tmp/temprepo"
Christoph Galuschka 3002b6
  SHA1=`echo "hello world" | git hash-object --stdin`
Christoph Galuschka 3002b6
  mkdir -p $temp_repo
Christoph Galuschka 3002b6
  cd $temp_repo
Christoph Galuschka 3002b6
  git init . --bare
Christoph Galuschka 3002b6
  cd /tmp
Christoph Galuschka 3002b6
  git clone $temp_repo cloned_repo
Christoph Galuschka 3002b6
  cd cloned_repo
Christoph Galuschka 3002b6
  echo "hello world" > hello
Christoph Galuschka 3002b6
  git add hello
Christoph Galuschka 3002b6
  git commit -m "Temp commit"
Christoph Galuschka 3002b6
  git push origin master
Christoph Galuschka 3002b6
Christoph Galuschka 3002b6
  git clone $temp_repo /tmp/testing_clone_repo
Christoph Galuschka 3002b6
  cd /tmp/testing_clone_repo
Christoph Galuschka 3002b6
  SHA2=`cat hello | git hash-object --stdin`
Christoph Galuschka 3002b6
  expr $SHA1 == $SHA2 2>&1
Christoph Galuschka 3002b6
  ret_val=$?
Christoph Galuschka 3002b6
  cd $workpath
Christoph Galuschka 3002b6
else
Christoph Galuschka 3002b6
  t_Log "This test is skipped in CentOS5."
Christoph Galuschka 3002b6
  ret_val=0
Christoph Galuschka 3002b6
fi
Christoph Galuschka 3002b6
Christoph Galuschka 3002b6
t_CheckExitStatus $ret_val