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

Handle "git worktree" in "make patchcheck" #73984

Closed
ncoghlan opened this issue Mar 12, 2017 · 12 comments
Closed

Handle "git worktree" in "make patchcheck" #73984

ncoghlan opened this issue Mar 12, 2017 · 12 comments
Assignees
Labels
3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error

Comments

@ncoghlan
Copy link
Contributor

BPO 29798
Nosy @ncoghlan, @vstinner
PRs
  • bpo-29798: Handle git worktree in make patchcheck #629
  • [3.6] bpo-29798: Handle git worktree in make patchcheck #633
  • [3.5] bpo-29798: Handle git worktree in make patchcheck #634
  • [2.7] bpo-29798: Handle git worktree in make patchcheck (#629) #635
  • [2.7] bpo-29798: Handle git worktree in patchcheck #1057
  • [3.6] bpo-29798: Handle git worktree in patchcheck #1060
  • [3.5] bpo-29798: Handle git worktree in patchcheck #1059
  • bpo-29798: Handle git worktree in patchcheck #1058
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ncoghlan'
    closed_at = <Date 2017-04-09.09:24:05.436>
    created_at = <Date 2017-03-12.06:13:31.729>
    labels = ['type-bug', '3.7']
    title = 'Handle "git worktree" in "make patchcheck"'
    updated_at = <Date 2017-04-09.09:24:05.435>
    user = 'https://github.com/ncoghlan'

    bugs.python.org fields:

    activity = <Date 2017-04-09.09:24:05.435>
    actor = 'ncoghlan'
    assignee = 'ncoghlan'
    closed = True
    closed_date = <Date 2017-04-09.09:24:05.436>
    closer = 'ncoghlan'
    components = ['Demos and Tools']
    creation = <Date 2017-03-12.06:13:31.729>
    creator = 'ncoghlan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 29798
    keywords = []
    message_count = 12.0
    messages = ['289481', '289529', '290209', '290210', '290211', '290214', '290604', '290697', '291358', '291362', '291363', '291364']
    nosy_count = 2.0
    nosy_names = ['ncoghlan', 'vstinner']
    pr_nums = ['629', '633', '634', '635', '1057', '1060', '1059', '1058']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29798'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @ncoghlan
    Copy link
    Contributor Author

    While backporting bpo-29656 to get "make patchcheck" to play nice with git PR branches, I discovered an incompatibility between the way "git worktree" works and the assumptions in "patchcheck.py".

    Specifically, in a worktree, ".git" is a file, rather than a directory:

        $ cat .git
        gitdir: /home/ncoghlan/devel/cpython/.git/worktrees/py27

    So the current isdir() check should be relaxed to just an exists() check.

    @ncoghlan ncoghlan added the 3.7 (EOL) end of life label Mar 12, 2017
    @ncoghlan ncoghlan self-assigned this Mar 12, 2017
    @ncoghlan ncoghlan added the type-bug An unexpected behavior, bug, or error label Mar 12, 2017
    @ncoghlan
    Copy link
    Contributor Author

    Turns out I missed another isdir() check in get_base_branch(), so this still isn't working properly in git worktree directories.

    @ncoghlan ncoghlan reopened this Mar 13, 2017
    @ncoghlan
    Copy link
    Contributor Author

    New changeset 61a82a5 by Nick Coghlan in branch '3.6':
    bpo-29798: Handle git worktree in make patchcheck (#629) (#633)
    61a82a5

    @ncoghlan
    Copy link
    Contributor Author

    New changeset a6aac8c by Nick Coghlan in branch '3.5':
    bpo-29798: Handle git worktree in make patchcheck (#629) (#634)
    a6aac8c

    @ncoghlan
    Copy link
    Contributor Author

    New changeset ee10fb9 by Nick Coghlan in branch '2.7':
    bpo-29798: Handle git worktree in make patchcheck (#629) (#635)
    ee10fb9

    @ncoghlan
    Copy link
    Contributor Author

    New changeset 6a6d090 by Nick Coghlan in branch 'master':
    bpo-29798: Handle git worktree in make patchcheck (#629)
    6a6d090

    @vstinner
    Copy link
    Member

    Tools/scripts/patchcheck.py still checks isdir() in get_base_branch():

    @status("Getting base branch for PR",
    info=lambda x: x if x is not None else "not a PR branch")
    def get_base_branch():
    if not os.path.isdir(os.path.join(SRCDIR, '.git')):
    # Not a git checkout, so there's no base branch
    return None
    ...

    Was it deliberate to not change this line?

    @ncoghlan
    Copy link
    Contributor Author

    No, that's the bug that prompted me to reopen the issue. I just got distracted and never submitted the follow-up PR :(

    @ncoghlan
    Copy link
    Contributor Author

    ncoghlan commented Apr 9, 2017

    Oops, the new PRs and merges haven't shown up automatically because I didn't fix the spelling of the issue number.

    3.7 (master): #1058
    3.6: #1060
    3.5: #1059
    2.7: #1057

    I'll see what happens if I edit the PR titles after the fact.

    @ncoghlan
    Copy link
    Contributor Author

    ncoghlan commented Apr 9, 2017

    New changeset 4c116cb by Nick Coghlan in branch '3.6':
    bpo-29798: Handle git worktree in patchcheck (bpo-1058) (bpo-1060)
    4c116cb

    @ncoghlan
    Copy link
    Contributor Author

    ncoghlan commented Apr 9, 2017

    New changeset c82d394 by Nick Coghlan in branch '3.5':
    bpo-29798: Handle git worktree in patchcheck
    c82d394

    @ncoghlan
    Copy link
    Contributor Author

    ncoghlan commented Apr 9, 2017

    OK, this should really be working now (and I checked it on my 2.7 checkout before submitting that PR).

    Any further problems found should go in a new issue.

    @ncoghlan ncoghlan closed this as completed Apr 9, 2017
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants