From 50fea42ef5202673c80600555f1308a9b3150471 Mon Sep 17 00:00:00 2001 From: Alexander Kuleshov Date: Fri, 9 Jan 2015 16:12:33 +0600 Subject: [PATCH 1/2] git.c: remove unnecessary #includes "cache.h" and "commit.h" are already included via "builtin.h". We started to include "quote.h" at 575ba9d6 (GIT_TRACE: show which built-in/external commands are executed, 2006-06-25) that wanted to use sq_quote_print(). When 6ce4e61f (Trace into a file or an open fd and refactor tracing code., 2006-09-02) introduced trace.c API, the calls this file makes to sq_quote_print() were replaced by calls to trace_argv_printf() that are declared in "cache.h", which this file already includes. We should have stopped including "quote.h" in that commit, but forgot to do so. Signed-off-by: Alexander Kuleshov Signed-off-by: Junio C Hamano --- git.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/git.c b/git.c index 18fbf7943..a7d170c98 100644 --- a/git.c +++ b/git.c @@ -1,10 +1,7 @@ #include "builtin.h" -#include "cache.h" #include "exec_cmd.h" #include "help.h" -#include "quote.h" #include "run-command.h" -#include "commit.h" const char git_usage_string[] = "git [--version] [--help] [-C ] [-c name=value]\n" From 10aff315f60847b9d155fce3134593b534b2ea5d Mon Sep 17 00:00:00 2001 From: Alexander Kuleshov Date: Fri, 9 Jan 2015 00:56:06 +0600 Subject: [PATCH 2/2] cat-file: remove unused includes - "exec_cmd.h" became unnecessary at b931aa5a (Call builtin ls-tree in git-cat-file -p, 2006-05-26), when it changed an earlier code that delegated tree display to "ls-tree" via the run_command() API (hence needing "exec_cmd.h") to call cmd_ls_tree() directly. We should have removed the include in the same commit, but we forgot to do so. - "diff.h" was added at e5fba602 (textconv: support for cat_file, 2010-06-15), together with "userdiff.h", but "userdiff.h" can be included without including "diff.h"; the header was unnecessary from the beginning. - "tag.h" and "tree.h" were necessary since 8e440259 (Use blob_, commit_, tag_, and tree_type throughout., 2006-04-02) to check the type of object by comparing typename with tree_type and tag_type (pointers to extern strings). 21666f1a (convert object type handling from a string to a number, 2007-02-26) made these _type strings unnecessary, and it could have switched to include "object.h", which is necessary to use typename(), but it forgot to do so. Because "tag.h" and "tree.h" include "object.h", it did not need to explicitly include "object.h" in order to start using typename() itself. We do not even have to include "object.h" after removing these two #includes, because "builtin.h" includes "commit.h" which in turn includes "object.h" these days. This happened at 7b9c0a69 (git-commit-tree: make it usable from other builtins, 2008-07-01). Signed-off-by: Alexander Kuleshov Signed-off-by: Junio C Hamano --- builtin/cat-file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/builtin/cat-file.c b/builtin/cat-file.c index f8d81291b..750b5a24b 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -4,12 +4,8 @@ * Copyright (C) Linus Torvalds, 2005 */ #include "cache.h" -#include "exec_cmd.h" -#include "tag.h" -#include "tree.h" #include "builtin.h" #include "parse-options.h" -#include "diff.h" #include "userdiff.h" #include "streaming.h"