2

when use diffStat or git diff to analyze the code,it often shows the result below,

71 files changed, 10938 insertions(+), 947 deletions(-), 3103 modifications(!), 3027 unchanged lines(=) but I do not know what the insertions and deletions mean?

  • does it mean the increased or deleted line count?

  • How those insertions/deletion numbers are calculated ?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
HaiBin
  • 43
  • 7
  • The question is not a duplicate. It is about how those numbers are calculated, which I attempt to explore in my answer below. – VonC Jun 14 '16 at 11:09
  • yes,i also want to konw how those are calculated,maybe I need to modify my title – HaiBin Jun 14 '16 at 11:15

2 Answers2

3

If you add a new line, it's 1 insertion. If you delete a line, it's 1 deletion. If you modify one line, it's 1 deletion and 1 insertion.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
1

You can see that message printed in diff.c#print_stat_summary()

Those numbers are computed in diff.c#show_stats(), where the numbers of lines added or deleted are tallied.

The actual computation for a given place is in diff.c#builtin_diffstat (which calls diff.c#diff_populate_filespec() if one of the files is a binary).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250