Skip to content

Commit

Permalink
Merge branch 'jc/diff-files-ita'
Browse files Browse the repository at this point in the history
Code cleanup.

* jc/diff-files-ita:
  run_diff_files(): clarify computation of sha1 validity
  • Loading branch information
Junio C Hamano committed Feb 22, 2015
2 parents 070f6fe + 0b86fe8 commit dcc883d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions diff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
struct cache_entry *ce = active_cache[i];
int changed;
unsigned dirty_submodule = 0;
const unsigned char *old_sha1, *new_sha1;

if (diff_can_quit_early(&revs->diffopt))
break;
Expand Down Expand Up @@ -224,9 +225,12 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
oldmode = ce->ce_mode;
old_sha1 = ce->sha1;
new_sha1 = changed ? null_sha1 : ce->sha1;
diff_change(&revs->diffopt, oldmode, newmode,
ce->sha1, (changed ? null_sha1 : ce->sha1),
!is_null_sha1(ce->sha1), (changed ? 0 : !is_null_sha1(ce->sha1)),
old_sha1, new_sha1,
!is_null_sha1(old_sha1),
!is_null_sha1(new_sha1),
ce->name, 0, dirty_submodule);

}
Expand Down

0 comments on commit dcc883d

Please sign in to comment.