Skip to content

Commit 464accc

Browse files
committed
Updates git bisect instructions to make them more readable
Also updated the example to used repository at ucl-rits
1 parent c7ec43d commit 464accc

File tree

1 file changed

+54
-47
lines changed

1 file changed

+54
-47
lines changed

ch02git/14Bisect.ipynb

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"source": [
6363
"%%bash\n",
6464
"rm -rf bisectdemo\n",
65-
"git clone [email protected]:shawnsi/bisectdemo.git"
65+
"git clone [email protected]:UCL-RITS/bisectdemo.git"
6666
]
6767
},
6868
{
@@ -137,13 +137,12 @@
137137
"name": "stderr",
138138
"output_type": "stream",
139139
"text": [
140-
"error: branch 'buggy' not found.\n",
141140
"Switched to a new branch 'buggy'\n"
142141
]
143142
}
144143
],
145144
"source": [
146-
"%%bash \n",
145+
"%%bash\n",
147146
"./breakme.sh > break_output"
148147
]
149148
},
@@ -165,15 +164,23 @@
165164
},
166165
"outputs": [
167166
{
168-
"ename": "SyntaxError",
169-
"evalue": "invalid syntax (<ipython-input-6-69f578907137>, line 1)",
170-
"output_type": "error",
171-
"traceback": [
172-
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-6-69f578907137>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m python squares.py 2 # Error message\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
167+
"name": "stderr",
168+
"output_type": "stream",
169+
"text": [
170+
"Traceback (most recent call last):\n",
171+
" File \"squares.py\", line 9, in <module>\n",
172+
" print(integer**2)\n",
173+
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n"
173174
]
175+
},
176+
{
177+
"ename": "CalledProcessError",
178+
"evalue": "Command 'b'python squares.py 2 #\\xc2\\xa0Error message\\n'' returned non-zero exit status 1.",
179+
"output_type": "error"
174180
}
175181
],
176182
"source": [
183+
"%%bash\n",
177184
"python squares.py 2 # Error message"
178185
]
179186
},
@@ -316,8 +323,10 @@
316323
"cell_type": "markdown",
317324
"metadata": {},
318325
"source": [
326+
"Stop the bisect process with:\n",
327+
"\n",
319328
"``` bash\n",
320-
"git bisect end\n",
329+
"git bisect reset\n",
321330
"```"
322331
]
323332
},
@@ -327,7 +336,9 @@
327336
"source": [
328337
"### Solving automatically\n",
329338
"\n",
330-
"If we have an appropriate unit test, we can do all this automatically:"
339+
"If we have an appropriate unit test, we can do all this automatically:\n",
340+
"\n",
341+
"(*NOTE*: You don't need [to redirect the `stderr` and `stdout`](https://linuxize.com/post/bash-redirect-stderr-stdout/) (with `&>`) of `git bisect run` to a file when running these commands outside a jupyter notebook (i.e., on a shell). This is done here so the errors appears with the right commits)"
331342
]
332343
},
333344
{
@@ -351,77 +362,72 @@
351362
"output_type": "stream",
352363
"text": [
353364
"Bisecting: 500 revisions left to test after this (roughly 9 steps)\n",
354-
"[f85561dbe54b69fc7f037e3fd1b742b7395726b5] Comment 500\n",
365+
"[8ab337c43ca34bf91ab17cc55890be57d3567c82] Comment 500\n",
355366
"running python squares.py 2\n",
356367
"4\n",
357368
"Bisecting: 250 revisions left to test after this (roughly 8 steps)\n",
358-
"[1842ee96db81d26ce5c00a4b8750bd19ec380bfc] Comment 749\n",
369+
"[d25fb2ac5a0ed2e9474bec5a32e52eaf6f96ff6c] Comment 749\n",
359370
"running python squares.py 2\n",
371+
"Traceback (most recent call last):\n",
372+
" File \"squares.py\", line 9, in <module>\n",
373+
" print(integer**2)\n",
374+
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
360375
"Bisecting: 124 revisions left to test after this (roughly 7 steps)\n",
361-
"[749d1352b870cc169bc3c6e9e15c69d191a2a66e] Comment 625\n",
376+
"[cc0d01b552be8314dc9734c78b3363b620cb325c] Comment 624\n",
362377
"running python squares.py 2\n",
363-
"4\n",
378+
"Traceback (most recent call last):\n",
379+
" File \"squares.py\", line 9, in <module>\n",
380+
" print(integer**2)\n",
381+
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
364382
"Bisecting: 62 revisions left to test after this (roughly 6 steps)\n",
365-
"[150773712a2e9e8a371f33429abf9826d3a2b65e] Comment 687\n",
383+
"[4b46a6e37c388d260d61409e51864ae77ba19d6d] Comment 562\n",
366384
"running python squares.py 2\n",
367385
"4\n",
368386
"Bisecting: 31 revisions left to test after this (roughly 5 steps)\n",
369-
"[0e12bcd2d685904abf22431381000c68ca0af230] Comment 717\n",
387+
"[5eda263aaa5d0914b5871f546db26b7914895271] Breaking argument type\n",
370388
"running python squares.py 2\n",
389+
"Traceback (most recent call last):\n",
390+
" File \"squares.py\", line 9, in <module>\n",
391+
" print(integer**2)\n",
392+
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
371393
"Bisecting: 15 revisions left to test after this (roughly 4 steps)\n",
372-
"[cd59a9f75102f1b49863ad424fc35dc802522ccd] Comment 702\n",
394+
"[c9097be29af1b3437905feb0969669820ea81283] Comment 577\n",
373395
"running python squares.py 2\n",
374396
"4\n",
375397
"Bisecting: 7 revisions left to test after this (roughly 3 steps)\n",
376-
"[a105ae052d898733015676ac6709b1ffe88ed8bd] Comment 709\n",
398+
"[8021453f7f6fde4319a21337968832be1cc4151a] Comment 585\n",
377399
"running python squares.py 2\n",
400+
"4\n",
378401
"Bisecting: 3 revisions left to test after this (roughly 2 steps)\n",
379-
"[08508dd54091baa9e00c3599cb83cd0cda5b5837] Comment 706\n",
402+
"[f373b49b6545427ce00c991ca112bdc65d712fbf] Comment 589\n",
380403
"running python squares.py 2\n",
381404
"4\n",
382405
"Bisecting: 1 revision left to test after this (roughly 1 step)\n",
383-
"[7ced4763b6ab1600aab31d18fd2592186fd78b89] Comment 707\n",
406+
"[66f6530a9d0a459fc0ba132c17451d281449ffee] Comment 591\n",
384407
"running python squares.py 2\n",
408+
"4\n",
385409
"Bisecting: 0 revisions left to test after this (roughly 0 steps)\n",
386-
"[ebb3f4a5f4000c28bbc12d4d0187bbdad3d92241] Breaking argument type\n",
410+
"[1694ac7328d0a379362dec982d8d3afe14cc98b8] Comment 592\n",
387411
"running python squares.py 2\n",
388-
"ebb3f4a5f4000c28bbc12d4d0187bbdad3d92241 is the first bad commit\n",
389-
"commit ebb3f4a5f4000c28bbc12d4d0187bbdad3d92241\n",
412+
"4\n",
413+
"5eda263aaa5d0914b5871f546db26b7914895271 is the first bad commit\n",
414+
"commit 5eda263aaa5d0914b5871f546db26b7914895271\n",
390415
"Author: Shawn Siefkas <[email protected]>\n",
391416
"Date: Thu Nov 14 09:23:55 2013 -0600\n",
392417
"\n",
393418
" Breaking argument type\n",
394419
"\n",
395-
":100644 100644 430222f37d6aad3ba2b7f235991473e680c7e4d8 03bc808166ca5cd0a8cca51cfb522e0724a31bc6 M\tsquares.py\n",
420+
" squares.py | 2 +-\n",
421+
" 1 file changed, 1 insertion(+), 1 deletion(-)\n",
396422
"bisect run success\n"
397423
]
398424
},
399425
{
400426
"name": "stderr",
401427
"output_type": "stream",
402428
"text": [
403-
"Previous HEAD position was f85561d... Comment 500\n",
404-
"Switched to branch 'buggy'\n",
405-
"Traceback (most recent call last):\n",
406-
" File \"squares.py\", line 9, in <module>\n",
407-
" print(integer**2)\n",
408-
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
409-
"Traceback (most recent call last):\n",
410-
" File \"squares.py\", line 9, in <module>\n",
411-
" print(integer**2)\n",
412-
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
413-
"Traceback (most recent call last):\n",
414-
" File \"squares.py\", line 9, in <module>\n",
415-
" print(integer**2)\n",
416-
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
417-
"Traceback (most recent call last):\n",
418-
" File \"squares.py\", line 9, in <module>\n",
419-
" print(integer**2)\n",
420-
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n",
421-
"Traceback (most recent call last):\n",
422-
" File \"squares.py\", line 9, in <module>\n",
423-
" print(integer**2)\n",
424-
"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'\n"
429+
"Previous HEAD position was 1694ac7 Comment 592\n",
430+
"Switched to branch 'buggy'\n"
425431
]
426432
}
427433
],
@@ -430,7 +436,8 @@
430436
"git bisect start\n",
431437
"git bisect bad HEAD # We know the current state is broken\n",
432438
"git bisect good master # We know master is good\n",
433-
"git bisect run python squares.py 2"
439+
"git bisect run python squares.py 2 &> gitbisect.out\n",
440+
"cat gitbisect.out"
434441
]
435442
},
436443
{

0 commit comments

Comments
 (0)