BM: Baca dalam Bahasa Melayu
World 10: Deep Git · Boss challenge
Detective: find the bug commit
You will learn: to track down the commit that broke a page, with bisect, a test and blame.
The problem
Emergency at Kedai Kancil! The Buy button is greyed out. Nobody can order kuih. Fourteen suspects. Find the guilty commit, detective!
Try it
Your clue is test.sh. It runs ! grep -q "disabled" order.html. When does the test pass?
Pick one answer.
Try it
Round 1: question the suspects. Run the test, then mark each commit good or bad.
The oldest commit works. The newest one is broken. Find the first bad commit.
The test: the Buy button in order.html must not be disabled.
cc77188Add order pagegood9d62d7dAdd a quantity boxmaybeeca4c56Add a note boxmaybe140a233Add payment notemaybef0d9953Reword the titlemaybeaabe367Add halal notemaybe6187411Add pickup timemaybe387e919Fix button colourmaybe7bb484dClean up the formmaybe7108bd9Add phone numbermaybe810fed2Link the menumaybeea24e01Add a footermaybe51b7e6eAdd closing daymaybe0feda89Update footer yearbad
Tests used: 0. For 13 commits, bisect needs at most 4.
Hint
Watch out: a guilty-sounding name can be innocent. Trust the test.Predict
“Fix button colour” sounds guilty. Was it?
Pick one answer.
Try it
Round 2: the real terminal. Start bisect, let test.sh judge every step, then go back to main.
Hint
git bisect start HEAD HEAD~13, then git bisect run sh test.sh, then git bisect reset.Check
Double-check the evidence. git blame -L 6,6 names the last change to the button line. Same suspect!
Check
The culprit is already shared with the team. What is your next move?
Pick one answer.
You did it!
You can now find the commit that broke something, like a detective.
Bahasa Melayu
Kecemasan di Kedai Kancil! Butang Buy jadi kelabu. Tiada siapa boleh pesan kuih. Empat belas suspek. Cari commit (titik simpan) yang bersalah, detektif!
Petunjuk anda ialah test.sh. Ia jalankan ! grep -q "disabled" order.html. Bila ujian itu lulus?
Pusingan 1: soal siasat suspek. Jalankan ujian, kemudian tandakan setiap commit good atau bad.
“Fix button colour” bunyi macam bersalah. Betul ke?
Pusingan 2: terminal sebenar. Mulakan bisect, biar test.sh menilai setiap langkah, kemudian balik ke main.
git bisect start HEAD HEAD~13, kemudian git bisect run sh test.sh, kemudian git bisect reset.Semak semula bukti. git blame -L 6,6 namakan perubahan terakhir pada baris butang. Suspek yang sama!
Pesalah itu dah dikongsi dengan pasukan. Apa langkah anda seterusnya?
Kini anda boleh jejak commit yang merosakkan sesuatu, macam detektif sebenar.
You finished this before. Practice is always welcome!
Official docs: git bisect · git blame · git log
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?