-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #600 from cloudflare/branch
Fix --base-branch handling
- Loading branch information
Showing
4 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
mkdir testrepo | ||
cd testrepo | ||
exec git init --initial-branch=main . | ||
|
||
cp ../src/v1.yml rules.yml | ||
cp ../src/.pint.hcl . | ||
env GIT_AUTHOR_NAME=pint | ||
env [email protected] | ||
env GIT_COMMITTER_NAME=pint | ||
env [email protected] | ||
exec git add . | ||
exec git commit -am 'import rules and config' | ||
|
||
exec git checkout -b v2 | ||
cp ../src/v2.yml rules.yml | ||
exec git commit -am 'v2' | ||
|
||
pint.error -l debug --no-color ci --base-branch=origin/main | ||
! stdout . | ||
cmp stderr ../stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=info msg="Loading configuration file" path=.pint.hcl | ||
level=debug msg="Running git command" args=["rev-parse","--abbrev-ref","HEAD"] | ||
level=debug msg="Got branch information" base=origin/main current=v2 | ||
level=debug msg="Running git command" args=["log","--format=%H","--no-abbrev-commit","--reverse","origin/main..HEAD"] | ||
level=fatal msg="Fatal error" error="failed to get the list of commits to scan: fatal: ambiguous argument 'origin/main..HEAD': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n" | ||
-- src/v1.yml -- | ||
- record: rule1 | ||
expr: sum(foo) by(job) | ||
|
||
-- src/v2.yml -- | ||
- record: rule1 | ||
expr: sum(foo) bi(job) | ||
|
||
-- src/.pint.hcl -- | ||
parser { | ||
relaxed = [".*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
mkdir testrepo | ||
cd testrepo | ||
exec git init --initial-branch=main . | ||
|
||
cp ../src/v1.yml rules.yml | ||
cp ../src/.pint.hcl . | ||
env GIT_AUTHOR_NAME=pint | ||
env [email protected] | ||
env GIT_COMMITTER_NAME=pint | ||
env [email protected] | ||
exec git add . | ||
exec git commit -am 'import rules and config' | ||
|
||
exec git checkout -b v2 | ||
cp ../src/v2.yml rules.yml | ||
exec git commit -am 'v2' | ||
|
||
pint.error -l debug --no-color ci | ||
! stdout . | ||
cmp stderr ../stderr.txt | ||
|
||
-- stderr.txt -- | ||
level=info msg="Loading configuration file" path=.pint.hcl | ||
level=debug msg="Running git command" args=["rev-parse","--abbrev-ref","HEAD"] | ||
level=debug msg="Got branch information" base=origin/main current=v2 | ||
level=debug msg="Running git command" args=["log","--format=%H","--no-abbrev-commit","--reverse","origin/main..HEAD"] | ||
level=fatal msg="Fatal error" error="failed to get the list of commits to scan: fatal: ambiguous argument 'origin/main..HEAD': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n" | ||
-- src/v1.yml -- | ||
- record: rule1 | ||
expr: sum(foo) by(job) | ||
|
||
-- src/v2.yml -- | ||
- record: rule1 | ||
expr: sum(foo) bi(job) | ||
|
||
-- src/.pint.hcl -- | ||
parser { | ||
relaxed = [".*"] | ||
} | ||
ci { | ||
baseBranch = "origin/main" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters