-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_1.sh
More file actions
executable file
·48 lines (36 loc) · 918 Bytes
/
build_1.sh
File metadata and controls
executable file
·48 lines (36 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
function copy_changes {
TO_REPO=$1
BRANCH=$2
echo TO_REPO = $TO_REPO
echo BRANCH = $BRANCH
# Make sure both repos are on master
git checkout $BRANCH
cd ../$TO_REPO
git checkout $BRANCH
cd ../test
# Get the latest commit number
COMMIT=$(git show | head -n 1)
echo COMMIT = $COMMIT
# Compare to the commit # stored in $TO_REPO
COMMIT_1=$(cat ../$TO_REPO/.commit)
echo COMMIT_1 = $COMMIT_1
# If they are the same we are done
if [ "$COMMIT" == "$COMMIT_1" ]
then
echo "$TO_REPO $BRANCH is current."
exit
fi
# Copy the files we want to test_1
cp -p file.txt ../$TO_REPO/
cp -p file1.txt ../$TO_REPO/
echo $COMMIT > ../$TO_REPO/.commit
# Switch to $TO_REPO repo and commit changes
cd ../$TO_REPO
git add -A
git commit -m "Commit"
git push
# Switch back to original directory
cd ../test
}
copy_changes "test_1" "master"