Skip to content

Tasks week of 10/14 #16

Closed
Closed

Description

@vilmibm

Hi @github/ce-cli, This is a more granular task list than what is listed in Neha's demo planning doc.

If you want to share what you are working on put it on the list and put your name next to it. If you are looking for what to do next, find something that isn't claimed and is on this list!

  • [prototype] gh pr create (fleshing out with args and better edge case handling) @vilmibm
  • [prototype] gh status @vilmibm
  • [prototype] oauth flow @mislav
  • [master] context package feedback @vilmibm
  • [master] Incorporate the stable parts of last weeks demo.
  • [master] Continue with Nate’s context work add context package #17
    • [master] Make it work with our existing gh pr commands
    • [master] Ensure that we can mock the context for testing
  • [master] Present helpful errors to users (instead of the cryptic errors we see now)

Activity

  1. probablycorey commented on Oct 18, 2019

    @probablycorey
    Contributor

    Today I wrestled with gh pr checkout and I've got some questions for @mislav and @vilmibm. There are a few options:

    1. We can use code similar to hub and the prototype https://github.com/github/gh-cli/blob/prototype/command/pr.go#L408-L456.
    2. We can use code similar to what github/desktop uses https://github.com/desktop/desktop/blob/3db6fc736e4e91827eae9db55b88235941cebec0/app/src/lib/stores/app-store.ts#L5141 (I think it fetches the remote if it doesn't exist and then checks it out)
    3. We can use git pull references like in this examples https://github.community/t5/How-to-use-Git-and-GitHub/Checkout-a-branch-from-a-fork/m-p/78/highlight/true#M11

    Choice 1 works, but I am having trouble figuring out what each step does and why. But maybe pairing with @mislav could help me understand
    Choice 2's pattern seems easier to understand, but maybe it's missing some edge cases?
    Choice 3 is the very simple, but I feel like I must be something about Git and GitHub which makes this solution impractical.

    Another choice I have to make is, when you checkout the branch should we use the branch name org-name:branch-name or should we use the pr number pr/4. Desktop use the pr/4 pattern, my initial leaning is towards the org-name:branch-name direction, but using the pr/number pattern gives all PR branches a nice clean namespace.

  2. mislav commented on Oct 18, 2019

    @mislav
    Contributor

    If we didn't want to allow for easy git push back to the PR, the pr checkout command would be trivial to implement. It would literally come down to this:

    git fetch origin refs/pull/NUMBER/head
    git checkout -b newbranch FETCH_HEAD

    This works, but in this new branch:

    1. git pull without arguments won't do the Right Thing™
    2. git push without arguments won't do the Right Thing.

    Solving (1) is not that hard, but for solving (2) with default git behavior (git config push.default == "simple"), you would have to ensure that the checked out branch has the same name as the head branch, and that correct tracking configuration is set up. See mislav/hub#1495 (comment) for background.

    We do currently handle all these cases in the prototype branch. Since the code I've ported from hub was likely confusing, and because I won't have time to pair with you today, I've sprinkled comments to clarify things: 9817924. Hope it helps!

  3. probablycorey commented on Oct 18, 2019

    @probablycorey
    Contributor

    Thanks @mislav!

  4. vilmibm commented on Oct 18, 2019

    @vilmibm
    ContributorAuthor

    I'm calling the pr create improvements for this week "done" without a merge; given all the changes in master i'd rather cleanly port pr create over next week and then do the reset of prototype to master.

    For some reason I thought my PR was essentially un-mergable but it was fine, so i've marked it ready for review

  5. vilmibm commented on Oct 18, 2019

    @vilmibm
    ContributorAuthor

    I decided to punt on gh status after talking to @billygriffin about it.

    I think the original idea behind gh status was something that could wrap git status and also tell you about things in the world of Pull Requests you might care about. I couldn't think of a way to make gh status useful given the functionality that's ended up in gh pr... and also didn't want to do any git wrapping.

    Until we have an idea of how to make gh status useful without wrapping git or being redundant with gh pr... I'd rather see us work on other stuff.

  6. probablycorey commented on Oct 20, 2019

    @probablycorey
    Contributor

    gh pr checkout didn't make it into master this week :( This is where I got https://github.com/github/gh-cli/compare/pr-checkout?expand=1 in case people want to draw inspiration from it next week. My goal was to understand what was happening in this code in more detail mislav/hub#1495 (comment). Like @mislav said above, getting it to work with pull is not bad, but getting push to work as well is tricky and more work because everything I read said you need to make sure the local branch name is exactly the same as the remote branch name.

    One thing that might make things easier is if we add remotes if the PR is a fork. But I couldn't get a good understanding of the downsides to this idea.

  7. added a commit that references this issue on Sep 28, 2021
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions