Clean up and simplify rev_compare_tree()
This simplifies the logic of rev_compare_tree() by removing a special case. It does so by turning the special case of finding a diff to be "all new files" into a more generic case of "all new" vs "all removed" vs "mixed changes", so now the code is actually more powerful and more generic, and the added symmetry actually makes it simpler too. This makes no changes to any existing behavior, but apart from the simplification it does make it possible to some day care about whether all changes were just deletions if we want to. Which we may well want to for merge handling. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
433e972aeb
commit
ceff8e7ade
@ -118,8 +118,9 @@ struct rev_info {
|
||||
};
|
||||
|
||||
#define REV_TREE_SAME 0
|
||||
#define REV_TREE_NEW 1
|
||||
#define REV_TREE_DIFFERENT 2
|
||||
#define REV_TREE_NEW 1 /* Only new files */
|
||||
#define REV_TREE_OLD 2 /* Only files removed */
|
||||
#define REV_TREE_DIFFERENT 3 /* Mixed changes */
|
||||
|
||||
/* revision.c */
|
||||
void read_revisions_from_stdin(struct rev_info *revs);
|
||||
|
Reference in New Issue
Block a user