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

Fix checkout methods that use notifyBlock/GTCheckoutStrategySafe #510

Merged
merged 6 commits into from
Aug 27, 2015

Commits on Aug 18, 2015

  1. Fix checkout methods utilizing notifyBlock/GTCheckoutStrategySafe

    Currently, the performCheckout methods move HEAD to the new ref/commit before calling git_checkout_head. This is incorrect behavior.
    
    When git_checkout_head is called, it reports changes between the workdir and HEAD per-file to the notifyBlock, allowing the block to abort the checkout based on a reason (dirty/conflict/etc).
    
    However, since HEAD has already been moved to a different ref/commit, the notifyBlock is notified about changes between the current workdir and the requested ref/commit. This results in a dirty state for any file that differs between the old ref and the new ref, regardless of whether or not any change was made in the workdir.
    
    The correct behavior (e.g. with GTCheckoutStrategySafe) is to notify of changes that will cause data loss in the workdir.
    
    This change leaves HEAD in position until after the checkout, correcting the checkout behavior. When GTCheckoutStrategySafe is used, notifyBlock is only invoked as expected (e.g. dirty files that would be overwritten on checkout). Also, HEAD is only moved if the checkout succeeds, preventing other confusing behavior.
    dleehr committed Aug 18, 2015
    Configuration menu
    Copy the full SHA
    0566639 View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2015

  1. Add tests for checkout+notify

    dleehr committed Aug 19, 2015
    Configuration menu
    Copy the full SHA
    0e2ba10 View commit details
    Browse the repository at this point in the history
  2. Cleanup checkout+notify tests

    dleehr committed Aug 19, 2015
    Configuration menu
    Copy the full SHA
    3c17305 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c1e58a6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8e6c27c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5fa70c9 View commit details
    Browse the repository at this point in the history