Merge branch 'en/header-split-cache-h'

Header clean-up.

* en/header-split-cache-h: (24 commits)
  protocol.h: move definition of DEFAULT_GIT_PORT from cache.h
  mailmap, quote: move declarations of global vars to correct unit
  treewide: reduce includes of cache.h in other headers
  treewide: remove double forward declaration of read_in_full
  cache.h: remove unnecessary includes
  treewide: remove cache.h inclusion due to pager.h changes
  pager.h: move declarations for pager.c functions from cache.h
  treewide: remove cache.h inclusion due to editor.h changes
  editor: move editor-related functions and declarations into common file
  treewide: remove cache.h inclusion due to object.h changes
  object.h: move some inline functions and defines from cache.h
  treewide: remove cache.h inclusion due to object-file.h changes
  object-file.h: move declarations for object-file.c functions from cache.h
  treewide: remove cache.h inclusion due to git-zlib changes
  git-zlib: move declarations for git-zlib functions from cache.h
  treewide: remove cache.h inclusion due to object-name.h changes
  object-name.h: move declarations for object-name.c functions from cache.h
  treewide: remove unnecessary cache.h inclusion
  treewide: be explicit about dependence on mem-pool.h
  treewide: be explicit about dependence on oid-array.h
  ...
This commit is contained in:
Junio C Hamano 2023-04-25 13:56:19 -07:00
commit 0807e57807
217 changed files with 827 additions and 479 deletions

View File

@ -1032,6 +1032,7 @@ LIB_OBJS += fsmonitor.o
LIB_OBJS += fsmonitor-ipc.o LIB_OBJS += fsmonitor-ipc.o
LIB_OBJS += fsmonitor-settings.o LIB_OBJS += fsmonitor-settings.o
LIB_OBJS += gettext.o LIB_OBJS += gettext.o
LIB_OBJS += git-zlib.o
LIB_OBJS += gpg-interface.o LIB_OBJS += gpg-interface.o
LIB_OBJS += graph.o LIB_OBJS += graph.o
LIB_OBJS += grep.o LIB_OBJS += grep.o
@ -1192,7 +1193,6 @@ LIB_OBJS += write-or-die.o
LIB_OBJS += ws.o LIB_OBJS += ws.o
LIB_OBJS += wt-status.o LIB_OBJS += wt-status.o
LIB_OBJS += xdiff-interface.o LIB_OBJS += xdiff-interface.o
LIB_OBJS += zlib.o
BUILTIN_OBJS += builtin/add.o BUILTIN_OBJS += builtin/add.o
BUILTIN_OBJS += builtin/am.o BUILTIN_OBJS += builtin/am.o

View File

@ -1,8 +1,11 @@
#include "cache.h" #include "cache.h"
#include "add-interactive.h" #include "add-interactive.h"
#include "advice.h"
#include "alloc.h" #include "alloc.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "object-name.h"
#include "strbuf.h" #include "strbuf.h"
#include "run-command.h" #include "run-command.h"
#include "strvec.h" #include "strvec.h"

View File

@ -22,6 +22,8 @@
#include "xdiff-interface.h" #include "xdiff-interface.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "lockfile.h" #include "lockfile.h"
#include "object-name.h"
#include "object-file.h"
#include "parse-options.h" #include "parse-options.h"
#include "quote.h" #include "quote.h"
#include "rerere.h" #include "rerere.h"

View File

@ -5,6 +5,7 @@
#include "alloc.h" #include "alloc.h"
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "git-zlib.h"
#include "hex.h" #include "hex.h"
#include "tar.h" #include "tar.h"
#include "archive.h" #include "archive.h"

View File

@ -5,6 +5,7 @@
#include "config.h" #include "config.h"
#include "archive.h" #include "archive.h"
#include "gettext.h" #include "gettext.h"
#include "git-zlib.h"
#include "hex.h" #include "hex.h"
#include "streaming.h" #include "streaming.h"
#include "utf8.h" #include "utf8.h"

View File

@ -2,6 +2,7 @@
#include "abspath.h" #include "abspath.h"
#include "alloc.h" #include "alloc.h"
#include "config.h" #include "config.h"
#include "convert.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"

View File

@ -1,8 +1,9 @@
#ifndef ARCHIVE_H #ifndef ARCHIVE_H
#define ARCHIVE_H #define ARCHIVE_H
#include "cache.h" #include "object-name.h"
#include "pathspec.h" #include "pathspec.h"
#include "string-list.h"
struct repository; struct repository;
struct pretty_print_context; struct pretty_print_context;

View File

@ -1,4 +1,4 @@
#include "cache.h" #include "git-compat-util.h"
#include "config.h" #include "config.h"
#include "commit.h" #include "commit.h"
#include "diff.h" #include "diff.h"
@ -17,6 +17,7 @@
#include "strvec.h" #include "strvec.h"
#include "commit-slab.h" #include "commit-slab.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "dir.h" #include "dir.h"

View File

@ -3,12 +3,14 @@
#include "object-store.h" #include "object-store.h"
#include "cache-tree.h" #include "cache-tree.h"
#include "mergesort.h" #include "mergesort.h"
#include "convert.h"
#include "diff.h" #include "diff.h"
#include "diffcore.h" #include "diffcore.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "setup.h" #include "setup.h"
#include "tag.h" #include "tag.h"
#include "trace2.h"
#include "blame.h" #include "blame.h"
#include "alloc.h" #include "alloc.h"
#include "commit-slab.h" #include "commit-slab.h"

View File

@ -1,10 +1,11 @@
#include "git-compat-util.h" #include "git-compat-util.h"
#include "cache.h" #include "advice.h"
#include "config.h" #include "config.h"
#include "branch.h" #include "branch.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "refs.h" #include "refs.h"
#include "refspec.h" #include "refspec.h"
#include "remote.h" #include "remote.h"

View File

@ -5,9 +5,11 @@
*/ */
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "lockfile.h" #include "lockfile.h"
#include "editor.h"
#include "dir.h" #include "dir.h"
#include "gettext.h" #include "gettext.h"
#include "pathspec.h" #include "pathspec.h"

View File

@ -6,8 +6,10 @@
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "cache.h" #include "cache.h"
#include "abspath.h" #include "abspath.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "gettext.h" #include "gettext.h"
@ -26,6 +28,7 @@
#include "diffcore.h" #include "diffcore.h"
#include "unpack-trees.h" #include "unpack-trees.h"
#include "branch.h" #include "branch.h"
#include "object-name.h"
#include "sequencer.h" #include "sequencer.h"
#include "revision.h" #include "revision.h"
#include "merge-recursive.h" #include "merge-recursive.h"
@ -37,6 +40,7 @@
#include "apply.h" #include "apply.h"
#include "string-list.h" #include "string-list.h"
#include "packfile.h" #include "packfile.h"
#include "pager.h"
#include "repository.h" #include "repository.h"
#include "pretty.h" #include "pretty.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -3,12 +3,14 @@
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "bisect.h" #include "bisect.h"
#include "refs.h" #include "refs.h"
#include "dir.h" #include "dir.h"
#include "strvec.h" #include "strvec.h"
#include "run-command.h" #include "run-command.h"
#include "oid-array.h"
#include "prompt.h" #include "prompt.h"
#include "quote.h" #include "quote.h"
#include "revision.h" #include "revision.h"

View File

@ -28,7 +28,9 @@
#include "line-log.h" #include "line-log.h"
#include "dir.h" #include "dir.h"
#include "progress.h" #include "progress.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "pager.h"
#include "blame.h" #include "blame.h"
#include "refs.h" #include "refs.h"
#include "setup.h" #include "setup.h"

View File

@ -8,11 +8,13 @@
#include "cache.h" #include "cache.h"
#include "config.h" #include "config.h"
#include "color.h" #include "color.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "refs.h" #include "refs.h"
#include "commit.h" #include "commit.h"
#include "builtin.h" #include "builtin.h"
#include "gettext.h" #include "gettext.h"
#include "object-name.h"
#include "remote.h" #include "remote.h"
#include "parse-options.h" #include "parse-options.h"
#include "branch.h" #include "branch.h"

View File

@ -1,5 +1,6 @@
#include "builtin.h" #include "builtin.h"
#include "abspath.h" #include "abspath.h"
#include "editor.h"
#include "gettext.h" #include "gettext.h"
#include "parse-options.h" #include "parse-options.h"
#include "strbuf.h" #include "strbuf.h"
@ -8,6 +9,7 @@
#include "hook.h" #include "hook.h"
#include "hook-list.h" #include "hook-list.h"
#include "diagnose.h" #include "diagnose.h"
#include "object-file.h"
#include "setup.h" #include "setup.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -7,6 +7,7 @@
#include "cache.h" #include "cache.h"
#include "alloc.h" #include "alloc.h"
#include "config.h" #include "config.h"
#include "convert.h"
#include "builtin.h" #include "builtin.h"
#include "diff.h" #include "diff.h"
#include "environment.h" #include "environment.h"
@ -19,6 +20,8 @@
#include "tree-walk.h" #include "tree-walk.h"
#include "oid-array.h" #include "oid-array.h"
#include "packfile.h" #include "packfile.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "promisor-remote.h" #include "promisor-remote.h"

View File

@ -5,6 +5,7 @@
#include "attr.h" #include "attr.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "object-name.h"
#include "quote.h" #include "quote.h"
#include "setup.h" #include "setup.h"
#include "parse-options.h" #include "parse-options.h"

View File

@ -15,7 +15,9 @@
#include "hook.h" #include "hook.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "lockfile.h" #include "lockfile.h"
#include "mem-pool.h"
#include "merge-recursive.h" #include "merge-recursive.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "parse-options.h" #include "parse-options.h"
#include "refs.h" #include "refs.h"
@ -26,6 +28,7 @@
#include "setup.h" #include "setup.h"
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "trace2.h"
#include "tree.h" #include "tree.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "unpack-trees.h" #include "unpack-trees.h"

View File

@ -11,6 +11,7 @@
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "builtin.h" #include "builtin.h"
#include "abspath.h" #include "abspath.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
@ -20,6 +21,7 @@
#include "fetch-pack.h" #include "fetch-pack.h"
#include "refs.h" #include "refs.h"
#include "refspec.h" #include "refspec.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "tree.h" #include "tree.h"
#include "tree-walk.h" #include "tree-walk.h"
@ -40,6 +42,7 @@
#include "hook.h" #include "hook.h"
#include "bundle.h" #include "bundle.h"
#include "bundle-uri.h" #include "bundle-uri.h"
#include "wrapper.h"
/* /*
* Overall FIXMEs: * Overall FIXMEs:

View File

@ -12,6 +12,7 @@
#include "progress.h" #include "progress.h"
#include "replace-object.h" #include "replace-object.h"
#include "tag.h" #include "tag.h"
#include "trace2.h"
#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \ #define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]") N_("git commit-graph verify [--object-dir <dir>] [--shallow] [--[no-]progress]")

View File

@ -7,6 +7,7 @@
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "repository.h" #include "repository.h"
#include "commit.h" #include "commit.h"

View File

@ -7,11 +7,13 @@
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "lockfile.h" #include "lockfile.h"
#include "cache-tree.h" #include "cache-tree.h"
#include "color.h" #include "color.h"
#include "dir.h" #include "dir.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "builtin.h" #include "builtin.h"
#include "diff.h" #include "diff.h"
@ -26,6 +28,7 @@
#include "log-tree.h" #include "log-tree.h"
#include "strbuf.h" #include "strbuf.h"
#include "utf8.h" #include "utf8.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "string-list.h" #include "string-list.h"
#include "rerere.h" #include "rerere.h"

View File

@ -3,6 +3,7 @@
#include "alloc.h" #include "alloc.h"
#include "config.h" #include "config.h"
#include "color.h" #include "color.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "ident.h" #include "ident.h"

View File

@ -2,6 +2,7 @@
#include "abspath.h" #include "abspath.h"
#include "alloc.h" #include "alloc.h"
#include "gettext.h" #include "gettext.h"
#include "object-file.h"
#include "parse-options.h" #include "parse-options.h"
#ifndef NO_UNIX_SOCKETS #ifndef NO_UNIX_SOCKETS

View File

@ -11,6 +11,7 @@
#include "refs.h" #include "refs.h"
#include "builtin.h" #include "builtin.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "revision.h" #include "revision.h"
#include "diff.h" #include "diff.h"

View File

@ -1,6 +1,7 @@
#include "builtin.h" #include "builtin.h"
#include "abspath.h" #include "abspath.h"
#include "gettext.h" #include "gettext.h"
#include "object-file.h"
#include "parse-options.h" #include "parse-options.h"
#include "diagnose.h" #include "diagnose.h"

View File

@ -25,6 +25,7 @@
#include "strvec.h" #include "strvec.h"
#include "strbuf.h" #include "strbuf.h"
#include "lockfile.h" #include "lockfile.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "dir.h" #include "dir.h"
#include "entry.h" #include "entry.h"

View File

@ -10,6 +10,7 @@
#include "hex.h" #include "hex.h"
#include "refs.h" #include "refs.h"
#include "refspec.h" #include "refspec.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "commit.h" #include "commit.h"
#include "object.h" #include "object.h"

View File

@ -19,6 +19,8 @@
#include "dir.h" #include "dir.h"
#include "run-command.h" #include "run-command.h"
#include "packfile.h" #include "packfile.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "mem-pool.h" #include "mem-pool.h"
#include "commit-reach.h" #include "commit-reach.h"

View File

@ -2,6 +2,7 @@
#include "alloc.h" #include "alloc.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-file.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "fetch-pack.h" #include "fetch-pack.h"
#include "remote.h" #include "remote.h"

View File

@ -2,6 +2,7 @@
* "git fetch" * "git fetch"
*/ */
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "environment.h" #include "environment.h"
@ -9,8 +10,10 @@
#include "repository.h" #include "repository.h"
#include "refs.h" #include "refs.h"
#include "refspec.h" #include "refspec.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "oidset.h" #include "oidset.h"
#include "oid-array.h"
#include "commit.h" #include "commit.h"
#include "builtin.h" #include "builtin.h"
#include "string-list.h" #include "string-list.h"
@ -25,12 +28,15 @@
#include "strvec.h" #include "strvec.h"
#include "utf8.h" #include "utf8.h"
#include "packfile.h" #include "packfile.h"
#include "pager.h"
#include "list-objects-filter-options.h" #include "list-objects-filter-options.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "branch.h" #include "branch.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "shallow.h" #include "shallow.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h" #include "worktree.h"
#include "bundle-uri.h" #include "bundle-uri.h"

View File

@ -19,6 +19,8 @@
#include "streaming.h" #include "streaming.h"
#include "decorate.h" #include "decorate.h"
#include "packfile.h" #include "packfile.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "resolve-undo.h" #include "resolve-undo.h"

View File

@ -14,6 +14,7 @@
#include "simple-ipc.h" #include "simple-ipc.h"
#include "khash.h" #include "khash.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "trace2.h"
static const char * const builtin_fsmonitor__daemon_usage[] = { static const char * const builtin_fsmonitor__daemon_usage[] = {
N_("git fsmonitor--daemon start [<options>]"), N_("git fsmonitor--daemon start [<options>]"),

View File

@ -25,6 +25,7 @@
#include "commit.h" #include "commit.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "packfile.h" #include "packfile.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "pack.h" #include "pack.h"
#include "pack-objects.h" #include "pack-objects.h"
@ -37,6 +38,7 @@
#include "gettext.h" #include "gettext.h"
#include "hook.h" #include "hook.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
#include "wrapper.h" #include "wrapper.h"
#define FAILED_RUN "failed to run %s" #define FAILED_RUN "failed to run %s"

View File

@ -26,8 +26,11 @@
#include "setup.h" #include "setup.h"
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "packfile.h" #include "packfile.h"
#include "pager.h"
#include "write-or-die.h" #include "write-or-die.h"
static const char *grep_prefix; static const char *grep_prefix;

View File

@ -9,6 +9,7 @@
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "blob.h" #include "blob.h"
#include "quote.h" #include "quote.h"

View File

@ -6,6 +6,7 @@
#include "builtin.h" #include "builtin.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "gettext.h" #include "gettext.h"
#include "pager.h"
#include "parse-options.h" #include "parse-options.h"
#include "run-command.h" #include "run-command.h"
#include "config-list.h" #include "config-list.h"

View File

@ -17,7 +17,10 @@
#include "streaming.h" #include "streaming.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "packfile.h" #include "packfile.h"
#include "pack-revindex.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "oid-array.h"
#include "replace-object.h" #include "replace-object.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "setup.h" #include "setup.h"

View File

@ -11,6 +11,7 @@
#include "refs.h" #include "refs.h"
#include "builtin.h" #include "builtin.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "object-file.h"
#include "parse-options.h" #include "parse-options.h"
#include "setup.h" #include "setup.h"
#include "worktree.h" #include "worktree.h"

View File

@ -12,7 +12,10 @@
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "refs.h" #include "refs.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "pager.h"
#include "color.h" #include "color.h"
#include "commit.h" #include "commit.h"
#include "diff.h" #include "diff.h"
@ -20,6 +23,7 @@
#include "revision.h" #include "revision.h"
#include "log-tree.h" #include "log-tree.h"
#include "builtin.h" #include "builtin.h"
#include "oid-array.h"
#include "tag.h" #include "tag.h"
#include "reflog-walk.h" #include "reflog-walk.h"
#include "patch-ids.h" #include "patch-ids.h"

View File

@ -8,10 +8,12 @@
#include "cache.h" #include "cache.h"
#include "repository.h" #include "repository.h"
#include "config.h" #include "config.h"
#include "convert.h"
#include "quote.h" #include "quote.h"
#include "dir.h" #include "dir.h"
#include "builtin.h" #include "builtin.h"
#include "gettext.h" #include "gettext.h"
#include "object-name.h"
#include "strbuf.h" #include "strbuf.h"
#include "tree.h" #include "tree.h"
#include "cache-tree.h" #include "cache-tree.h"

View File

@ -7,6 +7,7 @@
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "blob.h" #include "blob.h"
#include "tree.h" #include "tree.h"

View File

@ -7,6 +7,7 @@
#include "refs.h" #include "refs.h"
#include "diff.h" #include "diff.h"
#include "revision.h" #include "revision.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "repository.h" #include "repository.h"
#include "commit-reach.h" #include "commit-reach.h"

View File

@ -1,9 +1,11 @@
#include "cache.h" #include "cache.h"
#include "builtin.h" #include "builtin.h"
#include "advice.h"
#include "commit.h" #include "commit.h"
#include "gettext.h" #include "gettext.h"
#include "tag.h" #include "tag.h"
#include "merge-recursive.h" #include "merge-recursive.h"
#include "object-name.h"
#include "xdiff-interface.h" #include "xdiff-interface.h"
static const char builtin_merge_recursive_usage[] = static const char builtin_merge_recursive_usage[] =

View File

@ -8,6 +8,7 @@
#include "commit.h" #include "commit.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "merge-ort.h" #include "merge-ort.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "parse-options.h" #include "parse-options.h"
#include "repository.h" #include "repository.h"

View File

@ -9,11 +9,14 @@
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "cache.h" #include "cache.h"
#include "abspath.h" #include "abspath.h"
#include "advice.h"
#include "alloc.h" #include "alloc.h"
#include "config.h" #include "config.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "builtin.h" #include "builtin.h"
#include "lockfile.h" #include "lockfile.h"

View File

@ -4,6 +4,7 @@
#include "parse-options.h" #include "parse-options.h"
#include "tag.h" #include "tag.h"
#include "replace-object.h" #include "replace-object.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "fsck.h" #include "fsck.h"
#include "config.h" #include "config.h"

View File

@ -6,10 +6,12 @@
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "builtin.h" #include "builtin.h"
#include "abspath.h" #include "abspath.h"
#include "advice.h"
#include "alloc.h" #include "alloc.h"
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "object-file.h"
#include "pathspec.h" #include "pathspec.h"
#include "lockfile.h" #include "lockfile.h"
#include "dir.h" #include "dir.h"

View File

@ -8,6 +8,8 @@
#include "commit.h" #include "commit.h"
#include "tag.h" #include "tag.h"
#include "refs.h" #include "refs.h"
#include "object-name.h"
#include "pager.h"
#include "parse-options.h" #include "parse-options.h"
#include "prio-queue.h" #include "prio-queue.h"
#include "hash-lookup.h" #include "hash-lookup.h"

View File

@ -10,9 +10,11 @@
#include "cache.h" #include "cache.h"
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "editor.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "notes.h" #include "notes.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "repository.h" #include "repository.h"
#include "blob.h" #include "blob.h"

View File

@ -33,6 +33,7 @@
#include "strvec.h" #include "strvec.h"
#include "list.h" #include "list.h"
#include "packfile.h" #include "packfile.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "dir.h" #include "dir.h"

View File

@ -11,6 +11,8 @@
#include "progress.h" #include "progress.h"
#include "prune-packed.h" #include "prune-packed.h"
#include "replace-object.h" #include "replace-object.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "shallow.h" #include "shallow.h"

View File

@ -7,10 +7,12 @@
*/ */
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "run-command.h" #include "run-command.h"

View File

@ -2,6 +2,7 @@
* "git push" * "git push"
*/ */
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "branch.h" #include "branch.h"
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
@ -16,6 +17,7 @@
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "send-pack.h" #include "send-pack.h"
#include "trace2.h"
#include "color.h" #include "color.h"
static const char * const push_usage[] = { static const char * const push_usage[] = {

View File

@ -1,6 +1,7 @@
#include "cache.h" #include "cache.h"
#include "builtin.h" #include "builtin.h"
#include "gettext.h" #include "gettext.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "range-diff.h" #include "range-diff.h"
#include "config.h" #include "config.h"

View File

@ -11,6 +11,7 @@
#include "hex.h" #include "hex.h"
#include "lockfile.h" #include "lockfile.h"
#include "object.h" #include "object.h"
#include "object-name.h"
#include "tree.h" #include "tree.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "cache-tree.h" #include "cache-tree.h"

View File

@ -21,6 +21,8 @@
#include "cache-tree.h" #include "cache-tree.h"
#include "unpack-trees.h" #include "unpack-trees.h"
#include "lockfile.h" #include "lockfile.h"
#include "object-file.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "commit.h" #include "commit.h"
#include "diff.h" #include "diff.h"
@ -32,6 +34,7 @@
#include "sequencer.h" #include "sequencer.h"
#include "rebase-interactive.h" #include "rebase-interactive.h"
#include "reset.h" #include "reset.h"
#include "trace2.h"
#include "hook.h" #include "hook.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -29,9 +29,12 @@
#include "tmp-objdir.h" #include "tmp-objdir.h"
#include "oidset.h" #include "oidset.h"
#include "packfile.h" #include "packfile.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "protocol.h" #include "protocol.h"
#include "commit-reach.h" #include "commit-reach.h"
#include "trace.h"
#include "trace2.h"
#include "worktree.h" #include "worktree.h"
#include "shallow.h" #include "shallow.h"
#include "parse-options.h" #include "parse-options.h"

View File

@ -11,12 +11,15 @@
#include "cache.h" #include "cache.h"
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "refs.h" #include "refs.h"
#include "parse-options.h" #include "parse-options.h"
#include "run-command.h" #include "run-command.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "repository.h" #include "repository.h"

View File

@ -9,6 +9,7 @@
*/ */
#define USE_THE_INDEX_VARIABLE #define USE_THE_INDEX_VARIABLE
#include "builtin.h" #include "builtin.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
@ -23,12 +24,15 @@
#include "diffcore.h" #include "diffcore.h"
#include "tree.h" #include "tree.h"
#include "branch.h" #include "branch.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "unpack-trees.h" #include "unpack-trees.h"
#include "cache-tree.h" #include "cache-tree.h"
#include "setup.h" #include "setup.h"
#include "submodule.h" #include "submodule.h"
#include "submodule-config.h" #include "submodule-config.h"
#include "trace.h"
#include "trace2.h"
#include "dir.h" #include "dir.h"
#include "add-interactive.h" #include "add-interactive.h"

View File

@ -10,6 +10,8 @@
#include "list-objects-filter.h" #include "list-objects-filter.h"
#include "list-objects-filter-options.h" #include "list-objects-filter-options.h"
#include "object.h" #include "object.h"
#include "object-name.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "pack.h" #include "pack.h"
#include "pack-bitmap.h" #include "pack-bitmap.h"

View File

@ -15,6 +15,7 @@
#include "refs.h" #include "refs.h"
#include "quote.h" #include "quote.h"
#include "builtin.h" #include "builtin.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "diff.h" #include "diff.h"
#include "revision.h" #include "revision.h"

View File

@ -13,6 +13,7 @@
#include "cache-tree.h" #include "cache-tree.h"
#include "gettext.h" #include "gettext.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "string-list.h" #include "string-list.h"
#include "setup.h" #include "setup.h"

View File

@ -8,6 +8,7 @@
#include "builtin.h" #include "builtin.h"
#include "color.h" #include "color.h"
#include "strvec.h" #include "strvec.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "dir.h" #include "dir.h"
#include "commit-slab.h" #include "commit-slab.h"

View File

@ -4,6 +4,7 @@
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "refs.h" #include "refs.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "object.h" #include "object.h"
#include "tag.h" #include "tag.h"

View File

@ -4,6 +4,8 @@
#include "dir.h" #include "dir.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "object-file.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "pathspec.h" #include "pathspec.h"
#include "repository.h" #include "repository.h"

View File

@ -5,6 +5,7 @@
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "refs.h" #include "refs.h"
#include "lockfile.h" #include "lockfile.h"

View File

@ -24,6 +24,8 @@
#include "revision.h" #include "revision.h"
#include "diffcore.h" #include "diffcore.h"
#include "diff.h" #include "diff.h"
#include "object-file.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "advice.h" #include "advice.h"
#include "branch.h" #include "branch.h"

View File

@ -7,12 +7,15 @@
*/ */
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "editor.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "refs.h" #include "refs.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "tag.h" #include "tag.h"
#include "run-command.h" #include "run-command.h"

View File

@ -1,6 +1,7 @@
#include "builtin.h" #include "builtin.h"
#include "config.h" #include "config.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -4,6 +4,7 @@
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "git-zlib.h"
#include "hex.h" #include "hex.h"
#include "object-store.h" #include "object-store.h"
#include "object.h" #include "object.h"

View File

@ -15,6 +15,7 @@
#include "cache-tree.h" #include "cache-tree.h"
#include "tree-walk.h" #include "tree-walk.h"
#include "builtin.h" #include "builtin.h"
#include "object-file.h"
#include "refs.h" #include "refs.h"
#include "resolve-undo.h" #include "resolve-undo.h"
#include "parse-options.h" #include "parse-options.h"

View File

@ -3,6 +3,7 @@
#include "gettext.h" #include "gettext.h"
#include "refs.h" #include "refs.h"
#include "builtin.h" #include "builtin.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "quote.h" #include "quote.h"
#include "strvec.h" #include "strvec.h"

View File

@ -5,7 +5,9 @@
*/ */
#include "builtin.h" #include "builtin.h"
#include "config.h" #include "config.h"
#include "editor.h"
#include "ident.h" #include "ident.h"
#include "pager.h"
#include "refs.h" #include "refs.h"
static const char var_usage[] = "git var (-l | <variable>)"; static const char var_usage[] = "git var (-l | <variable>)";

View File

@ -9,6 +9,7 @@
#include "config.h" #include "config.h"
#include "builtin.h" #include "builtin.h"
#include "gettext.h" #include "gettext.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "repository.h" #include "repository.h"
#include "commit.h" #include "commit.h"

View File

@ -11,6 +11,7 @@
#include "gettext.h" #include "gettext.h"
#include "tag.h" #include "tag.h"
#include "run-command.h" #include "run-command.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "gpg-interface.h" #include "gpg-interface.h"
#include "ref-filter.h" #include "ref-filter.h"

View File

@ -7,6 +7,8 @@
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-file.h"
#include "object-name.h"
#include "parse-options.h" #include "parse-options.h"
#include "strvec.h" #include "strvec.h"
#include "branch.h" #include "branch.h"

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2011, Google Inc. * Copyright (c) 2011, Google Inc.
*/ */
#include "cache.h" #include "git-compat-util.h"
#include "alloc.h" #include "alloc.h"
#include "bulk-checkin.h" #include "bulk-checkin.h"
#include "environment.h" #include "environment.h"
@ -15,7 +15,9 @@
#include "string-list.h" #include "string-list.h"
#include "tmp-objdir.h" #include "tmp-objdir.h"
#include "packfile.h" #include "packfile.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "wrapper.h"
static int odb_transaction_nesting; static int odb_transaction_nesting;

View File

@ -1,4 +1,4 @@
#include "cache.h" #include "git-compat-util.h"
#include "lockfile.h" #include "lockfile.h"
#include "bundle.h" #include "bundle.h"
#include "environment.h" #include "environment.h"

View File

@ -7,10 +7,13 @@
#include "tree-walk.h" #include "tree-walk.h"
#include "cache-tree.h" #include "cache-tree.h"
#include "bulk-checkin.h" #include "bulk-checkin.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "replace-object.h" #include "replace-object.h"
#include "promisor-remote.h" #include "promisor-remote.h"
#include "sparse-index.h" #include "sparse-index.h"
#include "trace.h"
#include "trace2.h"
#ifndef DEBUG_CACHE_TREE #ifndef DEBUG_CACHE_TREE
#define DEBUG_CACHE_TREE 0 #define DEBUG_CACHE_TREE 0

351
cache.h
View File

@ -4,46 +4,11 @@
#include "git-compat-util.h" #include "git-compat-util.h"
#include "strbuf.h" #include "strbuf.h"
#include "hashmap.h" #include "hashmap.h"
#include "list.h"
#include "advice.h"
#include "gettext.h" #include "gettext.h"
#include "convert.h"
#include "trace.h"
#include "trace2.h"
#include "string-list.h" #include "string-list.h"
#include "pack-revindex.h"
#include "hash.h"
#include "path.h"
#include "pathspec.h" #include "pathspec.h"
#include "object.h" #include "object.h"
#include "oid-array.h"
#include "repository.h"
#include "statinfo.h" #include "statinfo.h"
#include "mem-pool.h"
typedef struct git_zstream {
z_stream z;
unsigned long avail_in;
unsigned long avail_out;
unsigned long total_in;
unsigned long total_out;
unsigned char *next_in;
unsigned char *next_out;
} git_zstream;
void git_inflate_init(git_zstream *);
void git_inflate_init_gzip_only(git_zstream *);
void git_inflate_end(git_zstream *);
int git_inflate(git_zstream *, int flush);
void git_deflate_init(git_zstream *, int level);
void git_deflate_init_gzip(git_zstream *, int level);
void git_deflate_init_raw(git_zstream *, int level);
void git_deflate_end(git_zstream *);
int git_deflate_abort(git_zstream *);
int git_deflate_end_gently(git_zstream *);
int git_deflate(git_zstream *, int flush);
unsigned long git_deflate_bound(git_zstream *, unsigned long);
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT) #if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
#define DTYPE(de) ((de)->d_type) #define DTYPE(de) ((de)->d_type)
@ -59,18 +24,6 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
#define DTYPE(de) DT_UNKNOWN #define DTYPE(de) DT_UNKNOWN
#endif #endif
/* unknown mode (impossible combination S_IFIFO|S_IFCHR) */
#define S_IFINVALID 0030000
/*
* A "directory link" is a link to another git directory.
*
* The value 0160000 is not normally a valid mode, and
* also just happens to be S_IFDIR + S_IFLNK
*/
#define S_IFGITLINK 0160000
#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
/* /*
* Some mode bits are also used internally for computations. * Some mode bits are also used internally for computations.
* *
@ -86,27 +39,6 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
#define S_DIFFTREE_IFXMIN_NEQ 0x80000000 #define S_DIFFTREE_IFXMIN_NEQ 0x80000000
/*
* Intensive research over the course of many years has shown that
* port 9418 is totally unused by anything else. Or
*
* Your search - "port 9418" - did not match any documents.
*
* as www.google.com puts it.
*
* This port has been properly assigned for git use by IANA:
* git (Assigned-9418) [I06-050728-0001].
*
* git 9418/tcp git pack transfer service
* git 9418/udp git pack transfer service
*
* with Linus Torvalds <torvalds@osdl.org> as the point of
* contact. September 2005.
*
* See http://www.iana.org/assignments/port-numbers
*/
#define DEFAULT_GIT_PORT 9418
/* /*
* Basic data structures for the directory cache * Basic data structures for the directory cache
*/ */
@ -186,11 +118,8 @@ struct cache_entry {
#error "CE_EXTENDED_FLAGS out of range" #error "CE_EXTENDED_FLAGS out of range"
#endif #endif
#define S_ISSPARSEDIR(m) ((m) == S_IFDIR)
/* Forward structure decls */ /* Forward structure decls */
struct pathspec; struct pathspec;
struct child_process;
struct tree; struct tree;
/* /*
@ -228,17 +157,6 @@ static inline unsigned create_ce_flags(unsigned stage)
#define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE) #define ce_mark_uptodate(ce) ((ce)->ce_flags |= CE_UPTODATE)
#define ce_intent_to_add(ce) ((ce)->ce_flags & CE_INTENT_TO_ADD) #define ce_intent_to_add(ce) ((ce)->ce_flags & CE_INTENT_TO_ADD)
#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
static inline unsigned int create_ce_mode(unsigned int mode)
{
if (S_ISLNK(mode))
return S_IFLNK;
if (S_ISSPARSEDIR(mode))
return S_IFDIR;
if (S_ISDIR(mode) || S_ISGITLINK(mode))
return S_IFGITLINK;
return S_IFREG | ce_permissions(mode);
}
static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce, static inline unsigned int ce_mode_from_stat(const struct cache_entry *ce,
unsigned int mode) unsigned int mode)
{ {
@ -265,16 +183,6 @@ static inline int ce_to_dtype(const struct cache_entry *ce)
else else
return DT_UNKNOWN; return DT_UNKNOWN;
} }
static inline unsigned int canon_mode(unsigned int mode)
{
if (S_ISREG(mode))
return S_IFREG | ce_permissions(mode);
if (S_ISLNK(mode))
return S_IFLNK;
if (S_ISDIR(mode))
return S_IFDIR;
return S_IFGITLINK;
}
static inline int ce_path_match(struct index_state *istate, static inline int ce_path_match(struct index_state *istate,
const struct cache_entry *ce, const struct cache_entry *ce,
@ -445,13 +353,6 @@ void prefetch_cache_entries(const struct index_state *istate,
extern struct index_state the_index; extern struct index_state the_index;
#endif #endif
static inline enum object_type object_type(unsigned int mode)
{
return S_ISDIR(mode) ? OBJ_TREE :
S_ISGITLINK(mode) ? OBJ_COMMIT :
OBJ_BLOB;
}
#define INIT_DB_QUIET 0x0001 #define INIT_DB_QUIET 0x0001
#define INIT_DB_EXIST_OK 0x0002 #define INIT_DB_EXIST_OK 0x0002
@ -626,13 +527,6 @@ int has_racy_timestamp(struct index_state *istate);
int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int); int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int); int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
#define HASH_WRITE_OBJECT 1
#define HASH_FORMAT_CHECK 2
#define HASH_RENORMALIZE 4
#define HASH_SILENT 8
int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags);
/* /*
* Record to sd the data from st that we use to check whether a file * Record to sd the data from st that we use to check whether a file
* might have changed. * might have changed.
@ -684,8 +578,6 @@ void set_alternate_index_output(const char *);
extern int verify_index_checksum; extern int verify_index_checksum;
extern int verify_ce_order; extern int verify_ce_order;
extern int quote_path_fully;
#define MTIME_CHANGED 0x0001 #define MTIME_CHANGED 0x0001
#define CTIME_CHANGED 0x0002 #define CTIME_CHANGED 0x0002
#define OWNER_CHANGED 0x0004 #define OWNER_CHANGED 0x0004
@ -694,213 +586,6 @@ extern int quote_path_fully;
#define DATA_CHANGED 0x0020 #define DATA_CHANGED 0x0020
#define TYPE_CHANGED 0x0040 #define TYPE_CHANGED 0x0040
/*
* Return an abbreviated sha1 unique within this repository's object database.
* The result will be at least `len` characters long, and will be NUL
* terminated.
*
* The non-`_r` version returns a static buffer which remains valid until 4
* more calls to repo_find_unique_abbrev are made.
*
* The `_r` variant writes to a buffer supplied by the caller, which must be at
* least `GIT_MAX_HEXSZ + 1` bytes. The return value is the number of bytes
* written (excluding the NUL terminator).
*
* Note that while this version avoids the static buffer, it is not fully
* reentrant, as it calls into other non-reentrant git code.
*/
const char *repo_find_unique_abbrev(struct repository *r, const struct object_id *oid, int len);
int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len);
/*
* Create the directory containing the named path, using care to be
* somewhat safe against races. Return one of the scld_error values to
* indicate success/failure. On error, set errno to describe the
* problem.
*
* SCLD_VANISHED indicates that one of the ancestor directories of the
* path existed at one point during the function call and then
* suddenly vanished, probably because another process pruned the
* directory while we were working. To be robust against this kind of
* race, callers might want to try invoking the function again when it
* returns SCLD_VANISHED.
*
* safe_create_leading_directories() temporarily changes path while it
* is working but restores it before returning.
* safe_create_leading_directories_const() doesn't modify path, even
* temporarily. Both these variants adjust the permissions of the
* created directories to honor core.sharedRepository, so they are best
* suited for files inside the git dir. For working tree files, use
* safe_create_leading_directories_no_share() instead, as it ignores
* the core.sharedRepository setting.
*/
enum scld_error {
SCLD_OK = 0,
SCLD_FAILED = -1,
SCLD_PERMS = -2,
SCLD_EXISTS = -3,
SCLD_VANISHED = -4
};
enum scld_error safe_create_leading_directories(char *path);
enum scld_error safe_create_leading_directories_const(const char *path);
enum scld_error safe_create_leading_directories_no_share(char *path);
int mkdir_in_gitdir(const char *path);
int git_open_cloexec(const char *name, int flags);
#define git_open(name) git_open_cloexec(name, O_RDONLY)
/**
* unpack_loose_header() initializes the data stream needed to unpack
* a loose object header.
*
* Returns:
*
* - ULHR_OK on success
* - ULHR_BAD on error
* - ULHR_TOO_LONG if the header was too long
*
* It will only parse up to MAX_HEADER_LEN bytes unless an optional
* "hdrbuf" argument is non-NULL. This is intended for use with
* OBJECT_INFO_ALLOW_UNKNOWN_TYPE to extract the bad type for (error)
* reporting. The full header will be extracted to "hdrbuf" for use
* with parse_loose_header(), ULHR_TOO_LONG will still be returned
* from this function to indicate that the header was too long.
*/
enum unpack_loose_header_result {
ULHR_OK,
ULHR_BAD,
ULHR_TOO_LONG,
};
enum unpack_loose_header_result unpack_loose_header(git_zstream *stream,
unsigned char *map,
unsigned long mapsize,
void *buffer,
unsigned long bufsiz,
struct strbuf *hdrbuf);
/**
* parse_loose_header() parses the starting "<type> <len>\0" of an
* object. If it doesn't follow that format -1 is returned. To check
* the validity of the <type> populate the "typep" in the "struct
* object_info". It will be OBJ_BAD if the object type is unknown. The
* parsed <len> can be retrieved via "oi->sizep", and from there
* passed to unpack_loose_rest().
*/
struct object_info;
int parse_loose_header(const char *hdr, struct object_info *oi);
/**
* With in-core object data in "buf", rehash it to make sure the
* object name actually matches "oid" to detect object corruption.
*
* A negative value indicates an error, usually that the OID is not
* what we expected, but it might also indicate another error.
*/
int check_object_signature(struct repository *r, const struct object_id *oid,
void *map, unsigned long size,
enum object_type type);
/**
* A streaming version of check_object_signature().
* Try reading the object named with "oid" using
* the streaming interface and rehash it to do the same.
*/
int stream_object_signature(struct repository *r, const struct object_id *oid);
int finalize_object_file(const char *tmpfile, const char *filename);
/* Helper to check and "touch" a file */
int check_and_freshen_file(const char *fn, int freshen);
/* Convert to/from hex/sha1 representation */
#define MINIMUM_ABBREV minimum_abbrev
#define DEFAULT_ABBREV default_abbrev
/* used when the code does not know or care what the default abbrev is */
#define FALLBACK_DEFAULT_ABBREV 7
struct object_context {
unsigned short mode;
/*
* symlink_path is only used by get_tree_entry_follow_symlinks,
* and only for symlinks that point outside the repository.
*/
struct strbuf symlink_path;
/*
* If GET_OID_RECORD_PATH is set, this will record path (if any)
* found when resolving the name. The caller is responsible for
* releasing the memory.
*/
char *path;
};
int repo_get_oid(struct repository *r, const char *str, struct object_id *oid);
__attribute__((format (printf, 2, 3)))
int get_oidf(struct object_id *oid, const char *fmt, ...);
int repo_get_oid_commit(struct repository *r, const char *str, struct object_id *oid);
int repo_get_oid_committish(struct repository *r, const char *str, struct object_id *oid);
int repo_get_oid_tree(struct repository *r, const char *str, struct object_id *oid);
int repo_get_oid_treeish(struct repository *r, const char *str, struct object_id *oid);
int repo_get_oid_blob(struct repository *r, const char *str, struct object_id *oid);
int repo_get_oid_mb(struct repository *r, const char *str, struct object_id *oid);
void maybe_die_on_misspelt_object_name(struct repository *repo,
const char *name,
const char *prefix);
enum get_oid_result get_oid_with_context(struct repository *repo, const char *str,
unsigned flags, struct object_id *oid,
struct object_context *oc);
typedef int each_abbrev_fn(const struct object_id *oid, void *);
int repo_for_each_abbrev(struct repository *r, const char *prefix, each_abbrev_fn, void *);
int set_disambiguate_hint_config(const char *var, const char *value);
/*
* This reads short-hand syntax that not only evaluates to a commit
* object name, but also can act as if the end user spelled the name
* of the branch from the command line.
*
* - "@{-N}" finds the name of the Nth previous branch we were on, and
* places the name of the branch in the given buf and returns the
* number of characters parsed if successful.
*
* - "<branch>@{upstream}" finds the name of the other ref that
* <branch> is configured to merge with (missing <branch> defaults
* to the current branch), and places the name of the branch in the
* given buf and returns the number of characters parsed if
* successful.
*
* If the input is not of the accepted format, it returns a negative
* number to signal an error.
*
* If the input was ok but there are not N branch switches in the
* reflog, it returns 0.
*/
#define INTERPRET_BRANCH_LOCAL (1<<0)
#define INTERPRET_BRANCH_REMOTE (1<<1)
#define INTERPRET_BRANCH_HEAD (1<<2)
struct interpret_branch_name_options {
/*
* If "allowed" is non-zero, it is a treated as a bitfield of allowable
* expansions: local branches ("refs/heads/"), remote branches
* ("refs/remotes/"), or "HEAD". If no "allowed" bits are set, any expansion is
* allowed, even ones to refs outside of those namespaces.
*/
unsigned allowed;
/*
* If ^{upstream} or ^{push} (or equivalent) is requested, and the
* branch in question does not have such a reference, return -1 instead
* of die()-ing.
*/
unsigned nonfatal_dangling_mark : 1;
};
int repo_interpret_branch_name(struct repository *r,
const char *str, int len,
struct strbuf *buf,
const struct interpret_branch_name_options *options);
int base_name_compare(const char *name1, size_t len1, int mode1, int base_name_compare(const char *name1, size_t len1, int mode1,
const char *name2, size_t len2, int mode2); const char *name2, size_t len2, int mode2);
int df_name_compare(const char *name1, size_t len1, int mode1, int df_name_compare(const char *name1, size_t len1, int mode1,
@ -908,21 +593,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1,
int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int name_compare(const char *name1, size_t len1, const char *name2, size_t len2);
int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2);
void *read_object_with_reference(struct repository *r,
const struct object_id *oid,
enum object_type required_type,
unsigned long *size,
struct object_id *oid_ret);
struct object *repo_peel_to_type(struct repository *r,
const char *name, int namelen,
struct object *o, enum object_type);
const char *git_editor(void);
const char *git_sequence_editor(void);
const char *git_pager(int stdout_is_tty);
int is_terminal_dumb(void);
struct cache_def { struct cache_def {
struct strbuf path; struct strbuf path;
int flags; int flags;
@ -959,36 +629,15 @@ struct pack_entry {
struct packed_git *p; struct packed_git *p;
}; };
/*
* Set this to 0 to prevent oid_object_info_extended() from fetching missing
* blobs. This has a difference only if extensions.partialClone is set.
*
* Its default value is 1.
*/
extern int fetch_if_missing;
/* Dumb servers support */ /* Dumb servers support */
int update_server_info(int); int update_server_info(int);
extern const char *git_mailmap_file;
extern const char *git_mailmap_blob;
#define COPY_READ_ERROR (-2) #define COPY_READ_ERROR (-2)
#define COPY_WRITE_ERROR (-3) #define COPY_WRITE_ERROR (-3)
int copy_fd(int ifd, int ofd); int copy_fd(int ifd, int ofd);
int copy_file(const char *dst, const char *src, int mode); int copy_file(const char *dst, const char *src, int mode);
int copy_file_with_time(const char *dst, const char *src, int mode); int copy_file_with_time(const char *dst, const char *src, int mode);
/* pager.c */
void setup_pager(void);
int pager_in_use(void);
extern int pager_use_color;
int term_columns(void);
void term_clear_line(void);
int decimal_width(uintmax_t);
int check_pager_config(const char *cmd);
void prepare_pager_args(struct child_process *, const char *pager);
/* base85 */ /* base85 */
int decode_85(char *dst, const char *line, int linelen); int decode_85(char *dst, const char *line, int linelen);
void encode_85(char *buf, const unsigned char *data, int bytes); void encode_85(char *buf, const unsigned char *data, int bytes);

View File

@ -1,8 +1,10 @@
#include "cache.h" #include "git-compat-util.h"
#include "abspath.h" #include "abspath.h"
#include "chdir-notify.h" #include "chdir-notify.h"
#include "list.h" #include "list.h"
#include "path.h"
#include "strbuf.h" #include "strbuf.h"
#include "trace.h"
struct chdir_notify_entry { struct chdir_notify_entry {
const char *name; const char *name;

View File

@ -1,8 +1,10 @@
#include "cache.h" #include "git-compat-util.h"
#include "object-name.h"
#include "remote.h" #include "remote.h"
#include "refspec.h" #include "refspec.h"
#include "checkout.h" #include "checkout.h"
#include "config.h" #include "config.h"
#include "strbuf.h"
struct tracking_name_data { struct tracking_name_data {
/* const */ char *src_ref; /* const */ char *src_ref;

View File

@ -1,8 +1,10 @@
#include "cache.h" #include "cache.h"
#include "config.h" #include "config.h"
#include "color.h" #include "color.h"
#include "editor.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "pager.h"
static int git_use_color_default = GIT_COLOR_AUTO; static int git_use_color_default = GIT_COLOR_AUTO;
int color_stdout_is_tty = -1; int color_stdout_is_tty = -1;

View File

@ -1,7 +1,8 @@
#include "cache.h" #include "git-compat-util.h"
#include "config.h" #include "config.h"
#include "column.h" #include "column.h"
#include "string-list.h" #include "string-list.h"
#include "pager.h"
#include "parse-options.h" #include "parse-options.h"
#include "run-command.h" #include "run-command.h"
#include "utf8.h" #include "utf8.h"

View File

@ -1,11 +1,13 @@
#include "cache.h" #include "cache.h"
#include "object-store.h" #include "object-store.h"
#include "commit.h" #include "commit.h"
#include "convert.h"
#include "blob.h" #include "blob.h"
#include "diff.h" #include "diff.h"
#include "diffcore.h" #include "diffcore.h"
#include "environment.h" #include "environment.h"
#include "hex.h" #include "hex.h"
#include "object-name.h"
#include "quote.h" #include "quote.h"
#include "xdiff-interface.h" #include "xdiff-interface.h"
#include "xdiff/xmacros.h" #include "xdiff/xmacros.h"
@ -14,6 +16,7 @@
#include "userdiff.h" #include "userdiff.h"
#include "oid-array.h" #include "oid-array.h"
#include "revision.h" #include "revision.h"
#include "wrapper.h"
static int compare_paths(const struct combine_diff_path *one, static int compare_paths(const struct combine_diff_path *one,
const struct diff_filespec *two) const struct diff_filespec *two)

View File

@ -1,4 +1,4 @@
#include "cache.h" #include "git-compat-util.h"
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
@ -11,7 +11,9 @@
#include "revision.h" #include "revision.h"
#include "hash-lookup.h" #include "hash-lookup.h"
#include "commit-graph.h" #include "commit-graph.h"
#include "object-file.h"
#include "object-store.h" #include "object-store.h"
#include "oid-array.h"
#include "alloc.h" #include "alloc.h"
#include "hashmap.h" #include "hashmap.h"
#include "replace-object.h" #include "replace-object.h"

View File

@ -1,4 +1,4 @@
#include "cache.h" #include "git-compat-util.h"
#include "tag.h" #include "tag.h"
#include "commit.h" #include "commit.h"
#include "commit-graph.h" #include "commit-graph.h"
@ -6,6 +6,7 @@
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "repository.h" #include "repository.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "utf8.h" #include "utf8.h"

View File

@ -3,6 +3,7 @@
#include "gettext.h" #include "gettext.h"
#include "attr.h" #include "attr.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
/* /*
* Many parts of Git have subprograms communicate via pipe, expect the * Many parts of Git have subprograms communicate via pipe, expect the

View File

@ -4,6 +4,7 @@
#include "fsm-listen.h" #include "fsm-listen.h"
#include "fsmonitor--daemon.h" #include "fsmonitor--daemon.h"
#include "gettext.h" #include "gettext.h"
#include "trace2.h"
/* /*
* The documentation of ReadDirectoryChangesW() states that the maximum * The documentation of ReadDirectoryChangesW() states that the maximum

View File

@ -12,6 +12,7 @@
#include "win32/lazyload.h" #include "win32/lazyload.h"
#include "../config.h" #include "../config.h"
#include "../environment.h" #include "../environment.h"
#include "../trace2.h"
#include "../wrapper.h" #include "../wrapper.h"
#include "dir.h" #include "dir.h"
#include "gettext.h" #include "gettext.h"

View File

@ -1,4 +1,5 @@
#include "../git-compat-util.h" #include "../git-compat-util.h"
#include "../wrapper.h"
ssize_t git_pread(int fd, void *buf, size_t count, off_t offset) ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
{ {

View File

@ -1,9 +1,10 @@
#include "cache.h" #include "git-compat-util.h"
#include "gettext.h" #include "gettext.h"
#include "simple-ipc.h" #include "simple-ipc.h"
#include "strbuf.h" #include "strbuf.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace2.h"
#include "unix-socket.h" #include "unix-socket.h"
#include "unix-stream-server.h" #include "unix-stream-server.h"

View File

@ -5,6 +5,8 @@
#include "strbuf.h" #include "strbuf.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "thread-utils.h" #include "thread-utils.h"
#include "trace.h"
#include "trace2.h"
#include "accctrl.h" #include "accctrl.h"
#include "aclapi.h" #include "aclapi.h"

View File

@ -1,5 +1,6 @@
#include "../../cache.h" #include "../../cache.h"
#include "../../json-writer.h" #include "../../json-writer.h"
#include "../../trace2.h"
#include "lazyload.h" #include "lazyload.h"
#include <Psapi.h> #include <Psapi.h>
#include <tlHelp32.h> #include <tlHelp32.h>

View File

@ -7,27 +7,33 @@
*/ */
#include "cache.h" #include "cache.h"
#include "abspath.h" #include "abspath.h"
#include "advice.h"
#include "alloc.h" #include "alloc.h"
#include "date.h" #include "date.h"
#include "branch.h" #include "branch.h"
#include "config.h" #include "config.h"
#include "convert.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
#include "ident.h" #include "ident.h"
#include "repository.h" #include "repository.h"
#include "lockfile.h" #include "lockfile.h"
#include "mailmap.h"
#include "exec-cmd.h" #include "exec-cmd.h"
#include "strbuf.h" #include "strbuf.h"
#include "quote.h" #include "quote.h"
#include "hashmap.h" #include "hashmap.h"
#include "string-list.h" #include "string-list.h"
#include "object-name.h"
#include "object-store.h" #include "object-store.h"
#include "pager.h"
#include "utf8.h" #include "utf8.h"
#include "dir.h" #include "dir.h"
#include "color.h" #include "color.h"
#include "replace-object.h" #include "replace-object.h"
#include "refs.h" #include "refs.h"
#include "setup.h" #include "setup.h"
#include "trace2.h"
#include "worktree.h" #include "worktree.h"
#include "wrapper.h" #include "wrapper.h"
#include "write-or-die.h" #include "write-or-die.h"

View File

@ -1,5 +1,4 @@
#include "git-compat-util.h" #include "git-compat-util.h"
#include "cache.h"
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "gettext.h" #include "gettext.h"
@ -14,6 +13,7 @@
#include "string-list.h" #include "string-list.h"
#include "oid-array.h" #include "oid-array.h"
#include "transport.h" #include "transport.h"
#include "trace2.h"
#include "strbuf.h" #include "strbuf.h"
#include "version.h" #include "version.h"
#include "protocol.h" #include "protocol.h"

View File

@ -1,5 +1,7 @@
#include "cache.h" #include "cache.h"
#include "advice.h"
#include "config.h" #include "config.h"
#include "convert.h"
#include "gettext.h" #include "gettext.h"
#include "hex.h" #include "hex.h"
#include "object-store.h" #include "object-store.h"
@ -9,6 +11,7 @@
#include "sigchain.h" #include "sigchain.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "sub-process.h" #include "sub-process.h"
#include "trace.h"
#include "utf8.h" #include "utf8.h"
#include "ll-merge.h" #include "ll-merge.h"
#include "wrapper.h" #include "wrapper.h"

View File

@ -4,6 +4,7 @@
#include "config.h" #include "config.h"
#include "environment.h" #include "environment.h"
#include "pkt-line.h" #include "pkt-line.h"
#include "protocol.h"
#include "run-command.h" #include "run-command.h"
#include "setup.h" #include "setup.h"
#include "strbuf.h" #include "strbuf.h"

Some files were not shown because too many files have changed in this diff Show More