Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Automating git bisect #135

Open
alessandrofelder opened this issue Nov 19, 2020 · 0 comments
Open

Automating git bisect #135

alessandrofelder opened this issue Nov 19, 2020 · 0 comments
Labels

Comments

@alessandrofelder
Copy link
Collaborator

In your homework, you've seen that even for just 24 commits (and there can be many more), you need to type quite a few, repetitive git bisect commands to find the commit you're looking for.
It's therefore something that is useful to automate. This section in the notes may be useful. Given the same situation as in this week's homework:

  1. Write some code to solve Charlene's problem using git bisect automatically.

    Hint: To do this, you can use subprocess to run a command. For example:

    subprocess.run(["ls", "-lh"])

    will execute the ls command with the -lh arguments.
    If you're on Windows, ideally use Git Bash (If you're on the Windows Command Prompt cmd, you need to pass cmd-compatible commands to subprocess, e.g. dir instead of ls). On Windows, you might also need to pass shell=True as an additional argument.

    subprocess.run(["ls", "-lh"], shell=True)

    Use assert or a similar function (e.g., np.testing.assert_array_equal) to make the program fail, and so distinguish between "good" and "bad" commits.

  2. Do you get the same result (commit hash and date) as you did in your homework?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant