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

Automating git bisect - part VI #39

Open
dpshelio opened this issue Nov 17, 2022 · 0 comments
Open

Automating git bisect - part VI #39

dpshelio opened this issue Nov 17, 2022 · 0 comments
Labels
week06 Documenting projects and findging bugs

Comments

@dpshelio
Copy link
Contributor

dpshelio commented Nov 17, 2022

Continuation from #38.

Now that you have a script that tests Charlene's script we can start to find when the error was introduced!

Step 6

Let's run our new script on the current state of Charlene's project and see what happens:

  • Make sure you are in Charlene's last commit (i.e., d8bc3eb), you can check it with git log.

  • Run git bisect start to start the bisect process (it should not produce any output)

  • Run your script: python test_sagittal_brain.py

  • In which state is the code? Did it fail (bad) or everything seemed fine (good)?
    Run the git bissect <state> <id-commit>

    Note

    If you are in this commit, you can use HEAD as the id

Now let's got to a point in history we believe the code was working correctly.

  • Take a look at the history of Charlene's repository: git log --oneline
  • Jump to her second commit: git checkout <id-commit> (When she introduced data for future testing)
  • Run your script: python test_sagittal_brain.py
  • In which state is the code now, bad or good?
    Run the git bissect <state> <id-commit>

By now we should have told bisect that there is a good and a bad commit and we want to find when things started going wrong.
You can see which ones are by running git bisect log.

Hint

The output of the log should be something like:

git bisect start
# bad: [d8bc3ebaecd0cc7a2872da4c81d30b56f9b746ad] Makes the file Pep8 compliant and fixessome typos on docs
git bisect bad d8bc3ebaecd0cc7a2872da4c81d30b56f9b746ad
# good: [9dc8a27ada280e4479241c37bcb4d7f50c34ca09] Adds input and output data for future testing
git bisect good 9dc8a27ada280e4479241c37bcb4d7f50c34ca09

Let's now git bisect to find the commit that introduce the bug!

git bisect run python test_sagittal_brain.py

React to this issue (#39) with a 🚀 when your team has completed the task.


Sample solution

@dpshelio dpshelio added the week06 Documenting projects and findging bugs label Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
week06 Documenting projects and findging bugs
Projects
None yet
Development

No branches or pull requests

1 participant