aboutsummaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-11-05 13:22:34 -0800
committerJunio C Hamano <gitster@pobox.com>2007-11-05 18:19:28 -0800
commit53b2c823f6e862e0c83a4a25bab43e8c32e9c289 (patch)
treefef43cbdbaccd2ff8e7e7795de5722846bf03bd0 /commit.h
parent252a7c02354a3e2825cfde3c5053a04acc07be9c (diff)
downloadgit-53b2c823f6e862e0c83a4a25bab43e8c32e9c289.tar.gz
git-53b2c823f6e862e0c83a4a25bab43e8c32e9c289.tar.xz
revision walker: mini clean-up
This removes the unnecessary indirection of "revs->prune_fn", since that function is always the same one (or NULL), and there is in fact not even an abstraction reason to make it a function (i.e. its not called from some other file and doesn't allow us to keep the function itself static or anything like that). It then just replaces it with a bit that says "prune or not", and if not pruning, every commit gets TREECHANGE. That in turn means that - if (!revs->prune_fn || (flags & TREECHANGE)) - if (revs->prune_fn && !(flags & TREECHANGE)) just become - if (flags & TREECHANGE) - if (!(flags & TREECHANGE)) respectively. Together with adding the "single_parent()" helper function, the "complex" conditional now becomes if (!(flags & TREECHANGE) && rev->dense && single_parent(commit)) continue; Also indirection of "revs->dense" checking is thrown away the same way, because TREECHANGE bit is set appropriately now. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r--commit.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/commit.h b/commit.h
index 4ed0c1cf7..aa679867a 100644
--- a/commit.h
+++ b/commit.h
@@ -117,4 +117,9 @@ extern int interactive_add(void);
extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
extern int rerere(void);
+static inline int single_parent(struct commit *commit)
+{
+ return commit->parents && !commit->parents->next;
+}
+
#endif /* COMMIT_H */