summaryrefslogtreecommitdiffstats
path: root/etc/phpshellsessions/gitsync
diff options
context:
space:
mode:
authorErik Fonnesbeck <efonnes@gmail.com>2012-02-28 12:14:21 -0700
committerErik Fonnesbeck <efonnes@gmail.com>2012-02-28 12:22:18 -0700
commit2044cb61fc2399becf7a42a0c3b44f3f396d74fe (patch)
tree5a2a1f34c027d2c046dfaa69061054c910455161 /etc/phpshellsessions/gitsync
parent0b29093bc42d5ed3fbcabacc8f09be99ac9dda7f (diff)
downloadpfsense-2044cb61fc2399becf7a42a0c3b44f3f396d74fe.zip
pfsense-2044cb61fc2399becf7a42a0c3b44f3f396d74fe.tar.gz
Allow specifying the branch name after the repository URL for gitsync command-line arguments and remove an unnecessary use of the backtick operator.
Diffstat (limited to 'etc/phpshellsessions/gitsync')
-rw-r--r--etc/phpshellsessions/gitsync32
1 files changed, 22 insertions, 10 deletions
diff --git a/etc/phpshellsessions/gitsync b/etc/phpshellsessions/gitsync
index 3e6a949..b91eed2 100644
--- a/etc/phpshellsessions/gitsync
+++ b/etc/phpshellsessions/gitsync
@@ -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;
+ $branch = $command_split[3];
+ $found = true;
+ }
+ else if($argv[4]) {
$GIT_REPO = $branch;
- $command = readline("Checkout which branch [master]? ");
- if($command == "")
- $branch = "master";
- if($command)
- $branch = $command;
+ $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(
OpenPOWER on IntegriCloud