The build.sh attempts to detect whether the build is occurring from a Git repo or not. But it doesn't account for Git worktrees which do not have a .git directory. Instead, they have a .git file. So if you create a worktree of the dotnet/dotnet repo and run ./build.sh --sb, you'll get this error:
ERROR: /<repo-dir> is not a git repository, either --release-manifest or --source-repository and --source-version must be specified
Worktree usage is likely going to be more prevalent as part of the support for non-1xx feature bands. It will be more efficient to have multiple worktrees when working across the branches.