Allow specifying the branch name after the repository URL for gitsync command-line arguments and remove an unnecessary use of the backtick operator.

This commit is contained in:
Erik Fonnesbeck 2012-02-28 12:14:21 -07:00
parent 0b29093bc4
commit 2044cb61fc

View File

@ -112,18 +112,30 @@ foreach($branches as $branchname => $branchdesc) {
}
if(!$found) {
if(isURL($branch) && !$upgrading) {
echo "\n";
echo "NOTE: $branch was not found.\n\n";
$command = readline("Is this a custom GIT URL? [y]? ");
if(strtolower($command) == "y" or $command == "") {
if($command_split[3]) {
$GIT_REPO = $branch;
$command = readline("Checkout which branch [master]? ");
if($command == "")
$branch = "master";
if($command)
$branch = $command;
$branch = $command_split[3];
$found = true;
}
else if($argv[4]) {
$GIT_REPO = $branch;
$branch = $argv[4];
$found = true;
}
else {
echo "\n";
echo "NOTE: $branch was not found.\n\n";
$command = readline("Is this a custom GIT URL? [y]? ");
if(strtolower($command) == "y" or $command == "") {
$GIT_REPO = $branch;
$command = readline("Checkout which branch [master]? ");
if($command == "")
$branch = "master";
if($command)
$branch = $command;
$found = true;
}
}
}
if(!$found) {
echo "\nNo valid branch found. Exiting.\n\n";
@ -200,7 +212,7 @@ if($branch == "build_commit") {
$git_cmd = array(
"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git branch " . escapeshellarg($branch) . " 2>/dev/null",
"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git checkout -f " . escapeshellarg($branch) . " 2>/dev/null",
"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard `cat /etc/version.lastcommit`"
"cd $CODIR/pfSenseGITREPO/pfSenseGITREPO && git reset --hard " . escapeshellarg(file_get_contents("/etc/version.lastcommit"))
);
} else {
$git_cmd = array(