Skip to content

lock the file/line selection controls while a commit is running #3814

Closed

Description

@callumlocke

Description

I'm working on a large project that has a slow pre-commit hook (> 10 seconds). Several times, I've used the file checkboxes and individual line selection to do a partial commit, and then without realising the commit is still running, I've started selecting more lines for a second commit. Then I realise the first commit is still running, and it's hard to tell from the UI what is going to get committed.

Version

GitHub Desktop version: 1.0.11

OS version: macOS Sierra (10.12.6)

Steps to Reproduce

  1. In a project with a slow pre-commit hook, do a partial commit (just select certain files and/or lines, and then click Commit)
  2. While that partial commit is running, try to change the selection of lines/files.

Expected behavior:

You shouldn't be able to change the file/line selection while the commit is running.

Actual behavior:

You can mess with the file/line selection before the commit is complete, so the UI is now in a state that does not reflect what is really going to get committed.

Reproduces how often: [What percentage of the time does it reproduce?]

100%.

Additional information

I'm guessing that the selection is fixed from the moment the commit button is clicked, but if this is the case it would be good if the UI could reflect this. To avoid confusion, I suggest disabling all the checkboxes and line selection controls as soon as the commit button is clicked, and re-enabling them once the commit has succeeded or failed.

Activity

  1. deleted a comment from on Jan 18, 2018
  2. shiftkey commented on Jan 23, 2018

    @shiftkey
    Member

    @callumlocke this is an interesting idea, and something that probably needs some design input to ensure the lock/unlock transition isn't overwhelming.

    For reference, we're already tracking the isCommitting state at the repository level (so we can disable the commit form), and flowing that down into the other components so they can enable/disable themselves is probably worth exploring:

    isCommitting={this.props.state.isCommitting}

  3. added
    help wanted
    on Jan 23, 2018
  4. changed the title [-]Suggestion: lock the file/line selection controls while a commit is running[/-] [+]lock the file/line selection controls while a commit is running[/+] on Jan 23, 2018
  5. iAmWillShepherd commented on Jan 24, 2018

    @iAmWillShepherd
    Contributor

    What would happen if the commit fails? Should the file remain locked?

  6. j-f1 commented on Jan 24, 2018

    @j-f1
    Contributor

    I’d say no, because that would prevent you from committing something slightly different to fix the commit.

  7. shiftkey commented on Jan 28, 2018

    @shiftkey
    Member

    @iAmWillShepherd @j-f1 the concept of "locking" is only specific to the UI in Desktop - if the commit fails, everything should be "unlocked" in case the user wants to make changes before trying again

  8. iAmWillShepherd commented on Jan 31, 2018

    @iAmWillShepherd
    Contributor

    Thanks for that clarification, @shiftkey.

  9. iAmWillShepherd commented on Mar 5, 2018

    @iAmWillShepherd
    Contributor

    Fixed in #4042.

  10. shiftkey commented on Mar 5, 2018

    @shiftkey
    Member

    #4042 only addresses the commit form textboxes - this issue is related to the partial committing functionality in the diff view, and remains unresolved.

  11. iAmWillShepherd commented on Mar 5, 2018

    @iAmWillShepherd
    Contributor

    @shiftkey oops, my bad!

  12. masungwon commented on Aug 3, 2018

    @masungwon

    @outofambit Could you assign me and @erin-lee to this task? We're almost done with the PR.

  13. outofambit commented on Aug 3, 2018

    @outofambit
    Contributor

    @masungwon @erin-lee i can't assign you due to some weird settings on our project but I marked it as in progress on our project board! You're good to go!

  14. shiftkey commented on Aug 3, 2018

    @shiftkey
    Member

    #5341 deals with the changed file checkboxes, but the other part of this is the partial line selections in the diff:

    If you wanted to look into that, the relevant property to control the behaviour is readOnly in TextDiff.tsx:

    interface ITextDiffProps {
    readonly repository: Repository
    readonly file: ChangedFile
    readonly readOnly: boolean
    readonly onIncludeChanged?: (diffSelection: DiffSelection) => void
    readonly text: string
    readonly hunks: ReadonlyArray<DiffHunk>
    }

    There might need to be some extra work here to plumb isCommitting around - it's been a while since I've been in there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions