microsoft / PowerShellForGitHub

Microsoft PowerShell wrapper for GitHub API
Other
582 stars 184 forks source link

When not specified, DisallowMergeCommit and other flags don't work #438

Closed Xander-Rudolph closed 2 months ago

Xander-Rudolph commented 2 months ago

https://github.com/microsoft/PowerShellForGitHub/blob/fd4fa65f23ca30f18f85312a85348e660c287a9c/GitHubRepositories.ps1#L281-L283

The 3 flags here don't work when you don't specify them. So if this flag is used, it cannot be undone by removing the flag which may be the intended behavior, but it seems counter intuitive.

HowardWolosky commented 2 months ago

The module was written with the expectation that the documented defaults in the API would not change. In this instance, the default for these is to allow squash merge, merge commit and rebase merge. Therefore, they were named to allow you to quickly and easily indicate the opposite.

For switches (which you referred to as flags), the PowerShell way of explicitly indicating the opposite is to specify them with $false, e.g.:

-DisallowSquashMerge:$false

Given that there are API defaults for these values, it's by design that we're not adding their values to the submission body when not specified.