
// numbers is an array of numbers
function getNumber(numbers, index) {
if (!numbers[index]) {
throw new Error('no number for this index')
}
return numbers[index]
}
const numbers = [ 42, -121, 4235, 0 ]
const index = process.argv[2]
console.log(`number is ${getNumber(numbers,index)}`)# montre la liste des commits avec leur auteur du plus ancien au plus récent
git shortlogLE MONIES DE SAGAZAN Mayeul (28):
no bug here
no bug here too
no bug here too
no bug here too
no bug here too
no bug here too
no bug here too
no bug here too
no bug here too
no bug here too
bug introduction
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we still don't know that there is a bug
we just discovered that there is a bug
Create README.md# on choisit un commit où il n'y avait pas le bug (ici, c'est le premier commit du dépôt git)
git bisect good 0f436453aac33b7d39f04be33b909097b34def10# on précise que le commit actuel est mauvais
git bisect badBisecting: 13 revisions left to test after this (roughly 4 steps)
[fb045ac20c5972136afd8c10e510c0483f97b1a9] we still don't know that there is a bugnode test.js 3
Error: no number for this indexBisecting: 6 revisions left to test after this (roughly 3 steps)
[991ef4bb20a5d29cc6a307dd3a289a5fc3159c3d] no bug here toonode test.js 3
number is 0
git bisect good
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[bc4dd976f1b8e7e79a7109ac074b610dddcf6dd5] no bug here toonode test.js 3
number is 0
git bisect good
Bisecting: 1 revision left to test after this (roughly 1 step)
[f1a089670548b09e2b52737aa05aa25921ee463f] we still don't know that there is a bugnode test.js 3
Error: no number for this index
git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[9d7a3917e0fdfc71be8426f19ccf26b217d0f546] bug introduction
node test.js 3
Error: no number for this index
git bisect bad
9d7a3917e0fdfc71be8426f19ccf26b217d0f546 is the first bad commit
commit 9d7a3917e0fdfc71be8426f19ccf26b217d0f546
Author: LE MONIES DE SAGAZAN Mayeul
Date: Sun May 15 14:45:17 2022 +0200
bug introduction
test.js | 3 +++
1 file changed, 3 insertions(+)
git diff HEAD^
function getNumber(numbers, index) {
+ if (!numbers[index]) {
+ throw new Error('no number for this index')
+ }
return numbers[index]
}if (!numbers[index]) {if (numbers[index] === undefined) {
[core]
editor = vim
[user]
name = LE MONIES DE SAGAZAN Mayeul
email = mail@example.com
[diff]
tool = vscode
[difftool "vscode"]
cmd = code --wait --diff $LOCAL $REMOTEgit difftool HEAD^
Launch 'vscode' [Y/n]? Y
Do you want support to launch your digital project?
Submit your project now