test(git-state): tests failing when git init.defaultBranch set (#1692)
The tests for git-state assume the default branch is `master`. In git 2.28 support for a global option, `init.defaultBranch`, to change the default branch name which causes git-state tests to fail.
This commit is contained in:
parent
e9d3811ac8
commit
7241f4fbf7
|
@ -321,6 +321,16 @@ mod tests {
|
|||
true,
|
||||
)?;
|
||||
|
||||
// Ensure on the expected branch.
|
||||
// If build environment has `init.defaultBranch` global set
|
||||
// it will default to an unknown branch, so neeed to make & change branch
|
||||
run_git_cmd(
|
||||
&["checkout", "-b", "master"],
|
||||
Some(path),
|
||||
// command expected to fail if already on the expected branch
|
||||
false,
|
||||
)?;
|
||||
|
||||
// Write a file on master and commit it
|
||||
write_file("Version A")?;
|
||||
run_git_cmd(&["add", "the_file"], Some(path), true)?;
|
||||
|
|
Loading…
Reference in New Issue