Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-11-28 10:42:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
127b96b255191c7d8041ccffe07380ef74480198
127b96b2
1 parent
9c033c7d
add git2unix and git commit script.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
99 行增加
和
0 行删除
trunk/scripts/git.commit.sh
trunk/scripts/git2unix.sh
trunk/scripts/git.commit.sh
0 → 100755
查看文件 @
127b96b
#!/bin/bash
cat
<<END >>/dev/null
touch git-ensure-commit &&
echo "cd `pwd` && git checkout master &&" >git-ensure-commit &&
echo "bash `pwd`/git.commit.sh" >>git-ensure-commit &&
chmod +x git-ensure-commit &&
sudo rm -f /bin/git-ensure-commit &&
sudo mv git-ensure-commit /bin/git-ensure-commit
END
echo
"submit code to github.com"
echo
"argv[0]=
$0
"
if
[[
! -f
$0
]]
;
then
echo
"directly execute the scripts on shell."
;
work_dir
=
`
pwd
`
else
echo
"execute scripts in file:
$0
"
;
work_dir
=
`
dirname
$0
`
;
work_dir
=
`
(
cd
${
work_dir
}
&&
pwd
)
`
fi
work_dir
=
`
(
cd
${
work_dir
}
/..
&&
pwd
)
`
product_dir
=
$work_dir
# allow start script from any dir
cd
$work_dir
&&
git checkout master
.
${
product_dir
}
/scripts/_log.sh
ret
=
$?
;
if
[[
$ret
-ne 0
]]
;
then
exit
$ret
;
fi
ok_msg
"导入脚本成功"
function
remote_check
()
{
remote
=
$1
url
=
$2
git remote -v| grep
"
$url
"
>/dev/null 2>&1
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"remote
$remote
not found, add by:"
echo
" git remote add
$remote
$url
"
exit
-1
fi
ok_msg
"remote
$remote
ok, url is
$url
"
}
remote_check origin git@github.com:winlinvip/simple-rtmp-server.git
remote_check srs.csdn git@code.csdn.net:winlinvip/srs-csdn.git
remote_check srs.oschina git@git.oschina.net:winlinvip/srs.oschina.git
ok_msg
"remote check ok"
function
sync_push
()
{
for
((
;;
))
;
do
git push
$*
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
failed_msg
"Retry for failed: git push
$*
"
sleep 3
continue
else
ok_msg
"Success: git push
$*
"
fi
break
done
}
sync_push --all origin
sync_push --all srs.csdn
sync_push --all srs.oschina
ok_msg
"push refs ok"
sync_push --tags srs.csdn
sync_push --tags srs.oschina
ok_msg
"push tags ok"
exit
0
...
...
trunk/scripts/git2unix.sh
0 → 100755
查看文件 @
127b96b
#!/bin/bash
cat
<<END >>/dev/null
touch git2unix &&
echo "bash `pwd`/git2unix.sh" >git2unix &&
chmod +x git2unix &&
sudo rm -f /bin/git2unix &&
sudo mv git2unix /bin/git2unix
END
dos2unix -V>/dev/null 2>&1
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"dos2unix not found."
echo
" sudo yum install -y dos2unix"
exit
$ret
fi
files
=
`
git status|egrep
"(modified|new file)"
|awk -F
':'
'{print $2}'
|awk
'{print $1}'
|egrep
"(.hpp
$|
.cpp
$|
.cc
$|
.h
$|
.c
$|
.txt
$|
.sh
$)
"
`
;
for
file
in
$files
;
do
dos2unix
$file
;
echo
$file
|grep
".sh$"
>/dev/null 2>&1;
EOF_SH
=
$?
if
[[
$EOF_SH
-ne 0
&&
-f
$file
]]
;
then
echo
"chmod -x
$file
"
chmod -x
$file
;
fi
done
...
...
请
注册
或
登录
后发表评论