load("@bazel_skylib//rules:copy_file.bzl", "copy_file") load("@bazel_skylib//rules:expand_template.bzl", "expand_template") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("@rules_shell//shell:sh_binary.bzl", "sh_binary") load("//contrib/bazel:defs.bzl", "GIT_COPTS", "GIT_LINKOPTS") package(default_visibility = ["//visibility:public"]) exports_files([ "Makefile", "help.c", "diagnose.c", ]) filegroup( name = "templates", srcs = glob(["templates/**"]), ) filegroup( name = "documentation", srcs = glob(["Documentation/**"]), ) filegroup( name = "po", srcs = glob(["po/**"]), ) filegroup( name = "perl", srcs = glob(["perl/**"]), ) filegroup( name = "mergetools", srcs = glob(["mergetools/**"]), ) sh_binary( name = "generate_script", srcs = ["generate-script.sh"], ) sh_binary( name = "generate_perl", srcs = ["generate-perl.sh"], ) expand_template( name = "git_build_options_default", out = "GIT-BUILD-OPTIONS.default", substitutions = { "@BROKEN_PATH_FIX@": "''", "@DIFF@": "'diff'", "@FSMONITOR_DAEMON_BACKEND@": "''", "@FSMONITOR_OS_SETTINGS@": "''", "@GITWEBDIR@": "\"${GIT_BUILD_DIR}/gitweb\"", "@GIT_INTEROP_MAKE_OPTS@": "''", "@GIT_PERF_LARGE_REPO@": "''", "@GIT_PERF_MAKE_COMMAND@": "''", "@GIT_PERF_MAKE_OPTS@": "''", "@GIT_PERF_REPEAT_COUNT@": "''", "@GIT_PERF_REPO@": "''", "@GIT_SOURCE_DIR@": "\"${GIT_BUILD_DIR}\"", "@GIT_TEST_CMP@": "''", "@GIT_TEST_CMP_USE_COPIED_CONTEXT@": "''", "@GIT_TEST_GITPERLLIB@": "\"${GIT_BUILD_DIR}/perl\"", "@GIT_TEST_INDEX_VERSION@": "''", "@GIT_TEST_OPTS@": "''", "@GIT_TEST_PERL_FATAL_WARNINGS@": "''", "@GIT_TEST_TEMPLATE_DIR@": "\"${GIT_TEST_TEMPLATE_DIR:-${GIT_BUILD_DIR}/templates}\"", "@GIT_TEST_TEXTDOMAINDIR@": "\"${GIT_BUILD_DIR}/po\"", "@GIT_TEST_UTF8_LOCALE@": "''", "@LOCALEDIR@": "\"${GIT_BUILD_DIR}/po\"", "@NO_CURL@": "''", "@NO_EXPAT@": "''", "@NO_GETTEXT@": "'YesPlease'", "@NO_GITWEB@": "''", "@NO_ICONV@": "'YesPlease'", "@NO_PERL@": "''", "@NO_PERL_CPAN_FALLBACKS@": "''", "@NO_PTHREADS@": "''", "@NO_PYTHON@": "''", "@NO_REGEX@": "''", "@NO_UNIX_SOCKETS@": "''", "@PAGER_ENV@": "'LESS=FRX LV=-c'", "@PERL_LOCALEDIR@": "\"${GIT_BUILD_DIR}/po\"", "@PERL_PATH@": "'/usr/bin/perl'", # TODO(sluongng): replace with toolchain "@PYTHON_PATH@": "'/usr/bin/python3'", # TODO(sluongng): replace with toolchain "@RUNTIME_PREFIX@": "'false'", "@SANITIZE_ADDRESS@": "''", "@SANITIZE_LEAK@": "''", "@SHELL_PATH@": "'/bin/sh'", # TODO(sluongng): replace with toolchain "@TAR@": "'tar'", "@TEST_OUTPUT_DIRECTORY@": "\"${TEST_TMPDIR:-}\"", "@TEST_SHELL_PATH@": "'/bin/sh'", # TODO(sluongng): replace with toolchain "@USE_GETTEXT_SCHEME@": "'fallthrough'", "@USE_LIBPCRE2@": "''", "@WITH_BREAKING_CHANGES@": "''", "@X@": "''", }, template = "GIT-BUILD-OPTIONS.in", ) expand_template( name = "git_build_options_darwin", out = "GIT-BUILD-OPTIONS.darwin", substitutions = { "@BROKEN_PATH_FIX@": "''", "@DIFF@": "'diff'", "@FSMONITOR_DAEMON_BACKEND@": "'darwin'", "@FSMONITOR_OS_SETTINGS@": "'darwin'", "@GITWEBDIR@": "\"${GIT_BUILD_DIR}/gitweb\"", "@GIT_INTEROP_MAKE_OPTS@": "''", "@GIT_PERF_LARGE_REPO@": "''", "@GIT_PERF_MAKE_COMMAND@": "''", "@GIT_PERF_MAKE_OPTS@": "''", "@GIT_PERF_REPEAT_COUNT@": "''", "@GIT_PERF_REPO@": "''", "@GIT_SOURCE_DIR@": "\"${GIT_BUILD_DIR}\"", "@GIT_TEST_CMP@": "''", "@GIT_TEST_CMP_USE_COPIED_CONTEXT@": "''", "@GIT_TEST_GITPERLLIB@": "\"${GIT_BUILD_DIR}/perl\"", "@GIT_TEST_INDEX_VERSION@": "''", "@GIT_TEST_OPTS@": "''", "@GIT_TEST_PERL_FATAL_WARNINGS@": "''", "@GIT_TEST_TEMPLATE_DIR@": "\"${GIT_TEST_TEMPLATE_DIR:-${GIT_BUILD_DIR}/templates}\"", "@GIT_TEST_TEXTDOMAINDIR@": "\"${GIT_BUILD_DIR}/po\"", "@GIT_TEST_UTF8_LOCALE@": "''", "@LOCALEDIR@": "\"${GIT_BUILD_DIR}/po\"", "@NO_CURL@": "''", "@NO_EXPAT@": "''", "@NO_GETTEXT@": "'YesPlease'", "@NO_GITWEB@": "''", "@NO_ICONV@": "''", "@NO_PERL@": "''", "@NO_PERL_CPAN_FALLBACKS@": "''", "@NO_PTHREADS@": "''", "@NO_PYTHON@": "''", "@NO_REGEX@": "''", "@NO_UNIX_SOCKETS@": "''", "@PAGER_ENV@": "'LESS=FRX LV=-c'", "@PERL_LOCALEDIR@": "\"${GIT_BUILD_DIR}/po\"", "@PERL_PATH@": "'/usr/bin/perl'", # TODO(sluongng): replace with toolchain "@PYTHON_PATH@": "'/usr/bin/python3'", # TODO(sluongng): replace with toolchain "@RUNTIME_PREFIX@": "'false'", "@SANITIZE_ADDRESS@": "''", "@SANITIZE_LEAK@": "''", "@SHELL_PATH@": "'/bin/sh'", # TODO(sluongng): replace with toolchain "@TAR@": "'tar'", "@TEST_OUTPUT_DIRECTORY@": "\"${TEST_TMPDIR:-}\"", "@TEST_SHELL_PATH@": "'/bin/sh'", # TODO(sluongng): replace with toolchain "@USE_GETTEXT_SCHEME@": "'fallthrough'", "@USE_LIBPCRE2@": "''", "@WITH_BREAKING_CHANGES@": "''", "@X@": "''", }, template = "GIT-BUILD-OPTIONS.in", ) expand_template( name = "git_build_options_win32", out = "GIT-BUILD-OPTIONS.win32", substitutions = { "@BROKEN_PATH_FIX@": "''", "@DIFF@": "'diff'", "@FSMONITOR_DAEMON_BACKEND@": "'win32'", "@FSMONITOR_OS_SETTINGS@": "'win32'", "@GITWEBDIR@": "\"${GIT_BUILD_DIR}/gitweb\"", "@GIT_INTEROP_MAKE_OPTS@": "''", "@GIT_PERF_LARGE_REPO@": "''", "@GIT_PERF_MAKE_COMMAND@": "''", "@GIT_PERF_MAKE_OPTS@": "''", "@GIT_PERF_REPEAT_COUNT@": "''", "@GIT_PERF_REPO@": "''", "@GIT_SOURCE_DIR@": "\"${GIT_BUILD_DIR}\"", "@GIT_TEST_CMP@": "''", "@GIT_TEST_CMP_USE_COPIED_CONTEXT@": "''", "@GIT_TEST_GITPERLLIB@": "\"${GIT_BUILD_DIR}/perl\"", "@GIT_TEST_INDEX_VERSION@": "''", "@GIT_TEST_OPTS@": "''", "@GIT_TEST_PERL_FATAL_WARNINGS@": "''", "@GIT_TEST_TEMPLATE_DIR@": "\"${GIT_TEST_TEMPLATE_DIR:-${GIT_BUILD_DIR}/templates}\"", "@GIT_TEST_TEXTDOMAINDIR@": "\"${GIT_BUILD_DIR}/po\"", "@GIT_TEST_UTF8_LOCALE@": "''", "@LOCALEDIR@": "\"${GIT_BUILD_DIR}/po\"", "@NO_CURL@": "''", "@NO_EXPAT@": "''", "@NO_GETTEXT@": "'YesPlease'", "@NO_GITWEB@": "''", "@NO_ICONV@": "'YesPlease'", "@NO_PERL@": "''", "@NO_PERL_CPAN_FALLBACKS@": "''", "@NO_PTHREADS@": "''", "@NO_PYTHON@": "''", "@NO_REGEX@": "''", "@NO_UNIX_SOCKETS@": "''", "@PAGER_ENV@": "'LESS=FRX LV=-c'", "@PERL_LOCALEDIR@": "\"${GIT_BUILD_DIR}/po\"", "@PERL_PATH@": "'/usr/bin/perl'", # TODO(sluongng): replace with toolchain "@PYTHON_PATH@": "'/usr/bin/python3'", # TODO(sluongng): replace with toolchain "@RUNTIME_PREFIX@": "'false'", "@SANITIZE_ADDRESS@": "''", "@SANITIZE_LEAK@": "''", "@SHELL_PATH@": "'/bin/sh'", # TODO(sluongng): replace with toolchain "@TAR@": "'tar'", "@TEST_OUTPUT_DIRECTORY@": "\"${TEST_TMPDIR:-}\"", "@TEST_SHELL_PATH@": "'/bin/sh'", # TODO(sluongng): replace with toolchain "@USE_GETTEXT_SCHEME@": "'fallthrough'", "@USE_LIBPCRE2@": "''", "@WITH_BREAKING_CHANGES@": "''", "@X@": "''", }, template = "GIT-BUILD-OPTIONS.in", ) copy_file( name = "git_build_options", src = select({ "@platforms//os:macos": ":git_build_options_darwin", "@platforms//os:windows": ":git_build_options_win32", "//conditions:default": ":git_build_options_default", }), out = "GIT-BUILD-OPTIONS", ) genrule( name = "git_version_file", srcs = ["GIT-VERSION-FILE.in"], outs = ["GIT-VERSION-FILE"], cmd = """ set -euo pipefail GIT_VERSION="2.53.0" GIT_BUILT_FROM_COMMIT="67ad42147a7acc2af6074753ebd03d904476118f" GIT_DATE="2026-02-01" GIT_USER_AGENT="git/$${GIT_VERSION}" export GIT_VERSION GIT_BUILT_FROM_COMMIT GIT_DATE GIT_USER_AGENT $(location :git_version_gen) "$$(pwd)" "$(location GIT-VERSION-FILE.in)" "$@" """, tools = [":git_version_gen"], ) genrule( name = "git_sh_i18n", srcs = [ "git-sh-i18n.sh", ":git_build_options", ], outs = ["git-sh-i18n"], cmd = """ set -euo pipefail $(location :generate_script) $(location git-sh-i18n.sh) "$@" $(location :git_build_options) """, executable = True, tools = [":generate_script"], ) genrule( name = "git_sh_setup", srcs = [ "git-sh-setup.sh", ":git_build_options", ], outs = ["git-sh-setup"], cmd = """ set -euo pipefail $(location :generate_script) $(location git-sh-setup.sh) "$@" $(location :git_build_options) """, executable = True, tools = [":generate_script"], ) genrule( name = "git_submodule", srcs = [ "git-submodule.sh", ":git_build_options", ], outs = ["git-submodule"], cmd = """ set -euo pipefail $(location :generate_script) $(location git-submodule.sh) "$@" $(location :git_build_options) """, executable = True, tools = [":generate_script"], ) genrule( name = "git_web__browse", srcs = [ "git-web--browse.sh", ":git_build_options", ], outs = ["git-web--browse"], cmd = """ set -euo pipefail $(location :generate_script) $(location git-web--browse.sh) "$@" $(location :git_build_options) """, executable = True, tools = [":generate_script"], ) genrule( name = "git_filter_branch", srcs = [ "git-filter-branch.sh", ":git_build_options", ], outs = ["git-filter-branch"], cmd = """ set -euo pipefail $(location :generate_script) $(location git-filter-branch.sh) "$@" $(location :git_build_options) """, executable = True, tools = [":generate_script"], ) sh_binary( name = "generate_cmdlist", srcs = ["generate-cmdlist.sh"], ) genrule( name = "command_list", srcs = ["command-list.txt"] + glob(["Documentation/git*.adoc"]) + [ "Documentation/scalar.adoc", ], outs = ["command-list.h"], cmd = """ set -euo pipefail source_dir="$$(dirname $(location command-list.txt))" $(location :generate_cmdlist) \ --exclude-program foo --exclude-program bar \ "$$source_dir" "$@" """, tools = [":generate_cmdlist"], ) sh_binary( name = "generate_hooklist", srcs = ["generate-hooklist.sh"], ) genrule( name = "hook_list", srcs = ["Documentation/githooks.adoc"], outs = ["hook-list.h"], cmd = """ set -euo pipefail source_dir="$$(dirname "$$(dirname $(location Documentation/githooks.adoc))")" $(location :generate_hooklist) "$$source_dir" "$@" """, tools = [":generate_hooklist"], ) sh_binary( name = "generate_configlist", srcs = ["generate-configlist.sh"], ) genrule( name = "config_list", srcs = glob([ "Documentation/*config.adoc", "Documentation/config/*.adoc", ]), outs = ["config-list.h"], cmd = """ set -euo pipefail source_dir="$$(dirname "$$(dirname $(location Documentation/git-config.adoc))")" $(location :generate_configlist) "$$source_dir" "$@" """, tools = [":generate_configlist"], ) sh_binary( name = "git_version_gen", srcs = ["GIT-VERSION-GEN"], ) # Generates version-def.h from version-def.h.in using hard-coded version info. genrule( name = "version_def", srcs = ["version-def.h.in"], outs = ["version-def.h"], cmd = """ set -euo pipefail GIT_VERSION="2.53.0" GIT_BUILT_FROM_COMMIT="67ad42147a7acc2af6074753ebd03d904476118f" GIT_DATE="2026-02-01" GIT_USER_AGENT="git/$${GIT_VERSION}" export GIT_VERSION GIT_BUILT_FROM_COMMIT GIT_DATE GIT_USER_AGENT $(location :git_version_gen) "$$(pwd)" "$(location version-def.h.in)" "$@" """, tools = [":git_version_gen"], ) cc_library( name = "generated", hdrs = [ "command-list.h", "config-list.h", "hook-list.h", "version-def.h", ], ) # ============================================================================= # Fine-grained header libraries # Each header gets its own cc_library target for precise dependency tracking. # ============================================================================= # Base header needed by compat/posix.h cc_library( name = "sane_ctype", hdrs = ["sane-ctype.h"], ) # Core compatibility header - almost everything depends on this cc_library( name = "git_compat_util", hdrs = ["git-compat-util.h"], textual_hdrs = [ "banned.h", "wrapper.h", ], deps = [ "//contrib/bazel:angle_include_shims", "//compat:headers", "@openssl//:ssl", ], ) # Individual header libraries (alphabetical) cc_library( name = "abspath", hdrs = ["abspath.h"], ) cc_library( name = "alloc", hdrs = ["alloc.h"], ) cc_library( name = "chdir_notify", hdrs = ["chdir-notify.h"], ) cc_library( name = "add_interactive", hdrs = ["add-interactive.h"], deps = [":color"], ) cc_library( name = "color", hdrs = ["color.h"], ) cc_library( name = "commit", hdrs = ["commit.h"], deps = [ ":add_interactive", ":object", ], ) cc_library( name = "config", hdrs = ["config.h"], deps = [ ":hashmap", ":parse", ":repository", ":string_list", ], ) cc_library( name = "convert", hdrs = ["convert.h"], deps = [ ":hash", ":string_list", ], ) cc_library( name = "copy", hdrs = ["copy.h"], ) cc_library( name = "dir", hdrs = ["dir.h"], deps = [ ":hash", ":hashmap", ":pathspec", ":statinfo", ":strbuf", ], ) cc_library( name = "pathspec", hdrs = ["pathspec.h"], ) cc_library( name = "dir_iterator", hdrs = ["dir-iterator.h"], ) cc_library( name = "environment", hdrs = ["environment.h"], ) cc_library( name = "fetch_negotiator", hdrs = ["fetch-negotiator.h"], ) cc_library( name = "fsck", hdrs = ["fsck.h"], deps = [":oidset"], ) cc_library( name = "fsmonitor_daemon", hdrs = ["fsmonitor--daemon.h"], deps = [ ":fsmonitor_path_utils", ":hashmap", ":thread_utils", ], ) cc_library( name = "fsmonitor_ipc", hdrs = ["fsmonitor-ipc.h"], deps = [":simple_ipc"], ) cc_library( name = "fsmonitor_ll", hdrs = ["fsmonitor-ll.h"], ) cc_library( name = "fsmonitor_path_utils", hdrs = ["fsmonitor-path-utils.h"], deps = [":strbuf"], ) cc_library( name = "fsmonitor_settings", hdrs = ["fsmonitor-settings.h"], ) cc_library( name = "oidset", hdrs = ["oidset.h"], deps = [":khash"], ) cc_library( name = "khash", hdrs = ["khash.h"], ) cc_library( name = "gettext", hdrs = ["gettext.h"], ) cc_library( name = "hash", hdrs = ["hash.h"], deps = [":sha1dc_git"], ) cc_library( name = "sha1dc_git", hdrs = ["sha1dc_git.h"], ) cc_library( name = "hashmap", hdrs = ["hashmap.h"], ) cc_library( name = "hex", hdrs = ["hex.h"], deps = [":hex_ll"], ) cc_library( name = "hex_ll", hdrs = ["hex-ll.h"], ) cc_library( name = "ident", hdrs = ["ident.h"], ) cc_library( name = "iterator", hdrs = ["iterator.h"], ) cc_library( name = "json_writer", hdrs = ["json-writer.h"], ) cc_library( name = "lockfile", hdrs = ["lockfile.h"], deps = [":tempfile"], ) cc_library( name = "object", hdrs = ["object.h"], deps = [":hash"], ) cc_library( name = "object_file", hdrs = ["object-file.h"], deps = [ ":git_zlib", ":object", ], ) cc_library( name = "git_zlib", hdrs = ["git-zlib.h"], ) cc_library( name = "odb", hdrs = ["odb.h"], deps = [ ":oidmap", ":oidset", ":thread_utils", ], ) cc_library( name = "oidmap", hdrs = ["oidmap.h"], ) cc_library( name = "packfile", hdrs = ["packfile.h"], deps = [":list"], ) cc_library( name = "parse", hdrs = ["parse.h"], ) cc_library( name = "path", hdrs = ["path.h"], ) cc_library( name = "pkt_line", hdrs = ["pkt-line.h"], ) cc_library( name = "prio_queue", hdrs = ["prio-queue.h"], ) cc_library( name = "quote", hdrs = ["quote.h"], ) cc_library( name = "refs", hdrs = ["refs.h"], deps = [":commit"], ) cc_library( name = "replace_object", hdrs = ["replace-object.h"], ) cc_library( name = "repo_settings", hdrs = ["repo-settings.h"], ) cc_library( name = "repository", hdrs = ["repository.h"], deps = [ ":repo_settings", ":strmap", ], ) cc_library( name = "revision", hdrs = ["revision.h"], deps = [ ":commit", ":commit_slab_decl", ":decorate", ":diff", ":grep", ":ident", ":list_objects_filter_options", ":notes", ":oidset", ":pretty", ":strvec", ], ) cc_library( name = "commit_slab_decl", hdrs = ["commit-slab-decl.h"], ) cc_library( name = "decorate", hdrs = ["decorate.h"], ) cc_library( name = "list_objects_filter_options", hdrs = ["list-objects-filter-options.h"], ) cc_library( name = "diff", hdrs = ["diff.h"], ) cc_library( name = "pretty", hdrs = ["pretty.h"], deps = [":date"], ) cc_library( name = "date", hdrs = ["date.h"], ) cc_library( name = "grep", hdrs = ["grep.h"], deps = [ ":thread_utils", ":userdiff", ], ) cc_library( name = "userdiff", hdrs = ["userdiff.h"], deps = [":notes_cache"], ) cc_library( name = "notes_cache", hdrs = ["notes-cache.h"], deps = [":notes"], ) cc_library( name = "notes", hdrs = ["notes.h"], ) cc_library( name = "run_command", hdrs = ["run-command.h"], deps = [ ":strvec", ":thread_utils", ], ) cc_library( name = "strvec", hdrs = ["strvec.h"], ) cc_library( name = "setup", hdrs = ["setup.h"], ) cc_library( name = "sigchain", hdrs = ["sigchain.h"], ) cc_library( name = "simple_ipc", hdrs = ["simple-ipc.h"], deps = [":pkt_line"], ) cc_library( name = "statinfo", hdrs = ["statinfo.h"], ) cc_library( name = "strbuf", hdrs = ["strbuf.h"], ) cc_library( name = "string_list", hdrs = ["string-list.h"], ) cc_library( name = "strmap", hdrs = ["strmap.h"], deps = [":hashmap"], ) cc_library( name = "symlinks", hdrs = ["symlinks.h"], ) cc_library( name = "tag", hdrs = ["tag.h"], ) cc_library( name = "list", hdrs = ["list.h"], ) cc_library( name = "tempfile", hdrs = ["tempfile.h"], deps = [ ":list", ":strbuf", ], ) cc_library( name = "thread_utils", hdrs = ["thread-utils.h"], ) cc_library( name = "trace", hdrs = ["trace.h"], ) cc_library( name = "trace2", hdrs = ["trace2.h"], ) cc_library( name = "unix_socket", hdrs = ["unix-socket.h"], ) cc_library( name = "unix_stream_server", hdrs = ["unix-stream-server.h"], ) cc_library( name = "utf8", hdrs = ["utf8.h"], ) cc_library( name = "version", hdrs = ["version.h"], ) cc_library( name = "wildmatch", hdrs = ["wildmatch.h"], ) cc_library( name = "worktree", hdrs = ["worktree.h"], ) cc_library( name = "write_or_die", hdrs = ["write-or-die.h"], ) # Split libgit into layered libs so incremental rebuilds can avoid transport/http. cc_library( name = "libgit_core", srcs = [ "abspath.c", "add-interactive.c", "add-patch.c", "advice.c", "alias.c", "alloc.c", "apply.c", "archive.c", "archive-tar.c", "archive-zip.c", "attr.c", "base85.c", "bisect.c", "blame.c", "blob.c", "bloom.c", "branch.c", "bundle.c", "bundle-uri.c", "cache-tree.c", "cbtree.c", "chdir-notify.c", "checkout.c", "chunk-format.c", "color.c", "column.c", "combine-diff.c", "commit.c", "commit-graph.c", "commit-reach.c", "common-exit.c", "common-init.c", "config.c", "connected.c", "convert.c", "copy.c", "credential.c", "csum-file.c", "ctype.c", "date.c", "decorate.c", "delta-islands.c", "diff.c", "diff-delta.c", "diff-lib.c", "diff-merges.c", "diff-no-index.c", "diffcore-break.c", "diffcore-delta.c", "diffcore-order.c", "diffcore-pickaxe.c", "diffcore-rename.c", "diffcore-rotate.c", "dir.c", "dir-iterator.c", "editor.c", "entry.c", "environment.c", "exec-cmd.c", "fetch-negotiator.c", "fmt-merge-msg.c", "fsck.c", "fsmonitor.c", "fsmonitor-ipc.c", "fsmonitor-settings.c", "gettext.c", "git-zlib.c", "gpg-interface.c", "graph.c", "grep.c", "hash.c", "hash-lookup.c", "hashmap.c", "hex.c", "hex-ll.c", "hook.c", "ident.c", "json-writer.c", "kwset.c", "levenshtein.c", "line-log.c", "line-range.c", "linear-assignment.c", "list-objects.c", "list-objects-filter.c", "list-objects-filter-options.c", "lockfile.c", "log-tree.c", "loose.c", "mailinfo.c", "mailmap.c", "match-trees.c", "mem-pool.c", "merge.c", "merge-blobs.c", "merge-ll.c", "merge-ort.c", "merge-ort-wrappers.c", "midx.c", "midx-write.c", "name-hash.c", "notes.c", "notes-cache.c", "notes-merge.c", "notes-utils.c", "object.c", "object-file.c", "object-file-convert.c", "object-name.c", "odb.c", "oid-array.c", "oidmap.c", "oidset.c", "oidtree.c", "pack-bitmap.c", "pack-bitmap-write.c", "pack-check.c", "pack-mtimes.c", "pack-objects.c", "pack-refs.c", "pack-revindex.c", "pack-write.c", "packfile.c", "pager.c", "parallel-checkout.c", "parse.c", "parse-options.c", "parse-options-cb.c", "patch-delta.c", "patch-ids.c", "path.c", "path-walk.c", "pathspec.c", "pkt-line.c", "preload-index.c", "pretty.c", "prio-queue.c", "progress.c", "promisor-remote.c", "prompt.c", "prune-packed.c", "pseudo-merge.c", "quote.c", "range-diff.c", "reachable.c", "read-cache.c", "rebase.c", "rebase-interactive.c", "ref-filter.c", "reflog.c", "reflog-walk.c", "refs.c", "refspec.c", "remote.c", "repack.c", "repack-cruft.c", "repack-filtered.c", "repack-geometry.c", "repack-midx.c", "repack-promisor.c", "replace-object.c", "repo-settings.c", "repository.c", "rerere.c", "reset.c", "resolve-undo.c", "revision.c", "run-command.c", "sequencer.c", "setup.c", "sha1dc_git.c", "shallow.c", "sigchain.c", "sparse-index.c", "split-index.c", "stable-qsort.c", "statinfo.c", "strbuf.c", "string-list.c", "strmap.c", "strvec.c", "sub-process.c", "submodule.c", "submodule-config.c", "symlinks.c", "tag.c", "tempfile.c", "thread-utils.c", "tmp-objdir.c", "trace.c", "trace2.c", "trailer.c", "tree.c", "tree-diff.c", "tree-walk.c", "unix-socket.c", "unix-stream-server.c", "unpack-trees.c", "url.c", "urlmatch.c", "usage.c", "userdiff.c", "utf8.c", "varint.c", "version.c", "versioncmp.c", "walker.c", "wildmatch.c", "worktree.c", "wrapper.c", "write-or-die.c", "ws.c", "wt-status.c", "xdiff-interface.c", ], hdrs = glob(["*.h"]), copts = GIT_COPTS, deps = [ "//:generated", "//compat", "//compat/simple-ipc", "//compiler-tricks", "//ewah", "//negotiator", "//odb", "//refs", "//reftable", "//sha1dc", "//sha256", "//trace2", "//xdiff", "@curl", "@openssl//:ssl", "@zlib", ], alwayslink = True, ) cc_library( name = "libgit_transport", srcs = [ "connect.c", "fetch-pack.c", "ls-refs.c", "protocol.c", "protocol-caps.c", "send-pack.c", "serve.c", "server-info.c", "sideband.c", "transport.c", "transport-helper.c", "upload-pack.c", ], copts = GIT_COPTS, deps = [ ":libgit_core", ], alwayslink = True, ) cc_library( name = "libgit_http", srcs = [ "http.c", "http-walker.c", "remote-curl.c", ], copts = GIT_COPTS, deps = [ ":libgit_transport", "@curl", ], ) cc_library( name = "libgit", deps = [ ":libgit_core", ":libgit_http", ":libgit_transport", ], ) cc_binary( name = "git", srcs = [ "common-main.c", "git.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_transport", "//builtin", ], ) cc_binary( name = "git-daemon", srcs = [ "common-main.c", "daemon.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [":libgit_transport"], ) cc_binary( name = "git-http-backend", srcs = [ "common-main.c", "http-backend.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [":libgit_transport"], ) cc_binary( name = "git-http-fetch", srcs = [ "common-main.c", "http-fetch.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_http", ], ) cc_binary( name = "git-http-push", srcs = [ "common-main.c", "http-push.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_http", "@libexpat", ], ) cc_binary( name = "git-imap-send", srcs = [ "common-main.c", "imap-send.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_http", ], ) cc_binary( name = "git-sh-i18n--envsubst", srcs = [ "common-main.c", "sh-i18n--envsubst.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_transport", ], ) cc_binary( name = "git-shell", srcs = [ "common-main.c", "shell.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_transport", ], ) cc_binary( name = "git-remote-http", srcs = [ "common-main.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_http", ], ) [ copy_file( name = t.replace("-", "_"), src = ":git-remote-http", out = t, allow_symlink = True, is_executable = True, ) for t in [ "git-remote-ftp", "git-remote-ftps", "git-remote-https", ] ] # Server binaries aliases [ copy_file( name = t.replace("-", "_"), src = ":git", out = t, allow_symlink = True, is_executable = True, ) for t in [ "git-receive-pack", "git-upload-archive", "git-upload-pack", ] ] cc_binary( name = "scalar", srcs = [ "common-main.c", "help.c", "scalar.c", ], copts = GIT_COPTS, linkopts = GIT_LINKOPTS, deps = [ ":libgit_core", ":libgit_transport", ], ) copy_file( name = "git_merge_ours", src = ":git", out = "git-merge-ours", allow_symlink = True, is_executable = True, ) [ copy_file( name = t.replace("-", "_"), src = t + ".sh", out = t, allow_symlink = True, is_executable = True, ) for t in [ "git-merge-resolve", "git-merge-one-file", "git-merge-octopus", "git-request-pull", "git-mergetool", "git-difftool--helper", ] ] copy_file( name = "git_mergetool__lib", src = "git-mergetool--lib.sh", out = "git-mergetool--lib", allow_symlink = False, is_executable = True, ) expand_template( name = "git_perl_header", out = "GIT-PERL-HEADER", substitutions = { "@INSTLIBDIR@": "/dev/null", "@PATHSEP@": ":", }, template = "perl/header_templates/fixed_prefix.template.pl", ) genrule( name = "git_send_email", srcs = [ "git-send-email.perl", ":git_build_options", ":git_perl_header", ":git_version_file", ], outs = ["git-send-email"], cmd = """ set -euo pipefail $(location :generate_perl) \ $(location :git_build_options) \ $(location :git_version_file) \ $(location :git_perl_header) \ $(location git-send-email.perl) \ "$@" """, executable = True, tools = [":generate_perl"], )