Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rush] "rush change" fails to fetch origin/master in certain situations #1177

Closed
octogonz opened this issue Mar 22, 2019 · 2 comments
Closed
Assignees
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start! repro confirmed The issue comments included repro instructions, and the maintainers reproduced the problem

Comments

@octogonz
Copy link
Collaborator

Repro steps:

  1. Clone web-build-tools, then rollback your origin/master to commit hash e444346.
  2. Now add a remote for raygesualdo:partial-prereleases from PR [rush] added partial prerelease functionality #1175.
  3. Rewind the partial-prereleases branch to commit hash 8cee308
  4. Run rush change

Expected: It should prompt for changes for the @microsoft/rush project only.
Actual: rush change wants change longs for ALL projects in the repo.

What's going on: The rush change command invokes VersionControl.getChangedFolders() which executes this command:

git diff origin/master... --dirstat=files,0

But it finds a huge diff because origin/master is not up to date. Before running this command, rush change was supposed to fetch changes using VersionControl._fetchNonDefaultBranch():

  private static _fetchNonDefaultBranch(remoteBranchName: string): void {
    // NOTE: DEFAULT_FULLY_QUALIFIED_BRANCH is "origin/master"
    if (remoteBranchName !== DEFAULT_FULLY_QUALIFIED_BRANCH) {
      console.log(`Checking for updates to ${remoteBranchName}...`);
      const fetchResult: boolean = VersionControl._tryFetchRemoteBranch(remoteBranchName);
      if (!fetchResult) {
        console.log(colors.yellow(
          `Error fetching git remote branch ${remoteBranchName}. Detected changed files may be incorrect.`
        ));
      }
    }
  }

However, the fetching is skipped because remoteBranchName === "origin/master". If I delete the if-statement, then the changes are fetched, the diff is correct, and rush change prompts for changes ONLY for the @microsoft/rush project.

(Thanks #1175 (comment) for reporting this!)

@octogonz octogonz added bug Something isn't working as intended help wanted If you're looking to contribute, this issue is a good place to start! effort: easy Probably a quick fix. Want to contribute? :-) repro confirmed The issue comments included repro instructions, and the maintainers reproduced the problem labels Mar 22, 2019
@octogonz
Copy link
Collaborator Author

@iclanton FYI since you worked on rush change recently.

@iclanton
Copy link
Member

iclanton commented Jul 3, 2019

This has been fixed. I'll close this issue when it's released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start! repro confirmed The issue comments included repro instructions, and the maintainers reproduced the problem
Projects
Archived in project
Development

No branches or pull requests

3 participants