From: Junio C Hamano Date: Thu, 04 Aug 2016 19:47:24 GMT Subject: Re: [PATCH 8/8] diff: improve positioning of add/delete blocks in diffs Message-ID: In-Reply-To: Stefan Beller writes: > I have just reread the scoring function and I think you could pull out the > `score=indent` assignment (it is always assigned except for indent <0) > > if (indent == -1) > score = 0; > else > score = indent; > ... lots of bonus computation below, which in its current implementation > have lots of "score = indent;" lines as well. Yup. If each part in this if/else if/... cascade independently sets complete information (i.e. both "bonus" and "score") necessary for the final result, then I do not mind the same "score = indent" in many of them (these case happen to get the same score), but that is not what we have in this code (i.e. "bonus" has a shared component that is not affected by thie if/else if/ cascade), so setting score to indent upfront and reset it to 0 only on a blank line would make sense.