ಛผ‫ڀݚ‬ใࠂ୊໨൛؅ཧγεςϜʹ͓͚Δཤྺ৘ใऔಘ‫ػ‬ೳͷ֦ுࢦಋ‫ڭ‬һ
ೇຊɹਅೋɹ‫ڭ‬तใࠂऀࠤʑ໦ɹඒ࿨

ฏ੒ 29 ೥ 2 ݄ 14 ೔େࡕେֶ ‫ֶ޻ૅج‬෦ ৘ใՊֶՊ

ฏ੒ 28 ೥౓ ಛผ‫ڀݚ‬ใࠂ

൛؅ཧγεςϜʹ͓͚Δཤྺ৘ใऔಘ‫ػ‬ೳͷ֦ுࠤʑ໦ɹඒ࿨

಺༰ߎ֓
SVN ΍ Git Λ͸͡Ίͱ͢Δଟ͘ͷ൛؅ཧγεςϜ͕‫ࡏݱ‬ଟ͘ͷιϑτ΢ΣΞ։ൃϓϩδΣΫτʹ
ಋೖ͞Ε͍ͯΔɽ͔͠͠ɼैདྷͷ൛؅ཧγεςϜͰ͸ɼιʔείʔυ͸ͨͩͷςΩετ৘ใͱͯ͠ѻΘΕ͍ͯΔɽͦͷͨΊɼཤྺ৘ใ͔Βίϝϯτͷมߋ͚ͩΛநग़͢ΔɼJavadoc ͕มߋ͞Ε͍ͯΔίϛοτϩά͚ͩΛදࣔ͢Δɼͱ͍ͬͨૢ࡞͸αϙʔτ͞Ε͍ͯͳ͍ɽͦ͜Ͱຊ‫Ͱڀݚ‬͸ɼ൛؅ཧγεςϜ্Ͱͷιʔείʔυ಺ͷίϯςΩετʢߏจ৘ใʣΛར༻ͨ͠৘ใͷߜΓࠐΈૢ࡞ͷ࣮‫ݱ‬Λ໨తͱͯ͠ɼ൛؅ཧΫϥΠΞϯτͷ֦ுΛߦ͏ɽ͜ΕʹΑͬͯ࢖༻ऀ͸ɼඞཁͷͳ͍෦෼͕࡟ΒΕͨΑΓখ͘͞ཁ‫ʹٻ‬దͬͨ৘ใ͚ͩΛऔಘ͢Δ͜ͱ͕ՄೳʹͳΔɽఏҊख๏ͷ༗༻ੑΛධՁ͢ΔͨΊʹɼϓϩτλΠϓΛ࣮૷͠ɼධՁ࣮‫ݧ‬Λߦͬͨɽͦͷ݁Ռɼैདྷͷ൛؅ཧγεςϜͷ࣮ߦ଎౓ͱൺֱͨ͠
ఏҊख๏ͷ࣮ߦ଎౓ͷ௿Լ͸ฏ‫ ۉ‬2.5 ഒఔ౓Ͱ͋Δ͜ͱ͕֬ೝͰ͖ͨɽैདྷͷ൛؅ཧγεςϜͷ࣮ߦ࣌ؒͷฏ‫ۉ‬͸ 0.8 ඵఔ౓Ͱ͋ͬͨͷͰɼఏҊख๏ͷ࣮ߦ࣌ؒͷฏ‫ۉ‬͸͓ͦΑ 2 ඵͰ͋ͬͨɽ·ͨɼ࣮ߦ࣌ؒͷ࠷େ஋ΛͱͬͯΈͯ΋ɼ18 ඵͰ͋ͬͨͷͰɼ͜Ε͸‫ʹ࣮ݱ‬ఏҊख๏Λ࢖༻͍ͯ͘͠ࡍʹ࣮༻ൣғ಺Ͱ͋Δͱ‫ͨ͑ݴ‬ɽग़ྗߦ਺ʹ͍ͭͯͷ݁ՌΛ‫ݟ‬Δͱɼैདྷͷग़ྗͷ 0.8 ഒ͔Β 0.3 ഒఔ౓·Ͱग़ྗߦ਺Λ‫ݮ‬গͰ͖͍ͯΔ͜ͱ͕֬ೝͰ͖ͨɽ͜ΕʹΑΓɼఏҊख๏͕͔֬ʹ৘ใΛ࡟‫͍͖ͯͰݮ‬Δ͜ͱ͕‫ͨ͑ݴ‬ɽओͳ༻‫ޠ‬
൛؅ཧγεςϜ
ཤྺ৘ใͷߜΓࠐΈίϯςΩετ

Git
ந৅ߏจ໦

໨࣍
1

·͕͖͑

1

2

‫ڀݚ‬ಈ‫ػ‬

3

3

ఏҊख๏

6

3.1

ίϯςΩετ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3.1.1

ߏจίϯςΩετ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3.1.2

ཤྺίϯςΩετ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7

3.2

ैདྷͷ൛؅ཧγεςϜͱͷҧ͍ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.3

֦ுର৅ίϚϯυ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.4

ఏҊख๏ͷಈ࡞ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

4

5

6

ϓϩτλΠϓ MJgit ͷ࣮૷

12

4.1

MJgit ͷ֓ཁ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

4.2

ॲཧͷྲྀΕ

13

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

ධՁ࣮‫ݧ‬

155.1

࣮‫֓ݧ‬ཁ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

5.2

࣮‫ݧ‬ͷྲྀΕ. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

5.3

݁Ռͷ‫ܭ‬ଌํ๏ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

5.4

࣮‫ݧ‬ର৅ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

5.5

࣮‫݁ݧ‬Ռ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17
21

ߟ࡯

6.1

৘ใͷߜΓࠐΈͷఔ౓ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

6.2

ఏҊख๏ʹΑΔ࣮ߦ଎౓ͷ௿Լ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

6.3

ίϯςΩετࢦఆ͕‫͔͞׆‬ΕΔࣄྫ . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

7

ଥ౰ੑ΁ͷ‫ڴ‬Җ

22

8

͋ͱ͕͖

23

ँࣙ

24

ࢀߟจ‫ݙ‬

25

i

ਤ໨࣍
1

ఏҊख๏ͱैདྷͷ൛؅ཧγεςϜͱͷҧ͍ . . . . . . . . . . . . . . . . . . . . . . .

92ఏҊख๏ͷಈ࡞Ҋ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

113

ఏҊख๏ͷॲཧͷྲྀΕ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

134

࣮‫಺ݧ‬༰ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

5

JUnit4 ʹର͢Δ show ͷ࣮ߦ࣌ؒ . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

6JUnit4 ʹର͢Δ diff ͷ࣮ߦ࣌ؒ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

7

JUnit4 ʹର͢Δ show ͷग़ྗߦ਺ . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

8JUnit4 ʹର͢Δ diff ͷग़ྗߦ਺ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

9

Log4j ʹର͢Δ show ͷ࣮ߦ࣌ؒ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

10

Log4j ʹର͢Δ diff ͷ࣮ߦ࣌ؒ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

11

Log4j ʹର͢Δ show ͷग़ྗߦ਺ . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

12

Log4j ʹର͢Δ diff ͷग़ྗߦ਺ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

ද໨࣍
1

ఏҊख๏ͷಈ࡞ҊͷϝϦοτɾσϝϦοτ . . . . . . . . . . . . . . . . . . . . . . .

102

MJgit ͷ࢓༷ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

123

࣮‫ݧ‬ର৅ϓϩδΣΫτͷ֓ཁ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

ii

1

·͕͖͑
SVN ΍ Git Λ͸͡Ίͱ͢Δ൛؅ཧγεςϜ͸ɼଟ͘ͷιϑτ΢ΣΞ։ൃϓϩδΣΫτʹಋೖ͞Ε

Δ͍ͯΔ [1][2][3]ɽಛʹۙ೥ͷιϑτ΢ΣΞ։ൃ͸େ‫ن‬໛Խͱԕִ෼ࢄԽ͕ਐΜͰ͓Γɼ൛؅ཧγεςϜʹΑΔ੒Ռ෺ɼ‫ͼٴ‬ཤྺ৘ใͷ؅ཧ͸ඞཁෆՄܽͱͳ͍ͬͯΔɽ
͔͠͠ͳ͕Βɼ΄ͱΜͲͷ൛؅ཧγεςϜͰ͸ɼ؅ཧର৅ͱͳΔιʔείʔυ͸୯ͳΔςΩετϑΝΠϧͱͯ͠ѻΘΕ͓ͯΓ [4]ɼιʔείʔυͷߏจ৘ใΛར༻ͨ͠৘ใͷऔಘૢ࡞͸ࢧԉ͞Ε͍ͯͳ͍ɽྫ͑͹ɼࣗ਎ͷฤूͨ͠ιʔείʔυͷத͔Βɼίϝϯτ෦෼ͷΈͷࠩ෼Λ֬ೝ͢Δͱ͍ͬͨॲཧ΍ɼ‫ʹٯ‬ίϝϯτΛল͍ͨϓϩάϥϜͷ࣮ߦεςʔτϝϯτ෦෼ͷΈΛ֬ೝ͢Δ͜ͱ͸ෆՄೳ
Ͱ͋ΔɽLinux ίϚϯυʹ͓͚Δ Diff ΍ Grep ౳ͷίϚϯυ΍Φϓγϣϯ͸αϙʔτ͞Ε͍ͯΔ΋ͷͷɼ‫ج‬ຊతʹ͸ςΩετσʔλʹର͢Δߦ୯ҐͰͷૢ࡞ͷΈͱ͍͏ͷ͕‫ݱ‬ঢ়Ͱ͋ΔɽͦͷͨΊɼ͔ͦ͜Βιʔείʔυͷຊ࣭తͳҙຯͷมԽΛಡΈղ͘ʹ͸ɼେ͖ͳ࿑ྗ͕͔͔ͬͯ͠·͏ [5]ɽͦͷ࿑ྗΛආ͚ɼιʔείʔυͷมߋʹΑΔత֬ͳҙຯΛಘΔͨΊʹ͸ɼίϝϯτ΍εςʔτϝϯτʹର͢
ΔมߋͳͲΛߟྀͨࠩ͠෼Λग़ྗ͢Δඞཁ͕͋Δ [6] [7] [8]ɽଟ͘ͷϓϩάϥϛϯά‫Ͱޠݴ‬͸ɼιʔείʔυதʹ༷ʑͳ৘ใʢ࣮ߦεςʔτϝϯτ΍ίϝϯτɼஶ࡞‫ݖ‬৘ใɼ஫ऍͳͲʣΛࠞࡏͯ͠‫ه‬ड़͢Δͱ͍͏จԽ͕ਁಁ͍ͯ͠Δɽ͜ͷจԽ͸ɼ͋Δ୯ҰͷιʔείʔυͷΈʹ஫ྗ͢Δࡍʹ͸໰୊ʹ͸ͳΒͳ͍͕ɼόάՕॴͷཤྺ௥੻ͱ͍ͬͨཤྺ৘ใʹԣஅతɼ͔ͭಛఆͷ৘ใͷΈʹʢ࣮ߦεςʔτϝϯτͷΈͳͲʣԣஅతͳૢ࡞Λߦ͍͍ͨࡍʹ͸ɼͦͷଞͷ৘ใʢίϝϯτ΍ஶ࡞‫ݖ‬৘ใͳͲʣ͕ϊΠζͱͳΓಘΔɽ͜ͷίʔυதͷ༷ʑͳ৘ใΛҰछͷจ຺ʢҎ߱ɼίϯςΩετʣͱ‫͠ͳݟ‬ɼίϯςΩετʹԠͨ͡ཤྺ৘ใͷߜΓࠐΈૢ࡞͕ՄೳͱͳΕ͹ɼ։ൃऀʹର͢Δखॿ͚ͱͳΔͱߟ͑ΒΕΔɽ͞Βʹɼ͜ͷιʔείʔυதͷίϯςΩετΛߟྀͨ͠ཤྺૢ࡞͸ɼ։ൃऀͷϓϩάϥϛϯά࣌ͷΈͳΒͣɼ։ൃཤྺΛର৅ͱͨ͠ϚΠχϯά‫[ ڀݚ‬9] ʹ΋޿͘‫͖Ͱ༻׆‬ΔՄೳੑ͕͋Δɽ͜ͷ‫ڀݚ‬෼໺͸ MSRʢMining Software Repositoryʣͱ΋‫ݺ‬͹Ε͓ͯΓɼมߋཤྺΛ༻͍ͨόάͷ༧ଌ [10] ΍ɼόάͱίϝϯτߦ਺ͷؔ܎ͷௐࠪ [11]ɼίϛοτϩά͔Βͷ։ൃऀͷ‫ײ‬৘ͷ෼ੳ [12] ͳͲଟ‫ͬ౉ʹذ‬࣮ͯࢪ͞Ε͍ͯΔɽ͜ΕΒͷ‫Ͱڀݚ‬͸ͦͷ໨తʹԠͯ͡ɼ࣮ߦεςʔτϯτ͕มߋ͞Ε͍ͯͳ͍ίϛοτΛআ֎͢ΔɼίϝϯτΛ‫ؚ‬ΉίϛοτͷΈΛߜΓࠐΉɼͱ͍ͬͨϚΠχϯάͷલॲཧ͕ߦΘΕ
Δ͜ͱ͕ଟ͍ɽ൛؅ཧγεςϜͦͷ΋ͷ͕ίϯςΩετΛߟྀͨ͠ૢ࡞Λ࣮‫͢ݱ‬Δ͜ͱͰɼ͜ΕΒલॲཧʹඞཁͳ࿑ྗΛ࡟‫͖Ͱݮ‬Δͱߟ͑ΒΕΔɽ
ຊ‫Ͱڀݚ‬͸ɼ൛؅ཧγεςϜ্ͰͷίϯςΩετΛར༻ͨ͠৘ใͷߜΓࠐΈૢ࡞ͷ࣮‫ݱ‬Λ໨తͱͯ͠ɼ൛؅ཧΫϥΠΞϯτͷ֦ுΛߦ͏ɽ͜͜ͰͷίϯςΩετ͸େผͯ͠ɼ্‫ͨ͛ڍʹه‬Α͏ͳιʔείʔυͷߏจ৘ใʹ‫ͮ͘ج‬΋ͷͱɼ൛؅ཧγεςϜ্ͷཤྺ৘ใʹ‫ͮ͘ج‬΋ͷɼͷ 2 छྨʹ෼ྨ͢
Δ͜ͱ͕Ͱ͖ΔɽຊߘͰ͸લऀͷߏจ৘ใʹؔ͢ΔίϯςΩετʹண໨͠ɼͦͷ࣮‫ํݱ‬๏ʹ͍ͭͯ‫ݕ‬
౼͢Δɽ͞ΒʹϓϩτλΠϓͱͳΔ֦ு Git ΫϥΠΞϯτ MJgit Λ։ൃ͢ΔɽఏҊख๏ͷධՁ࣮‫ͯ͠ͱݧ‬ɼ࣮ࡍͷιϑτ΢ΣΞ։ൃϦϙδτϦΛର৅ʹɼMJgit ར༻࣌ͷ࣮ߦ଎1౓ɼ‫ͼٴ‬ཤྺ৘ใͷ࡟‫͔͍֬ͯͭʹྔݮ‬ΊΔɽ࣮‫ݧ‬୊ࡐͱͯ͠͸ɼΦʔϓϯιʔειϑτ΢ΣΞͷ

JUnit4 ‫ ͼٴ‬Log4j Λ࠾༻͢Δ [13][14]ɽ࣮‫݁ݧ‬ՌʹΑΓ, ͔֬ʹ৘ใྔΛ࡟‫͖Ͱݮ‬Δ͜ͱͱɼ࣮ߦ଎
౓ͷ௿Լ͕࣮༻ൣғ಺Ͱ͋Δ͜ͱ͕֬ೝͰ͖ͨɽ·ͨɼεςʔτϝϯτҎ֎ͷίϯςΩετͷग़ྗߦ਺͕େ͖͘‫ݮ‬গͨ͜͠ͱ͔ΒɼఏҊख๏͸εςʔτϝϯτҎ֎ͷίϯςΩετͷߜΓࠐΈΛߦ͏ࡍʹಛʹ໾ʹཱͭͰ͋Ζ͏͜ͱ͕‫ͨ͑ݴ‬ɽҎ߱ɼ2 ষͰ͸‫ڀݚ‬ಈ‫ͯ͠ͱػ‬ɼैདྷͷ൛؅ཧγεςϜͷ໰୊఺ʹ͍ͭͯड़΂Δɽ3 ষͰ͸ఏҊख๏ʹ͍ͭͯઆ໌͠ɼ4 ষͰ͸ϓϩτλΠϓͷ࣮૷ʹ͍ͭͯड़΂Δɽ5 ষͰ͸ධՁ࣮‫ݧ‬ͷ಺༰ͱ࣮‫݁ݧ‬Ռʹ͍ͭͯड़΂Δɽ6 ষͰ͸ධՁ࣮‫ݧ‬ͷ݁Ռʹ͍ͭͯߟ࡯Λߦ͍ɼ7 ষͰ͸ଥ౰ੑ΁ͷ‫ڴ‬Җʹ͍ͭͯड़΂Δɽ࠷‫ ʹޙ‬8 ষͰຊ‫ڀݚ‬ͷ·ͱΊͱࠓ‫ޙ‬ͷ՝୊ʹ͍ͭͯड़΂Δɽ2

2‫ڀݚ‬ಈ‫ػ‬ຊষͰ͸ɼ͋Διʔείʔυʹର͢Δόάͷमਖ਼ͱ͍͏γφϦΦʹ‫͍ͯͮج‬ɼ‫ط‬ଘͷ൛؅ཧγεςϜʹ͓͚Δ໰୊఺ɼ‫ڀݚͼٴ‬ͷಈ‫͍ͯͭʹػ‬આ໌͢Δɽຊ‫ڀݚ‬ͷΞΠσΞ͸ɼಛఆͷϓϩάϥϛϯ
ά‫ޠݴ‬΍ಛఆͷ൛؅ཧγεςϜʹґଘ͠ͳ͍Ұൠతͳ΋ͷͰ͋Δɽ͜͜Ͱ͸۩ମతͳྫࣔͷͨΊʹɼϓϩάϥϛϯά‫ޠݴ‬Λ Javaɼ൛؅ཧγεςϜΛ Git ͱͯ͠આ໌Λߦ͏ɽ·ͣɼҎԼͷΑ͏ͳιʔείʔυ Example.java ͕༩͑ΒΕͨͱ͢Δɽ

Listing 1: Example.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

/ ∗ L i c e n s e d u n d e r t h e MIT L i c e n s e ∗ /p u b l i c c l a s s Example {p u b l i c v o i d Foo ( ) {...
int case = getCase ( ) ;switch ( case ) {case 1:t h i s . doSomething1 ( ) ;break ;
case 2:t h i s . doSomething2 ( ) ;break ;...
/ / Handle an e r r o r c a s e
c a s e −1:
this . handleError ( ) ;default :this . doDefault ( ) ;
}
}
...
}

Example.java ʹ͸ switch จͷதͰ break ໋ྩΛ๨ΕΔͱ͍͏య‫ܕ‬తͳόά͕‫·ؚ‬Ε͍ͯΔɽ۩ମతʹ͸ɼม਺ case ͕஋-1 ΛऔΔࡍʹ default ·Ͱॲཧ͞Εͯ͠·͏ɽ͜ΕΛमਖ਼͢Δʹ͸ 16 ߦ໨ͱ 17ߦ໨ͷؒʹ break ໋ྩΛՃ͑Δඞཁ͕͋Δɽ
͜ͷόάΛमਖ਼͢Δ͜ͱΛߟ͑Δɽ·ͣόάमਖ਼ऀ͸όάͷՕॴʢ16 ߦ໨ʣΛಛఆ͠ɼbreak ໋ྩΛՃ͑ͯ౰֘όάΛमਖ਼͢ΔɽՃ͑ɼ͜ͷόάՕॴͷॲཧ͸ͦͷؔ਺໊ʢhandleError()ʣ͔ΒΤϥʔͷରॲͷͨΊͷ௥ՃॲཧͰ͋Δ͜ͱ͕ಡΈऔΕΔɽΑͬͯɼ͜ͷ switch ॲཧશମΛ‫ه‬ड़ͨ͠։ൃऀ
ͱɼόάՕॴͷॲཧΛ௥Ճͨ͠։ൃऀ͕ҟͳΔՄೳੑ͕͋Δɽόάʹؔ͢ΔҰൠతͳࣄ࣮ͱͯ͠ɼόάͷՕॴ͸ύϨʔτͷ๏ଇʹै͓ͬͯΓ 2 ׂͷιʔείʔυʹ 8 ׂͷόά͕‫·ؚ‬ΕΔ [15, 16]ɼฤू
ʹؔΘΔ։ൃऀͷ਺͕૿͑Δ΄Ͳόά͕ൃੜ͠΍͍͢ [17, 18]ɼͳͲ͕஌ΒΕ͍ͯΔɽΑͬͯόάमਖ਼࡞‫͘ͳͰ͚ͩۀ‬ɼ౰֘όά෇ۙͷมߋΛ௥੻ͯͦ͠ͷ಺༰ΛϨϏϡʔ͢Δ΂͖Ͱ͋Δͱ͍͑Δɽ

3

Git Ͱ͸ιʔείʔυશͯͷߦͷฤूऀΛௐ΂Δ blame ίϚϯυ͕༻ҙ͞Ε͓ͯΓɼҎԼͷΑ͏ͳ݁ՌΛಘΔ͜ͱ͕Ͱ͖Δɽ
$ g i t blame Example . j a v a
f 0 9 8 4 1 2 1 ( s h i n s u k e 2017−02−01
a c 5 f 6 d a c (m−s a s a k i 2017−02−01
a c 5 f 6 d a c (m−s a s a k i 2017−02−01...
a c 5 f 6 d a c (m−s a s a k i 2017−02−01
a c 5 f 6 d a c (m−s a s a k i 2017−02−01
a c 5 f 6 d a c (m−s a s a k i 2017−02−01
a c 5 f 6 d a c (m−s a s a k i 2017−02−01...
b8beb025 ( n−o g u r a 2017−02−04
b8beb025 ( n−o g u r a 2017−02−04
b8beb025 ( n−o g u r a 2017−02−04
a c 5 f 6 d a c (m−s a s a k i 2017−02−01
a c 5 f 6 d a c (m−s a s a k i 2017−02−01...

20:25:36
20:25:36
20:25:36

1) /∗ Licensed under the . . . ∗/2 ) p u b l i c c l a s s Example {3)
p u b l i c v o i d Foo ( ) {20:25:36
20:25:36
20:25:36
20:25:36

6)
7)
8)
9)

12:00:30
12:00:30
12:00:30
20:25:36
20:25:36

14)
15)
16)
17)
18)

switch ( case ) {case 1:t h i s . doSomething1 ( ) ;break ;
/ / H a n d l e an e r r o r c a s e
c a s e −1:
this . handleError ( ) ;default :t h i s . doDefault ( ) ;͜ͷ݁ՌΑΓɼόάՕॴΛฤूͨ͠։ൃऀʢn-oguraʣ͕ಛఆͰ͖Δɽ͜ͷྫͰ͸ιʔείʔυશମΛ୯७Խ͓ͯ͠Γɼશͯͷग़ྗ݁ՌΛ֬ೝ͢Δ͜ͱ͸༰қͰ͋Δɽ͔͠͠ͳ͕Βɼ࣮ࡍͷιʔείʔυʹ͸ίϝϯτ΍ஶ࡞‫ݖ‬৘ใͳͲ༷ʑͳ৘ใ͕‫·ؚ‬Ε͓ͯΓɼ͜ΕΒͷ৘ใ͕ϊΠζͱͳΓಘΔɽ͜
͜Ͱ͜ͷ blame ίϚϯυʹରͯ͠ɼʮ࣮ߦεςʔτϝϯτʹߜΓࠐΉʯ΍ɼΑΓ۩ମతͳʮswitch จʹߜΓࠐΉʯͱ͍͏ίϯςΩετΛࢦఆͨ͠ૢ࡞͕ՄೳͰ͋Ε͹ɼ໨తͱ͢Δ৘ใ΁ͷΞΫηε͕༰қʹͳΔɽswitch จͱ͍͏ίϯςΩετͰߜΓࠐΉࡍͷৼΔ෣͍ͷҰҊΛҎԼʹࣔ͢ɽ$ g i t blame Example . j a v a −−c o n t e x t = s w i t c h −s t a t e m e n t
a c 5 f 6 d a c (m−s a s a k i 2017−02−01 2 0 : 2 5 : 3 6 6 )switch ( case ) {a c 5 f 6 d a c (m−s a s a k i 2017−02−01 2 0 : 2 5 : 3 6 7 )case 1:a c 5 f 6 d a c (m−s a s a k i 2017−02−01 2 0 : 2 5 : 3 6 8 )t h i s . doSomething1 ( ) ;a c 5 f 6 d a c (m−s a s a k i 2017−02−01 2 0 : 2 5 : 3 6 9 )break ;...

͞ΒʹɼόάΛຒΊࠐΜͩίϛοτ ID:b8beb025 ͷ࡞‫ۀ‬ͷৄࡉΛ֬ೝ͢Δࡍ͸ɼҎԼͷΑ͏ͳ showίϚϯυʹΑΓมߋ಺༰ΛऔಘͰ͖Δɽ
$ g i t show Example2 . j a v a b8beb025
commit b 8 b e b 0 2 5 7 9 8 d b 8 4 c 9 f c c f e 4 4 d 3 9 4 d b f 1 e c 4 0 4 9 7 4
A u t h o r : n−o g u r a <n−o g u r a @ s d l . o s a k a −u . a c . j p >Date :Mon Feb 04 1 2 : 0 0 : 3 0 2017 +0900
Add an e r r o r h a n d l e r f o r Foo
d i f f −− g i t a / Example . j a v a b / Example . j a v ai n d e x 480 d81a . . 4 f b 1 b 2 9 100755

4−−− a / Example . j a v a+++ b / Example . j a v a@@ −15 ,4 +15 ,6@@...
+c a s e −1:+
this . handleError ( ) ;default :t h i s . doDefault ( ) ;. . . ( abbr . )@@ −31 ,3 +31 ,12@@+
public void handleError ( ) {+i f ( s t a t u s == 0 ) {...

blame ͷࡍͱಉ༷ʹɼ౰֘ίϛοτͰͷ͋ΒΏΔมߋ಺༰͕औಘ͞ΕΔɽ͜͜Ͱ‫ڵ‬ຯ͕͋Δ৘ใ͸
handleError ؔ਺ͷॲཧ಺༰Ͱ͋ΔɽΑͬͯɼઌͷྫͱಉ༷ʹʮ࣮ߦεςʔτϝϯτʹߜΓࠐΉʯ΍ʮhandleError ؔ਺ʹߜΓࠐΉʯͱ͍ͬͨίϯςΩετࢦఆ͕༗ޮͰ͋ΔɽҎԼ͸ handleError ؔ਺ʹߜΓࠐΜͩࡍͷྫͰ͋Δɽ
$ g i t show Example2 . j a v a b8beb025 −−c o n t e x t = i n −method : h a n d l e E r r o rcommit b 8 b e b 0 2 5 7 9 8 d b 8 4 c 9 f c c f e 4 4 d 3 9 4 d b f 1 e c 4 0 4 9 7 4
A u t h o r : n−o g u r a <n−o g u r a @ s d l . o s a k a −u . a c . j p >Date :Mon Feb 04 1 2 : 0 0 : 3 0 2017 +0900
Add an e r r o r h a n d l e r f o r Foo
d i f f −− g i t a / Example . j a v a b / Example . j a v ai n d e x 480 d81a . . 4 f b 1 b 2 9 100755−−− a / Example . j a v a+++ b / Example . j a v a@@ −31 ,3 +31 ,12@@+
public void handleError ( ) {+i f ( s t a t u s == 0 ) {...

Git ίϚϯυʹ͸ɼߦ਺Λࢦఆ͢Δͱ͍͏Φϓγϣϯ΋ଘࡏ͓ͯ͠Γɼ‫ݱ‬ঢ়Ͱ΋͜ΕΒͷྫͱಉ౳ͷૢ࡞͸ՄೳͰ͋Δɽ·ͨ grep ΦϓγϣϯʹΑΓɼಛఆͷΩʔϫʔυʹߜΓࠐΉ͜ͱ΋ՄೳͰ͋Δɽ͞Βʹ͸ɼGit ͷग़ྗ݁Ռʹରͯ͠ Linux ͷίϚϯυ‫܈‬Λ૊Έ߹ΘͤΕ͹ɼΑΓෳࡶͳ৘ใऔಘ͸Մ
ೳͰ͋Δɽ͔͠͠ͳ͕Βɼ͜ΕΒͷߦ਺ࢦఆ΍จࣈྻ‫ࡧݕ‬͸ςΩετσʔλʹର͢Δ൚༻తͳॲཧͰ
͋ΔҰํͰɼఏҊ͢ΔίϯςΩετૢ࡞͸ιʔείʔυʹಛԽͨ͠ҙຯ୯ҐͰͷॲཧͱ‫͕ͱ͜͢ͳݟ‬Ͱ͖Δɽ୯ͳΔςΩετʹର͢ΔॲཧʹՃ͑ɼιʔείʔυಛԽͷҙຯ୯ҐͷॲཧΛࢧԉ͢Δ͜ͱ
Ͱɼϓϩάϥϛϯάͷखॿ͚ʹͳΔͱߟ͑ΒΕΔɽ

5

3

ఏҊख๏
ຊ‫Ͱڀݚ‬͸ɼ൛؅ཧγεςϜʹ͓͍ͯཤྺ৘ใΛऔಘ͢Δʹ͋ͨΓɼͦͷ৘ใΛίϯςΩετʹ

ΑͬͯߜΓࠐΉ֦ு‫ػ‬ೳΛఏҊ͢ΔɽҎԼͰίϯςΩετͷఆٛɼैདྷͷ൛؅ཧγεςϜͱͷҧ͍ɼ֦ுର৅ʹͳΔίϚϯυɼ͞ΒʹఏҊख๏ͷಈ࡞ʹ͍ͭͯৄ͘͠આ໌͢Δɽ·ͨ 2 ষͱಉ༷ʹɼϓϩάϥϛϯά‫ޠݴ‬Λ Javaɼ൛؅ཧγεςϜΛ Git ͱ‫ݶ‬ఆͯ͠‫ݕ‬౼Λߦ͏ɽ

3.1ίϯςΩετ

ຊ‫Ͱڀݚ‬͸ɼίϯςΩετͱ͍͏‫ݴ‬༿Λɼʮ͋Δର৅ͷपล͔ΒಘΒΕΔจ຺ʹؔ͢Δ৘ใʯͷҙຯͰ༻͍Δɽ൛؅ཧγεςϜʹ͓͚ΔίϯςΩετͱͯ͠͸ɼιʔείʔυͷߏจ৘ใ͔ΒऔಘՄೳͳ৘ใɼ‫ͼٴ‬։ൃཤྺ͔ΒऔಘՄೳͳ৘ใͷ 2 ͭʹେผ͢Δ͜ͱ͕Ͱ͖Δɽ͜͜Ͱ͸લऀΛʮߏจίϯςΩετʯɼ‫ऀޙ‬ΛʮཤྺίϯςΩετʯͱ‫͢ͱͱ͜Ϳݺ‬Δɽ2 ͭͷίϯςΩετʹ͍ͭͯҎԼͰ
આ໌͢Δɽ

3.1.1

ߏจίϯςΩετߏจίϯςΩετͱ͸ɼιʔείʔυ͕࣋ͭߏจʹؔ͢Δ৘ใͷ͜ͱΛࢦ͢ɽߏจίϯςΩετ
͸༷ʑͳ෼ྨ͕ՄೳͰ͋Δ͕ɼຊ‫Ͱڀݚ‬͸ϓϩάϥϜͷৼΔ෣͍ʹӨ‫ڹ‬Λ༩͑Δ͔ͱ͍͏‫͔఺؍‬Βɼ
େ͖͘ 3 छྨʹ෼ྨ͢Δɽ֤ίϯςΩετΛ۩ମతͳྫͱͱ΋ʹઆ໌͢Δɽ• ࣮ߦεςʔτϝϯτ: ϓϩάϥϜͷৼΔ෣͍͕‫ه‬ड़͞Εͨ‫ه‬ड़Օॴͷ͜ͱɽ͞ΒʹҎԼʹࣔ͢Α͏ͳৄࡉͳ෼ྨ͕ՄೳͰ͋Δɽ

– if εςʔτϝϯτ: if จͷ‫ه‬ड़Օॴi f ( n > 0) {– switch εςʔτϝϯτ: switch จͷ‫ه‬ड़Օॴ
switch ( case ) {– ม਺એ‫ݴ‬εςʔτϝϯτ: ม਺એ‫ݴ‬ͷ‫ه‬ड़Օॴ
int n = 0;

– ؔ਺‫ͼݺ‬ग़͠εςʔτϝϯτ: ؔ਺‫ͼݺ‬ग़͠ͷ‫ه‬ड़Օॴ
public void h a n d l e E r r o r ( ) {– ...
• ίϝϯτ: ϓϩάϥϜͷৼΔ෣͍ʹ‫د‬༩͠ͳ͍ίϝϯτͷ‫ه‬ड़Օॴͷ͜ͱɽ6

– ϥΠϯίϝϯτ: 1 ߦίϝϯτͷ‫ه‬ड़Օॴ/ / H a n d l i n g an e r r o r c a s e– ϒϩοΫίϝϯτ: ෳ਺ߦʹ౉Δίϝϯτͷ‫ه‬ड़Օॴ/ ∗ L i c e n s e d u n d e r t h e MIT L i c e n s e– Javadoc: ϝιουͷ API ࢓༷ͷ‫ه‬ड़Օॴ/∗ ∗∗ Error handler∗ @param...

• Ξϊςʔγϣϯ: ஫ऍʹؔ͢Δ‫ه‬ड़ՕॴɽJava Ͱ͸ϝιου΍Ϋϥεͷϝλ৘ใͷ‫͍༻ʹࡌه‬ΒΕΔɽϓϩάϥϜͷৼΔ෣͍ʹ௚઀Ө‫ڹ‬Λ༩͑ͳ͍͕ɼίϯύΠϥ͕͜ͷ৘ใΛಡΈऔΓ։ൃऀʹ‫ࠂܯ‬Λग़͢౳ͷ‫͍༻Ͱܗ‬ΒΕΔɽ
@Override3.1.2

ཤྺίϯςΩετཤྺίϯςΩετͱ͸ɼ൛؅ཧγεςϜ͕อ͍࣋ͯ͠Δཤྺ৘ใ͔ΒಘΒΕΔ৘ใͷ͜ͱΛࢦ͢ɽ۩ମతͳཤྺίϯςΩετ͸༷ʑͳ΋ͷ͕ߟ͑ΒΕΔɽ• ιʔείʔυͷฤूΛߦͬͨஶऀ໊• ιʔείʔυͷมߋճ਺• ίϛοτ࣌ͷ૯ฤूߦ਺• ͋ΔϑΝΠϧͱಉ࣌ʹίϛοτ͞Ε͔ͨͲ͏͔• ...
͜ΕΒͷίϯςΩετΛ੔ཧ͢Δ͜ͱͰɼྫ͑͹ҎԼͷΑ͏ͳ৔߹ʹఏҊख๏͕໾ʹཱͭɽ• มߋ͞Εͨճ਺ͷଟ͍ιʔείʔυΛ୳͠ɼͦͷϓϩδΣΫτͷத৺ͱͳ͍ͬͯΔιʔείʔυΛൃ‫͢ݟ‬Δɽ

• มߋճ਺ͷগͳ͍ιʔείʔυΛൃ‫͠ݟ‬ɼϝϯςφϯεΛ͢Δɽ• ͋ΔϑΝΠϧʹόάΛ‫͚ͨͭݟ‬ɽಉ࣌ʹίϛοτ͞ΕͨϑΝΠϧ΋ϝϯςφϯε͍ͨ͠ͷͰಉ࣌ʹίϛοτ͞ΕͨϑΝΠϧҰཡΛ‫ݟ‬Δɽ

7• ଟ͘ͷίϛοτΛ͍ͯ͠ΔஶऀͷߦͬͨίϛοτΛ‫ͯݟ‬ɼͲͷΑ͏ͳߩ‫ݙ‬Λ͍ͯ͠Δ͔֬ೝ͍ͨ͠ɽ

Git ʹ͸‫ʹط‬ɼ͋ΔஶऀʹΑͬͯߦΘΕͨίϛοτϩά͚ͩΛදࣔ͢Δ‫ػ‬ೳ΍ɼಛఆͷϑΝΠϧ͕ίϛοτ͞Εͨϩά͚ͩΛग़ྗ͢Δ‫ػ‬ೳͳͲɼཤྺίϯςΩετʹؔ࿈͢ΔίϚϯυ͕͍͔ͭ͘αϙʔτ͞Ε͍ͯΔɽ͔͠͠ɼ͜ΕΒͷίϚϯυͰཤྺίϯςΩετʹΑΔߜΓࠐΈΛ௚઀ͷ໨తͱͨ͠΋ͷ͸গͳ͘ɼ࣮ࡍʹཤྺίϯςΩετʹΑΔߜΓࠐΈΛߦ͍͍ͨ৔߹ʹ͸ɼγΣϧεΫϦϓτʹ
ΑΓΧ΢ϯτ΍ιʔτ౳ͷςΩετॲཧ͕ඞཁͱͳΔ৔߹͕ଟ͍ɽͦͷͨΊɼཤྺίϯςΩετʹΑΔߜΓࠐΈΛߦ͍͍ͨ৔߹ʹ͸ɼ࢖༻ऀࣗ਎͕‫ط‬ଘͷίϚϯυ΍γΣϧεΫϦϓτΛ‫͚ͳ͠࢖ۦ‬Ε͹ͳΒͳ͍ͱ͍͏ͷ͕‫ݱ‬ঢ়Ͱ͋Δɽ

3.2

ैདྷͷ൛؅ཧγεςϜͱͷҧ͍ఏҊख๏ͱैདྷͷ൛؅ཧγεςϜͱͷൺֱΛਤ 1(a) ͱਤ 1(b) ʹࣔ͢ɽ͜ΕΒͷਤͰ͸ɼ͋ΔϦϙδτϦʹ c1 ͔Β cN ·Ͱίϛοτ͞Εͨཤྺ৘ใ͕อଘͯ͋͠Δঢ়ଶΛද͍ͯ͠Δɼ͜͜ͰɼϢʔβʔ͕ίϛοτ c2 ͱίϛοτ c3 ͷࠩ෼ΛίϚϯυʮgit diff c2 c3ʯʹΑͬͯཁ‫࣌ͨ͠ٻ‬ɼैདྷͷ GitͰ͸ɼίϛοτ c2 ͱίϛοτ c3 ͷࠩ෼͕ɼ௥Ճ෼΋࡟আ෼΋શͯͦͷ··౉͞ΕΔɽ͔͠͠ɼఏҊख๏Ͱ͸ɼίϚϯυʮgit diff c2 c3ʯʹίϯςΩετΛࢦఆ͢Δ໋ྩΛ௥Ճ͢Δ͜ͱͰɼ৘ใ͕ߜΓࠐ·Εͨࠩ෼͕࢖༻ऀʹ౉͞ΕΔʢਤ 1(b)ʣ
ɽ

3.3

֦ுର৅ίϚϯυ

൛؅ཧγεςϜʹ͸ଟ͘ͷίϚϯυ͕༻ҙ͞Ε͍ͯΔ͕ɼຊ‫ڀݚ‬ͷఏҊख๏Ͱ͸ɼཤྺ৘ใͷऔಘʹ͓͚ΔߜΓࠐΈΛ໨తͱ͍ͯ͠ΔɽΑͬͯɼ֦ு͢ΔίϚϯυ͸શͯͷίϚϯυͰ͸ͳ͘ɼཤྺ৘
ใऔಘʹؔΘΔίϚϯυɼͭ·Γιʔείʔυͷ৘ใΛऔಘ͢ΔίϚϯυͷΈΛର৅ͱ͢ΔɽGit ͷ৔߹Ͱ͸ɼҎԼͷΑ͏ͳίϚϯυ͕֦ுର৅ͱͳΔɽ• diff: ख‫ݩ‬ͷιʔείʔυͱ࠷৽ίϛοτͱͷࠩ෼΍ɼ2 ͭͷίϛοτؒͷࠩ෼ͳͲΛදࣔ͢Δ• show: ίϛοτͷৄࡉΛ‫ݟ‬Δ• log: ίϛοτͷϩάΛ‫ݟ‬Δ• blame: ϑΝΠϧ಺ͷ֤ߦͷ࠷ऴߋ৽ͷ৘ใΛ‫ݟ‬Δ• grep: ϑΝΠϧ͔ΒจࣈྻΛ‫͢ࡧݕ‬Δ
3.4

ఏҊख๏ͷಈ࡞

ఏҊख๏ͷಈ࡞ʹ͍ͭͯઆ໌͢ΔɽҎ্Ͱड़΂ͨఏҊख๏ʹ͍ͭͯɼͲͷΑ͏ͳಈ࡞Ͱ࣮‫͢ݱ‬Δ
͔ɼೋ௨Γͷํ๏ΛఏҊ͢Δɽࣄલॲཧ‫ͱܕ‬దٓॲཧ‫͋Ͱܕ‬Δɼࣄલॲཧ‫ܕ‬Λਤ 2(a) ʹɼదٓॲཧ
‫ܕ‬Λਤ 2(b) ʹɼͦΕͧΕͷϝϦοτɾσϝϦοτΛ·ͱΊͨදΛද 1 ʹࣔ͢ɽ8

git diff c2 c3

…c1 c2

c3

t
cN


:qmq(N)
:qmq(T)
(a) ैདྷͷ Git ͷಈ࡞

git diff c2 c3+ q&…
c1 c2

c3

t
cN


:qmq(N)
:qmq(T)

(0$4
(b) ఏҊख๏ͷಈ࡞ਤ 1: ఏҊख๏ͱैདྷͷ൛؅ཧγεςϜͱͷҧ͍9ਤ 2(a) ͷࣄલॲཧ‫Ͱܕ‬͸ɼίϛοτ࣌ʹϦϙδτϦʹϑΝΠϧΛอଘ͢ΔલʹίϯςΩετʹΑΔߜΓࠐΈΛࡁ·͓͖ͯ͠ɼͦͷঢ়ଶͰϦϙδτϦʹอଘ͢Δɽͦͯ͠ɼίϚϯυ࣮ߦ࣌ʹίϯςΩ
ετ͕ࢦఆ͞ΕΕ͹ɼ͢ͰʹߜΓࠐ·Ε͍ͯΔ৘ใ͔Β֘౰͢Δ΋ͷΛબ୒ͯ͠࢖༻ऀʹ౉͢ɽࣄલॲཧ‫ܕ‬ͷϝϦοτ͸ɼίϛοτ࣌ʹߜΓࠐΈΛࡁ·͓ͯ͘͜͠ͱͰɼࠓ‫ޙ‬Ұ੾ߜΓࠐΈॲཧΛߦΘͳͯ͘Α͘ͳΓɼίϯςΩετߜΓࠐΈ࣌ͷ଎౓͕଎͘ͳΔ͜ͱͰ͋ΔɽσϝϦοτ͸ɼίϛοτͷ࣮ߦ଎౓͕஗͘ͳΔ͜ͱͱɼίϛοτ࣌ʹॲཧΛߦ͏ඞཁ͕͋ΔͷͰɼ‫ʹط‬ίϛοτ͕࣮ߦ͞Εͯ͠·͍ͬͯΔ‫ط‬ଘͷϦϙδτϦʹద༻Ͱ͖ͳ͍͜ͱɼ·ͨɼ࣮૷࣌ͷ֦ுର৅ίϚϯυͱͯ͠ɼίϯςΩετΛߜΓࠐΊΔίϚϯυʢdiff ΍ show ͳͲʣʹՃ͑ɼcommit ίϚϯυ΋֦ு͢Δඞཁ͕
͋Δ͜ͱͰ͋Δɽ
ਤ 2(b) ͷదٓॲཧ‫Ͱܕ‬͸ɼίϛοτ࣮ߦ࣌ʹ͸ैདྷͷγεςϜ௨ΓʹϦϙδτϦʹϑΝΠϧΛอଘ͠ɼίϚϯυ࣮ߦ࣌ʹίϯςΩετ͕ࢦఆ͞ΕΕ͹ίϯςΩετͷߜΓࠐΈΛߦ͏ɽదٓॲཧ‫ܕ‬ͷϝϦοτͱͯ͠͸ɼίϛοτ࣌ͷ଎౓௿Լ͕ൃੜ͠ͳ͍͜ͱɼίϛοτ࣌ʹॲཧΛࢪ͢ඞཁ͕ͳ͘ɼ‫ط‬ଘͷϦϙδτϦʹద༻ՄೳͰ͋Δ఺ͳͲ͕‫͛ڍ‬ΒΕΔɽ·ͨɼ࣮૷࣌ͷ֦ுର৅ίϚϯυ͸ίϯςΩετΛߜΓࠐΉίϚϯυ͚ͩͰྑ͍ɽσϝϦοτͱͯ͠͸ɼίϯςΩετࢦఆ࣌ʹຖճߜΓࠐΈॲཧΛߦ͏ͷͰɼ࣮ߦ଎౓͕஗͘ͳΔͱ͍͏఺͕‫͛ڍ‬ΒΕΔɽද 1: ఏҊख๏ͷಈ࡞ҊͷϝϦοτɾσϝϦοτ
ࣄલॲཧ‫ܕ‬దٓॲཧ‫ܕ‬ίϛοτॲཧͷ଎౓஗͍଎͍ίϯςΩετߜΓࠐΈॲཧͷ଎౓଎͍஗͍‫ط‬ଘͷϦϙδτϦ΁ͷద༻ෆՄՄ

commit ͱ࣮૷࣌ͷ֦ுର৅ίϚϯυίϯςΩετΛίϯςΩετΛߜΓ͜ΉίϚϯυ

ߜΓࠐΉίϚϯυ

10

commitqVF+pz&(a) ࣄલॲཧ‫ܕ‬

commitF+pz&qV(b) దٓॲཧ‫ܕ‬ਤ 2: ఏҊख๏ͷಈ࡞Ҋ

11

4ϓϩτλΠϓ MJgit ͷ࣮૷

4.1

MJgit ͷ֓ཁఏҊख๏ͷϓϩτλΠϓͱͯ͠ɼΦʔϓϯιʔεͷ Git ΫϥΠΞϯτ JGit[19] Λ֦ுͨ͠ MJgit Λ։ൃͨ͠ɽMJgit ͷ࢓༷Λද 2 ʹࣔ͢ɽίϯςΩετͷߜΓࠐΈૢ࡞͸ Java ͷιʔείʔυͷΈ͕ର৅ͱͳΔɽར༻ՄೳͳίϯςΩετͷछྨ͸ɼ3.1.1 ষͰड़΂ͨ 2 छྨͷίϯςΩετͷ಺ɼߏจίϯςΩετͷΈ͕ର৅Ͱ͋ΔɽΑΓ۩ମతʹ͸ɼ࣮ߦεςʔτϝϯτɼίϝϯτɼJavadocɼΞϊςʔγϣϯͷ 4 छྨ͕ର৅ͱͳΔɽ֦ுͨ͠ Git ίϚϯυ͸ show ͱ diff ͷ 2 ͭͰ͋Γɼಈ࡞ํ๏͸దٓॲཧ‫ܕ‬Λ࠾༻ͨ͠ɽ͜Ε͸ɼ‫ط‬ଘͷϦϙδτϦʹ΋ॊೈʹద༻Ͱ͖Δͱ͍͏దٓॲཧ‫ܕ‬ͷར఺Λ༏ઌͨͨ͠ΊͰ͋Δɽ
‫ج‬ຊతͳૢ࡞ɼ‫ৼͼٴ‬Δ෣͍͸Ұൠతͳ Git ΫϥΠΞϯτͱಉ͡Ͱ͋ΔɽίϯςΩετࢦఆΦϓ
γϣϯ-cx ʹΑΓɼίϯςΩετࢦఆ͕ߦΘΕͨ৔߹ʹ‫ݶ‬Γɼιʔείʔυͷߏจղੳɼ‫ͼٴ‬৘ใͷߜΓࠐΈॲཧ͕ߦΘΕΔɽ۩ମతͳॲཧͷྲྀΕ͸࣍ষͰड़΂Δɽද 2: MJgit ͷ࢓༷ಈ࡞ํ๏దٓॲཧ‫ܕ‬֦ுର৅ͷ Git ίϚϯυshow, diffίϯςΩετࢦఆՄೳͳ‫ޠݴ‬Java 1.8 Ҏ্ίϯςΩετͷࢦఆΦϓγϣϯ

-cxࢦఆՄೳͳίϯςΩετͱ࣮ߦεςʔτϝϯτʢastʣͦͷࢦఆํ๏

ίϝϯτ (comment)

Javadoc (javadoc)Ξϊςʔγϣϯ (annotation)ίϯςΩετͷෳ਺બ୒ෆՄߏจΤϥʔ͕‫·ؚ‬ΕΔ৔߹

ίϯςΩετࢦఆ͸ແޮ22 ந৅ߏจ໦͕ੜ੒Ͱ͖ͳ͍ͨΊ12

0-&+0

(2' 
%2,

(2'
%2,





:  "
%1*$'+ਤ 3: ఏҊख๏ͷॲཧͷྲྀΕ

4.2

ॲཧͷྲྀΕ

ఏҊख๏ͷॲཧͷྲྀΕΛਤ 3 ʹࣔ͢ɽ͜ͷਤ͸ɼҎԼͰઆ໌͢Δ 3 εςοϓΛද͍ͯ͠Δɽ
εςοϓ 1: ൺֱ͞ΕΔιʔείʔυͷநग़diff ͱ show ͸྆ऀͱ΋ࢦఆ͞Εͨ৚݅ʹదͬͨೋͭͷιʔείʔυͷࠩ෼Λදࣔ͢ΔίϚϯυͰ͋ΔɽJGit ͷιʔείʔυΛ‫ݟ‬Δͱɼdiff ͱ show ͷॲཧ͸ɼιʔείʔυΛϦϙδτϦ͔Βऔಘ͖ͯͯ͠Ҏ߱ɼൺֱ͢Δ·Ͱͷॲཧ͕શ͘ಉ͡Ͱ͋ΔͱΘ͔ͬͨɽΑͬͯ diff ͱ show ͷ֦ுͷͨΊʹ࣮૷ͨ͠ํ๏͸શ͘ಉ͡Ͱ͋Δɽ·ͣɼϦϙδτϦ͔Βൺֱ͢ΔιʔείʔυΛऔಘ͍ͯ͠Δ෦෼Λ‫͚ͭݟ‬ɼͦͷιʔείʔυΛίϯςΩετʹΑΔߜΓࠐΈΛ͢ΔͨΊʹୀආͤ͞Δɽ

13εςοϓ 2: ίϯςΩετʹΑΔιʔείʔυͷ෼ղ࣍ʹɼୀආͤͨ͞ιʔείʔυʹίϯςΩετʹΑΔߜΓࠐΈΛߦ͏ɽιʔείʔυͷߏจղੳʹ͸ JDT (Java development tools)1 Λ༻͍ͨɽJDT ͷੜ੒͢Δ ASTʢந৅ߏจ໦ʣʹ‫͍ͯͮج‬ɼ࣮ߦεςʔτϝϯτ΍Ξϊςʔγϣϯ౳ͷ৘ใΛऔಘ͠ɼιʔείʔυΛ෼ղ͢Δɽ
εςοϓ 3: ൺֱ͞ΕΔιʔείʔυͱೖΕସ͑࠷‫ʹޙ‬ɼ෼ׂͨ͠ιʔείʔυ͔ΒίϯςΩετͰࢦఆ͞Εͨ෦෼Λબ୒͢Δɽͦͯ͠ɼεςοϓ

1 Ͱड़΂ͨιʔείʔυΛநग़ͨ͠৔ॴʹ໭͢ɼҎ߱ͷॲཧ͸ैདྷͷ JGit ͷॲཧʹ΋ͲΔɽҎ্ʹΑΓɼࢦఆ͞ΕͨίϯςΩετ෦෼ͷΈ͕ൺֱ͞Εͨࠩ෼͕ग़ྗ͞ΕΔɽ

1 https://projects.eclipse.org/projects/eclipse.jdt

14

5ධՁ࣮‫ݧ‬
ఏҊख๏Λ࣮૷͠ɼ༗༻ੑΛධՁ͢ΔͨΊʹධՁ࣮‫ݧ‬Λߦͬͨɽ࣮‫಺ݧ‬༰ͱ݁Ռʹ͍ͭͯड़΂Δɽ

5.1

࣮‫֓ݧ‬ཁ

ຊ࣮‫ݧ‬ͷ໨త͸దٓॲཧ‫ܕ‬ͷσϝϦοτͱͯ͠ड़΂ͨίϯςΩετͷॲཧͷ֦ுʹΑΔ࣮ߦ଎౓ͷ௿Լʹ͍ͭͯௐࠪ͢Δ͜ͱ͓Αͼɼཤྺ৘ใͷ࡟‫ߦ͕ݮ‬ΘΕ͍ͯΔ͔Λௐࠪ͢Δ͜ͱͰ͋ΔɽͦͷͨΊʹɼ‫ط‬ଘͷϓϩδΣΫτʹରͯ͠ϓϩτλΠϓΛ࣮ߦ͠ɼͦͷ࣮ߦ࣌ؒͱग़ྗߦ਺Λଌఆͨ͠ɽ

5.2

࣮‫ݧ‬ͷྲྀΕ࣮‫಺ݧ‬༰Λදͨ͠ਤΛਤ 4(a)ɼਤ 4(b) ʹࣔ͢ɽϓϩδΣΫτʹίϛοτ 0 ͔Βίϛοτ N ·Ͱͷཤྺ৘ใ͕อଘ͞Ε͍ͯΔͱ͢Δɽ·ͣ͜ͷ֤ίϛοτʹରͯ͠ɼJava ϑΝΠϧͷมߋ͕͞Ε͍ͯΔ͔ΛνΣοΫ͢Δɽͦͯ͠ɼJava ϑΝΠϧͷมߋ͕ͳ͞Ε͍ͯΔίϛοτʹର͚ͯͩ͠ɼ֤ਤʹࣔ͞ΕͨίϚϯυ‫܈‬Λ࣮ߦ͢Δɽͭ·ΓɼJava ϑΝΠϧͷมߋ͕ߦΘΕͨશίϛοτʹରͯ͠ show ͱͦͷ֦ு‫ػ‬ೳશͯΛ࣮ߦ͠ɼಉ༷ʹ Java ϑΝΠϧͷมߋ͕ߦΘΕͨશίϛοτͷલ‫ʹޙ‬ରͯ͠ diffͱͦͷ֦ு‫ػ‬ೳશͯΛ࣮ߦ͢Δͱ͍͏͜ͱͰ͋Δɽͦͯ͠ɼ֤ίϚϯυ࣮ߦ࣌ͷ࣮ߦ࣌ؒͱग़ྗߦ਺
Λଌఆͨ͠ɽ

MJgit ͸ Java ϑΝΠϧʹ͚ͩಈ࡞͢ΔͨΊɼςΩετ΍ଞͷϦιʔεͷΈΛมߋͨ͠ίϛοτʹ
͸Ұ੾‫د‬༩͠ͳ͍ɽΑͬͯɼJava ϑΝΠϧͷมߋ͕ߦΘΕͨίϛοτ͚ͩΛର৅ͱ࣮ͯ͠‫ݧ‬Λߦ͏ɽ֤ਤͷίϚϯυ‫܈‬͸ɼMJgit Ͱ֦ுͨ͠ίϚϯυ diff ͱ show ͷɼίϯςΩετΛࢦఆ͠ͳ͍৔߹ͱɼ
֤छίϯςΩετΛࢦఆͨ͠৔߹ͷ࣮ߦ࣌ؒͱग़ྗߦ਺Λ֦ுલͷ JGit ͱൺֱ͢ΔͨΊʹ࣮ߦ͢Δ
΋ͷͰ͋Δɽ

5.3

݁Ռͷ‫ܭ‬ଌํ๏‫ܭ‬ଌର৅ͷϝτϦΫε͸࣌ؒͱߦ਺Ͱ͋ΔɽͦͷͨΊɼLinux ͷඪ४ίϚϯυΛ༻͍ͯൺֱత༰қʹऩू͢Δ͜ͱ͕ՄೳͰ͋Δɽ࣮ߦ࣌ؒͷ‫ܭ‬ଌͱͯ͠͸ɼίϚϯυͷ࣮ߦ௚‫͔ޙ‬Βͦͷॲཧ݁Ռ͕
ಘΒΕΔ·Ͱͷ࣌ؒͷ௕͞Λ༻͍Δɽ࠷৽ϦϏδϣϯʢHEADʣΛର৅ͱͨ͠ࡍͷ‫ܭ‬ଌํ๏ΛҎԼʹ
ࣔ͢ɽ
time
time
time
time
...

mjgit
mjgit
mjgit
mjgit

show HEAD
show HEAD −cx a s t
show HEAD −cx comment
show HEAD −cx j a v a d o c͜͜Ͱ͸ time ίϚϯυΛ༻͍ͯ࣌ؒΛ‫ܭ‬ଌ͍ͯ͠Δɽ͜ΕΛશͯͷίϯςΩετૢ࡞ɼ‫ͼٴ‬શͯͷϦϏδϣϯʹର࣮ͯ͠ߦ͠ɼͦͷग़ྗ݁ՌΛ੔ཧ͢Δ͜ͱͰ݁ՌΛऩू͢Δɽ

15

pvx0

Javaa
#Kg

pvx1

Javaa
#_U

pvx2

Javaa
#Kg

py8:py8:……pvxN

py8

Javaa
#Kg

jgit show
mjgit show
mjgit show –cx ast
mjgit show –cx comment
mjgit show –cx javadoc
mjgit show –cx annotationpy8:t(a) show ͷ࣮‫಺ݧ‬༰pvx0

pvx1

pvx2

py8
Javaa
#_U

py8:

Javaa
#Kg

py8:

……

Javaa
#Kg

pvxN-1

pvxNt(b) diff ͷ࣮‫಺ݧ‬༰ਤ 4: ࣮‫಺ݧ‬༰

16jgit diffmjgit diffmjgit diff –cx ast
mjgit diff –cx comment
mjgit diff –cx javadoc
mjgit diff –cx annotation

·ͨߦ਺ͷ‫ܭ‬ଌํ๏ΛҎԼʹࣔ͢ɽ
mjgit
mjgit
mjgit
mjgit
...

show HEAD | wc
show HEAD −cx a s t | wc
show HEAD −cx comment | wc
show HEAD −cx j a v a d o c | wc࣌ؒͷ‫ܭ‬ଌͱಉ༷ʹɼwc ίϚϯυʹΑΓ‫ܭ‬ଌ͕ՄೳͰ͋Δɽ

5.4

࣮‫ݧ‬ର৅

࣮‫ݧ‬ର৅ͱͯ͠͸ɼJava Ͱ։ൃ͞ΕͨΦʔϓϯιʔεϓϩδΣΫτ JUnit4[13] ͱɼLog4j[14] Λ࠾༻͢ΔɽͦΕͧΕͷϓϩδΣΫτͷ֓ཁΛද 3 ʹࣔ͢ɽ͍ͣΕͷϓϩδΣΫτ΋ 10 ೥Ҏ্‫ܧ‬ଓɼ͔
ͭ 1,000 ίϛοτΛ௒͍͑ͯΔɽදͷԼೋߦ͸ɼͦΕͧΕਤ 4(a)ɼ4(b) Ͱઆ໌͞ΕͨίϚϯυ‫܈‬Λ࣮ߦ͢΂͖ର৅ͱ൑அ͞Εͨίϛοτ਺ɼͭ·ΓɼJava ϑΝΠϧͷมߋ͕͋ͬͨίϛοτ਺ͷ͜ͱͰ
͋Δɽ

5.5

࣮‫݁ݧ‬Ռ

JUnit4 ʹର͢Δ࣮‫݁ݧ‬ՌΛശͻ͛ਤʹͯ͠ਤ 5 ਤ 6 ਤ 7 ਤ 8 ʹ, Log4j ʹର͢Δ࣮‫݁ݧ‬ՌΛಉ༷ʹശͻ͛ਤʹͯ͠ਤ 9 ਤ 10 ਤ 11 ਤ 12 ʹࣔ͢ɽ
ද 3: ࣮‫ݧ‬ର৅ϓϩδΣΫτͷ֓ཁJUnit4Log4j

2000/12/3

2000/11/16

ίϛοτ਺

1,165

2,932

શϑΝΠϧ਺

636

438

Java ϑΝΠϧ਺

438

309

630

1,890

870

1,891

։࢝೔

show ͷ࣮ߦର৅ͱͳΔίϛοτ਺

diff ͷ࣮ߦର৅ͱͳΔ
ίϛοτ਺

17

(2) 0123(2) 0

4

jgit

jgit

ovmrw^Tovmrw^Tovmrwast

ovmrwast

ovmrwcommentovmrwcommentovmrwjavadocovmrwjavadocovmrw
annota=onovmrw
java_only
annota=on

2

3

4

java_only

junit_show_real

200

400

600

junit_diﬀ_realਤ 6: JUnit4 ʹର͢Δ diff ͷ࣮ߦ࣌ؒਤ 5: JUnit4 ʹର͢Δ show ͷ࣮ߦ࣌ؒ(:) 01(:) 0

800

200

400

600

800

jgit

jgit

ovmrw^Tovmrw^Tovmrwast

ovmrwast

ovmrwcommentovmrwcommentovmrwjavadocovmrwjavadocovmrw
annota=onovmrw
java_only
annota=on

java_only

junit_show_line

junit_diﬀ_line

ਤ 8: JUnit4 ʹର͢Δ diff ͷग़ྗߦ਺ਤ 7: JUnit4 ʹର͢Δ show ͷग़ྗߦ਺18

(2) 0123(2) 0

4

jgit

jgit

ovmrw^Tovmrw^Tovmrwast

ovmrwast

ovmrwcommentovmrwcommentovmrwjavadocovmrwjavadocovmrw
annota=onovmrw
java_only
annota=on

1

2

3

4

java_only
log4j_diﬀ_real

log4j_show_realਤ 10: Log4j ʹର͢Δ diff ͷ࣮ߦ࣌ؒਤ 9: Log4j ʹର͢Δ show ͷ࣮ߦ࣌ؒ(:) 0

200

400

600

(:) 0

800

jgit

jgit

ovmrw^Tovmrw^Tovmrwast

ovmrwast

ovmrwcommentovmrwcommentovmrwjavadocovmrwjavadocovmrw
annota=onovmrw
java_only
annota=on

200

400

600

800

log4j_show_lineਤ 12: Log4j ʹର͢Δ diff ͷग़ྗߦ਺ਤ 11: Log4j ʹର͢Δ show ͷग़ྗߦ਺֤ਤʹ͓͚Δԣ࣠͸࣮ߦ࣌ؒ (ඵ)ɼ·ͨ͸ग़ྗߦ਺ (ߦ) Ͱ͋Γɼॎ࣠ʹ͸ͲͷίϯςΩετΛࢦఆ͢Δ͔ͱ͍͏ίϚϯυͷछྨ͕ฒ΂ΒΕ͍ͯΔɽͳ͓ɼશͯͷ݁Ռʹ͓͍ͯɼ࣮ߦ࣌ؒͷ 4 ඵҎ্ͷ֎Ε஋͓Αͼɼग़ྗߦ਺ͷ 800 ߦҎ্ͷ֎Ε஋͸ද͍ࣔͯ͠ͳ͍ɽ
Ͳͷ݁ՌΛ֬ೝͯ͠΋্ೋͭͷശͻ͛ਤɼ͢ͳΘͪʮjgit show(diff)ʯͱʮmjgit show(diff)ʯͷശͻ͛ਤ͸ಉ౳Ͱ͋Δɽͭ·ΓɼMJgit ͷ࣮ߦ଎౓͸ΦϦδφϧͰ͋Δ JGit ͱಉ౳Ͱ͋Δ͜ͱ͕֬ೝͰ͖
Δɼ࣮ߦ࣌ؒʹ͍ͭͯ‫ͯݟ‬ΈΔͱɼͲͷϓϩδΣΫτɼͲͷίϯςΩετɼͲͪΒͷίϚϯυΛ࣮ߦ

19

java_only
log4j_diﬀ_lineͨ͠৔߹Ͱ΋ɼίϯςΩετࢦఆͳ͠ͱൺֱ࣮ͨ͠ߦ࣌ؒͷഒ཰͸ 2.5 ഒఔ౓Ͱ͋ͬͨɽίϯςΩε
τࢦఆͳ͠ͷ࣮ߦ଎౓͸ฏ‫ ۉ‬0.8 ඵఔ౓Ͱ͋ΔͨΊɼ2.5 ഒ͸͢ͳΘͪ 2 ඵఔ౓ͱ͍͏͜ͱʹͳΔɽ
·ͨɼ֤ϓϩδΣΫτͷ࣮ߦ࣌ؒͷ࠷େ஋͸ɼJUnit4 ͰίϯςΩετʹ࣮ߦεςʔτϝϯτΛࢦఆͨ͠৔߹ͷ 14 ඵɼLog4j ͰίϯςΩετʹ࣮ߦεςʔτϝϯτΛࢦఆͨ͠৔߹ͷ 18 ඵͰ͋ͬͨɽ
ग़ྗߦ਺ʹ͍ͭͯ͸ɼͲͷ݁Ռʹ͓͍ͯ΋ɼ࣮ߦεςʔτϝϯτͷ‫ݮ‬গ཰͕Ұ൪খ͘͞ɼίϯςΩεࢦఆͳ͠ͱൺֱͯ͠ฏ‫ ۉ‬0.8 ഒͷग़ྗߦ਺Λࣔͨ͠ɽ·ͨɼΞϊςʔγϣϯΛࢦఆͨ͠৔߹ʹ࠷΋ߦ਺ͷ࡟‫͕཰ݮ‬େ͖͘ɼฏ‫ Ͱۉ‬0.4 ഒఔ౓Ͱ͋ͬͨɽ

20

6

ߟ࡯
ຊষͰ͸ɼ࣮‫Ͱݧ‬ಘΒΕͨ݁Ռʹ͍ͭͯߟ࡯͢Δɽ

6.1

৘ใͷߜΓࠐΈͷఔ౓ग़ྗߦͷ࡟‫߹ׂݮ‬͸ɼ͢ͳΘͪίϯςΩετߜΓࠐΈʹΑΓɼͲͷఔ౓ؔ৺Ҏ֎ͷ৘ใΛল͚Δ͔Λද͢ҰͭͷࢦඪͱͳΔɽ౰વͳ͕Βɼιʔείʔυதͷ‫ه‬ड़಺༰ͷ΄ͱΜͲ͸࣮ߦεςʔτϝϯτʹؔ͢Δ΋ͷͰ͋Γɼ࣮ߦεςʔτϝϯτͱ͍͏ίϯςΩετͰ࡟‫͖Ͱݮ‬Δׂ߹͸ 2 ׂఔ౓ʹͱͲ·ͬͨɽΑΓ৘ใΛߜΓࠐΉͨΊʹ͸ɼ࣮ߦεςʔτϝϯτΛ͞Βʹৄࡉʹ෼ྨ͠ɼࢦఆͰ͖ΔΑ͏ʹ֦ு͢Δඞཁ͕͋Δͱ͍͑Δɽந৅ߏจ໦ͷੜ੒͸ JDT Λ༻͍͓ͯΓɼ͞ΒͳΔίϯςΩετͷ
ৄࡉԽ͸ൺֱత༰қʹ࣮‫ݱ‬ՄೳͰ͋Δɽ·ͨɼ࣮ߦεςʔτϝϯτҎ֎ͷίϝϯτ΍ JavadocɼΞϊςʔγϣϯͱ͍ͬͨ‫ه‬ड़ׂ߹͕௿͍ίϯςΩετͰ͸ɼ֓Ͷ൒෼ఔ౓ʹߦ਺͕࡟‫͞ݮ‬Ε͍ͯͨɽ͜ΕΒͷίϯςΩετʹؔ৺͕͋Δࡍʹ͸ɼෆཁͳ৘ใΛলུͰ͖͍ͯΔͱ‫͖Ͱ͕ͱ͜͢ͳݟ‬Δɽ

6.2

ఏҊख๏ʹΑΔ࣮ߦ଎౓ͷ௿Լ֦ுΫϥΠΞϯτͰ͸ɼGit ͷඪ४తͳॲཧʹՃ͑ɼந৅ߏจ໦ͷੜ੒ॲཧͱιʔείʔυͷ෼ׂॲཧ͕௥Ճ͞Ε͓ͯΓɼ࣮ߦ଎౓͸௿Լ͢Δɽ࣮‫ݧ‬ͷ݁ՌΑΓɼ֦ுʹΑΔ࣮ߦ࣌ؒͷ૿Ճ͸ฏ‫ۉ‬

0.8 ඵͰऴΘΔॲཧʹରͯ͠ɼฏ‫ ۉ‬2.5 ഒͷ૿ՃʹͱͲ·͍ͬͯͨɽ਺ඵͰऴ͑Δ͜ͱ͕Ͱ͖Δͱ͍͏‫͔఺؍‬Βɼ࣮༻తͳൣғʹऩ·͍ͬͯΔͱߟ͑Δɽ·ͨɼ΋ͬͱ΋࣮ߦ଎౓͕ѱԽ͢Δέʔε͸ɼ

Log4j ʹର͢Δ͋Δίϛοτʢίϛοτ ID: cb47e2e8ʣʹରͯ͠ show ίϚϯυΛ࣮ߦͨ͠৔߹Ͱ͋
ΓɼίϯςΩετࢦఆͳ͠Ͱ 1.1 ඵɼ࣮ߦεςʔτϝϯτίϯςΩετࢦఆͰ 18 ඵͰ͋ͬͨɽ͜ͷίϛοτͰ͸ɼશͯͷ Java ϑΝΠϧʹରͯ͠ϥΠηϯεจ͕Ұ‫ׅ‬ஔ‫͞׵‬Ε͓ͯΓɼ302 ‫ݸ‬ͷϑΝΠϧ͕มߋ͞Ε͍ͯͨɽ͜ͷΑ͏ͳ‫ڊ‬େͳίϛοτ͸‫͋Ͱر‬ΓɼҰൠతͳ։ൃաఔʹ͓͍ͯ͸଎౓ͷ௿ԼΑΓ΋৘ใͷߜΓࠐΈͱ͍͏ར఺͕ੜ͖Δͱߟ͑ΒΕΔɽ

6.3

ίϯςΩετࢦఆ͕‫͔͞׆‬ΕΔࣄྫ

લষͰઆ໌ͨ͠ɼLog4j ʹ͓͚ΔϥΠηϯεจͷมߋίϛοτʹ͍ͭͯߟ͑Δɽ͜ͷϦϏδϣϯͰ͸ɼJava ͷ 302 ‫ݸ‬ͷϑΝΠϧʹର͢Δશͯͷมߋ಺༰͸ίϐʔϥΠτʹؔ͢Δ΋ͷʹ‫ݶ‬ఆ͞Ε͍ͯͨɽ൛؅ཧγεςϜͷར༻ʹର͢Δௐࠪͱͯ͠ɼ୯Ұͷίϛοτ͸୯Ұͷҙਤʹ‫ݶ‬ఆ͢Δ΂͖Ͱ͋Δ
΋ͷͷɼෳ਺ͷҙਤ͕ࠞࡏͨ͠ίϛοτ͕ଟ਺ଘࡏ͢Δ͜ͱ͕ࢦఠ͞Ε͍ͯΔ [20]ɽ͜͜Ͱ‫ͨ͛ڍ‬

Log4j ͷίϛοτʹରͯ͠ɼίϯςΩετΛࢦఆͨ͠ࡍͷ݁ՌΛ෼ੳͨ͠ͱ͜Ζɼ࣮ߦεςʔτϝϯτ͕Ұ੾มߋ͞Ε͓ͯΒͣɼҙਤͷࠞࡏ͠ͳ͍ʮྑ͍ʯίϛοτͰ͋ͬͨɽఏҊख๏͸ɼ͜ͷΑ͏ͳҙਤ͕ࠞࡏͨ͠ίϛοτΛચ͍ग़͢໨తͰ΋ར༻Ͱ͖ΔՄೳੑ͕͋Δɽ

21

7

ଥ౰ੑ΁ͷ‫ڴ‬ҖຊষͰɼධՁ࣮‫·ؚʹݧ‬ΕΔଥ౰ੑ΁ͷ‫ڴ‬Җʹ͍ͭͯड़΂Δɽຊ‫ݧ࣮ͨͬߦͰڀݚ‬͸ɼ2 ͭͷϓϩδΣΫτͷΈΛ୊ࡐͱͨ͠ɽଞͷϓϩδΣΫτʹରͯ͠ߦͬͨ৔߹ʹ͸ɼҟͳΔ݁Ռ͕ಘΒΕΔՄೳੑ͕͋Δɽ·ͨɼ࣮‫Ͱݧ‬͸ Java ϓϩάϥϜ͕มߋͯ͋͠Δશίϛοτʹରͯ͠ MJgit Λ࣮ߦͨ݁͠ՌΛऩू͕ͨ͠ɼͦΕͧΕͷίϛοτʹର͠ɼଌఆ͍߲ͨ͠໨ΛҰ౓͔࣮ͣͭ͠ߦ͍͓ͯ͠Βͣɼ‫܁‬Γฦ͠ͷͳ͍σʔλͱͳΔɽ࣮ߦ଎౓ͷΑ͏ͳϊΠζ͕Ө‫͢ڹ‬ΔཁҼʹରͯ͠͸ɼ࣮‫ݧ‬ͷ‫܁‬Γฦ͠ʹΑΓͦΕΒͷมಈཁҼΛআ֎͢Δඞཁ͕͋Δɽ࣮‫݁ݧ‬Ռͱͯ͠ߦ਺ͷ‫ݮ‬গ͸֬ೝͰ͖͕ͨɼͦΕ͕ඞͣ͠΋༗༻ੑʹ‫͕ܨ‬Δͱ͸‫ݶ‬Βͳ͍ɽ͜Ε͸ɼ։ൃऀʹର͢Δඃ‫ݧ࣮ऀݧ‬Λߦ͏͜ͱͰ༗༻ੑʹؔ͢ΔධՁ͕ಘΒΕΔͱߟ͑ΒΕΔɽຊ࣮‫Ͱݧ‬͸ɼίϯςΩετΛ੍‫ͨ͠ݶ‬ΓɼιʔείʔυΛ Java ʹ‫ݶ‬ఆ͢ΔͳͲɼ੍‫ݶ‬ͷ͋ΔϓϩτλΠϓͰͷ࣮‫͕ͨͬ͋Ͱݧ‬ɼίϯςΩετͷछྨΛ૿΍͢ɼෳ਺બ୒ΛՄೳʹ͢ΔɼJava Ҏ֎ͷιʔείʔυʹ΋ରԠͤ͞ΔͳͲ࣮ͯ͠‫ݧ‬Λߦ͑͹ɼఏҊख๏ʹ͍ͭͯͷΑΓৄࡉͳධՁΛಘΔ͜ͱ͕Ͱ͖Δͱߟ
͑ΒΕΔɽ

22

8

͋ͱ͕͖
ຊ‫Ͱڀݚ‬͸ɼ൛؅ཧγεςϜʹ͓͍ͯཤྺ৘ใΛऔಘ͢Δʹ͋ͨΓɼͦͷ৘ใΛίϯςΩετʹ

ΑͬͯߜΓࠐΉ֦ு‫ػ‬ೳΛఏҊͨ͠ɽ͜ΕʹΑΓɼϢʔβʔ͸‫ݟ‬Δඞཁ͕ͳ͍৘ใΛߜΓࠐΊɼຊ౰ʹཉ͍͠৘ใΛऔಘ͢Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΓɼ࡞‫཰ޮۀ‬ͷ޲্͕‫ظ‬଴Ͱ͖ΔɽఏҊख๏ͷ༗༻ੑΛ֬ೝ͢ΔͨΊʹɼJGit Λ֦ுͨ͠ϓϩτλΠϓΛ࣮૷ͨ͠ɽ·ͨɼධՁ࣮‫ݧ‬Λߦ͍ɼϓϩτλΠϓ
ʹΑͬͯ௿Լ͢Δ࣮ߦ͕࣮࣌ؒ༻ൣғ಺Ͱ͋Δ͜ͱͱɼग़ྗߦ਺͕‫ݮ‬গ͍ͯ͠Δɼͭ·Γɼ৘ใ͕ߜ
ΓࠐΊ͍ͯΔ͜ͱΛ֬ೝͰ͖ͨɽ
ࠓ‫ޙ‬ͷ՝୊ͱͯ͠ɼϓϩτλΠϓͷվมͱɼඃ‫ݧ࣮ऀݧ‬Λߦ͏͜ͱΛߟ͍͑ͯΔɽຊ‫͠૷࣮Ͱڀݚ‬ͨϓϩτλΠϓͰ͸ɼࢦఆͰ͖ΔίϯςΩετ͕‫ݶ‬ఆ͞Ε͍ͯΔɼίϯςΩετͷෳ਺બ୒͕Ͱ͖ͳ
͍ɼͳͲͷ੍‫͕ݶ‬ଟ͍ɽͦ͜ͰɼϓϩτλΠϓΛվม͠ɼఏҊख๏ͷ༷ʑͳ໘Ͱͷ༗༻ੑΛ͍͖͍ࣔͯͨ͠ͱߟ͍͑ͯΔɽ·ͨɼຊ‫Ͱڀݚ‬͸ఆྔతͳ࣮‫ݧ‬ͷΈΛߦͬͨͷͰɼ֬ೝͰ͖ͨ༗༻ੑ͸͋͘·Ͱ਺஋తͳ΋ͷͰ͔͠ͳ͍ɽྫ͑͹ɼग़ྗߦ਺ͷ‫ݮ‬গ͕֬ೝͰ͖͕ͨɼͦͷ‫ݮ‬গ͕ͦͷ··༗༻ੑʹ‫͍͕ͯͬܨ‬Δͱ͸அ‫͍ͳ͖Ͱݴ‬ɽͦ͜Ͱɼ࣮ࡍʹ։ൃऀʹ࢖༻ͯ͠΋Β͏͜ͱͰ‫ʹ࣮ݱ‬ଈͨ͠ධՁΛߦ͍͍ͨͱߟ͍͑ͯΔɽ23ँࣙຊ‫ڀݚ‬Λߦ͏ʹ͋ͨͬͯɼཧղ͋Δ͝ࢦಋΛ͍͖ͯͨͩ͠ɼྭ·ͯ͠௖͖·ͨ͠ೇຊਅೋ‫ڭ‬तʹ৺ΑΓ‫ँײ‬ਃ্͛͠·͢ɽຊ‫ͯؔ͠ʹڀݚ‬ɼత֬ͳ͝ॿ‫ͱݴ‬ɼϓϩτλΠϓ MJgit ͷ໊લͷΞΠσΟΞΛ௖͖·ͨ͠ɼං‫ޙ‬๕थ।‫ڭ‬तʹਂ͘‫ँײ‬ਃ্͛͠·͢ɽຊ‫ڀݚ‬ͷશաఔΛ௨͠ɼऴ࢝೤৺͔ͭஸೡͳ͝ࢦಋΛ௖͖ɼԿ౓΋૬ஊʹ৐͍͖ͬͯͨͩ·ͨ͠ɼ㤟ຊਅ༎ॿ‫ँײ͘ਂʹڭ‬ਃ্͛͠·͢ɽຊ‫ڀݚ‬ΛਐΊΔʹ͋ͨΓɼ࣮‫߲ݧ‬໨ʹ͍ͭͯ༗ҙٛͳఏҊΛ௖͖·ͨ͠େࡕେֶେֶӃ৘ใՊֶ‫ݚ‬‫ڀ‬ՊίϯϐϡʔλαΠΤϯεઐ߈ത࢜લ‫ظ‬՝ఔ 2 ೥ͷখ૔௚ెࢯʹ৺ΑΓ‫ँײ‬க͠·͢ɽຊ‫ڀݚ‬ΛਐΊΔʹ͋ͨΓɼMJgit ͷ࣮૷‫ڥ؀‬Λ੔͑ΔࡍʹଟେͳΔ͝ॿྗΛ௖͖·ͨ͠େࡕେֶ‫ج‬ૅ޻ֶ෦৘ใՊֶՊ 4 ೥ͷ༗അྒ‫ʹ܅‬৺ΑΓ‫ँײ‬ਃ্͛͠·͢ɽຊ࿦จΛॻ͖ਐΊΔʹ͋ͨΓɼtex ͷ࢖͍ํΛৄ͘͠‫ͯ͑ڭ‬௖͖·ͨ͠େࡕେֶ‫ֶ޻ૅج‬෦৘ใՊֶՊ 4 ೥ͷদඌ༟޾‫ʹ܅‬৺ΑΓ‫ँײ‬ਃ্͛͠·͢ɽຊ‫ڀݚ‬ΛਐΊΔʹ͋ͨΓɼྭ·͠ɼ͝ॿ‫ݴ‬Λ௖͖·ͨ͠ೇຊ‫ࣨڀݚ‬ͷօ༷ͷ͝‫ʹྗڠ‬৺ΑΓ‫ँײ‬க͠·͢ɽ࠷‫ʹޙ‬ɼຊ‫ࢸʹڀݚ‬Δ·Ͱʹɼत‫ੈ͓Ͱۀ‬࿩ʹͳΓ·ͨ͠େࡕେֶ‫ֶ޻ૅج‬෦৘ใՊֶՊͷઌੜํʹɼ͜ͷ৔ΛआΓͯ৺͔Β‫ྱޚ‬ਃ্͛͠·͢ɽ24ࢀߟจ‫ݙ‬[1] Brian De Alwis and Jonathan Sillito. Why are software projects moving from centralized to decentralized version control systems? In Proc. Works. Cooperative and Human Aspects on Softw. Eng.,
pp. 36–39, 2009.
[2] ෱҆௚थ, ٢ాರ. ϓϩάϥϜͷߏจཁૉʹ‫ͮ͘ج‬൛؅ཧγεςϜͷͨΊͷࠩ෼औಘख๏. ిࢠ৘ใ௨৴ֶձٕज़‫ڀݚ‬ใࠂ. SS, ιϑτ΢ΣΞαΠΤϯε, Vol. 105, No. 490, pp. 43–48, 2005.

[3] େ৿ོߦ, ‫ࢁؙ‬উ‫ٱ‬. ։ൃऀʹΑΔฤूૢ࡞ʹ‫ͮ͘ج‬ιʔείʔυมߋநग़. ৘ใॲཧֶձ࿦จ
ࢽ, Vol. 49, No. 7, pp. 2349–2359, 2008.

[4] ୩फҰ࿠, ্໺ल߶. ίϯςΩετͷਪఆʹΑΔ։ൃࢧԉγεςϜؒͷ৘ใ౷߹. Technical
Report 9, ಸྑ޻‫ߴۀ‬౳ઐ໳ֶߍ, ಸྑ޻‫ߴۀ‬౳ઐ໳ֶߍ, 2010.
[5] ඌ࡚‫޾ݑ‬, ٢ాರ, ࢁຊ৾Ұ࿠, Ѩ૲ਗ਼࣎. ϓϩάϥϜͷਖ਼‫ن‬Խʹ‫͍ࠩͨͮج‬෼நग़๏ͷఏҊ. ৘ใॲཧֶձ‫ڀݚ‬ใࠂιϑτ΢ΣΞ޻ֶʢSEʣ, Vol. 1999, No. 37, pp. 25–32, 1999.

[6] ٢ాರ, ࢁຊ৾Ұ࿠, Ѩ૲ਗ਼࣎. ґଘؔ܎ʹ‫ࠩͮ͘ج‬෼நग़πʔϧ. ిࢠ৘ใ௨৴ֶձٕज़‫ڀݚ‬ใࠂ. SS, ιϑτ΢ΣΞαΠΤϯε, Vol. 95, No. 53, pp. 53–60, 1995.

[7] Takayuki Omori and Katsuhisa Maruyama. A change-aware development environment by recording
editing operations of source code. In Proceedings of the 2008 International Working Conference on
Mining Software Repositories, MSR ’08, pp. 31–34, 2008.
[8] େ৿ོߦ, ‫ࢁؙ‬উ‫ٱ‬. ௥੻ੑΛߟྀͨ͠ιʔείʔυมߋͷநग़. ৘ใॲཧֶձ‫ڀݚ‬ใࠂιϑτ΢ΣΞ޻ֶʢSEʣ, Vol. 2007, No. 33, pp. 159–166, 2007.

[9] Huzefa Kagdi, Michael L. Collard, and Jonathan I. Maletic. A survey and taxonomy of approaches
for mining software repositories in the context of software evolution. J. Softw. Maint. Evol., Vol. 19,
No. 2, pp. 77–131, 2007.
[10] Raimund Moser, Witold Pedrycz, and Giancarlo Succi. A comparative analysis of the efficiency ofchange metrics and static code attributes for defect prediction. In Proc. Int’l Conf. Softw. Eng., ICSE,
pp. 181–190, 2008.
[11] Hirohisa Aman, Sousuke Amasaki, Takashi Sasaki, and Minoru Kawahara. Lines of comments as a
noteworthy metric for analyzing fault-proneness in methods. IEICE Transactions on Information and
Systems, Vol. E98.D, No. 12, pp. 2218–2228, 2015.

25

[12] Vinayak Sinha, Alina Lazar, and Bonita Sharif. Analyzing developer sentiment in commit logs. In
Proceedings of the 13th International Conference on Mining Software Repositories, MSR, pp. 520–
523, 2016.
[13] JUnit4. http://junit.org/junit4/.
[14] Log4j. http://jakarta.apache.org/.
[15] Giulio Concas, Michele Marchesi, Alessandro Murgia, Roberto Tonelli, and Ivana Turnu. On the
distribution of bugs in the eclipse system. IEEE Trans. Softw. Eng., Vol. 37, No. 6, pp. 872–877,
2011.
[16] Carina Andersson and Per Runeson. A replicated quantitative analysis of fault distributions in complex software systems. IEEE Trans. Softw. Eng., Vol. 33, No. 5, pp. 273–286, 2007.
[17] Elaine J. Weyuker, Thomas J. Ostrand, and Robert M. Bell. Do too many cooks spoil the broth? using
the number of developers to enhance defect prediction models. Empirical Softw. Engg., Vol. 13, No. 5,
pp. 539–559, 2008.
[18] Shinsuke Matsumoto, Yasutaka Kamei, Akito Monden, Ken-ichi Matsumoto, and Masahide Nakamura. An analysis of developer metrics for fault prediction. In Proceedings of the 6th International
Conference on Predictive Models in Software Engineering, PROMISE, pp. 18:1–18:9, 2010.
[19] JGit. https://eclipse.org/jgit/.
[20] Hiroyuki Kirinuki, Yoshiki Higo, Keisuke Hotta, and Shinji Kusumoto. Hey! are you committing
tangled changes? In Proceedings of the 22Nd International Conference on Program Comprehension,
ICPC, pp. 262–265, 2014.

26