Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
25442f20
Commit
25442f20
authored
12 years ago
by
Mike McQuaid
Browse files
Options
Downloads
Patches
Plain Diff
brew-test-bot: Change directory only for Git commands.
parent
d01adbc9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Contributions/cmds/brew-test-bot.rb
+19
-8
19 additions, 8 deletions
Library/Contributions/cmds/brew-test-bot.rb
with
19 additions
and
8 deletions
Library/Contributions/cmds/brew-test-bot.rb
+
19
−
8
View file @
25442f20
...
...
@@ -70,7 +70,14 @@ class Step
def
self
.
run
test
,
command
,
output_on_success
=
false
step
=
new
test
,
command
step
.
puts_command
`
#{
step
.
command
}
&>
#{
step
.
log_file_path
}
`
command
=
"
#{
step
.
command
}
&>
#{
step
.
log_file_path
}
"
if
command
.
start_with?
'git '
Dir
.
chdir
HOMEBREW_REPOSITORY
{
`
#{
command
}
`
}
else
`
#{
command
}
`
end
step
.
status
=
$?
.
success?
?
:passed
:
:failed
step
.
puts_result
puts
IO
.
read
(
step
.
log_file_path
)
if
output_on_success
...
...
@@ -142,18 +149,24 @@ class Test
end
end
def
git
arguments
Dir
.
chdir
HOMEBREW_REPOSITORY
do
`git
#{
arguments
}
`
end
end
def
download
def
current_sha1
`
git
rev-parse --short HEAD
`
.
strip
git
(
'
rev-parse --short HEAD
'
)
.
strip
end
def
current_branch
`
git
symbolic-ref HEAD
`
.
slice!
(
"refs/heads/"
).
strip
git
(
'
symbolic-ref HEAD
'
)
.
slice!
(
"refs/heads/"
).
strip
end
@category
=
__method__
if
@url
`
git am --abort 2>/dev/null
`
git
'
am --abort 2>/dev/null
'
test
"brew update"
if
current_branch
==
"master"
@start_sha1
=
current_sha1
test
"brew pull --clean
#{
@url
}
"
...
...
@@ -171,7 +184,7 @@ class Test
return
unless
@url
and
@start_sha1
!=
end_sha1
and
steps
.
last
.
status
==
:passed
`
git
diff
#{
@start_sha1
}
..
#{
end_sha1
}
--name-status`
.
each_line
do
|
line
|
git
(
"
diff
#{
@start_sha1
}
..
#{
end_sha1
}
--name-status`.each_line
"
)
do
|
line
|
status
,
filename
=
line
.
split
# Don't try and do anything to removed files.
if
(
status
==
'A'
or
status
==
'M'
)
...
...
@@ -216,7 +229,7 @@ class Test
test
"git reset --hard origin/master"
test
"git clean --force -dx"
else
`
git
diff --exit-code HEAD 2>/dev/null
`
git
(
'
diff --exit-code HEAD 2>/dev/null
'
)
odie
"Uncommitted changes, aborting."
unless
$?
.
success?
test
"git reset --hard
#{
@start_sha1
}
"
if
@start_sha1
end
...
...
@@ -273,8 +286,6 @@ if ARGV.empty?
odie
'This command requires at least one argument containing a pull request number or formula.'
end
Dir
.
chdir
HOMEBREW_REPOSITORY
ARGV
.
named
.
each
do
|
arg
|
Test
.
run
arg
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment