Skip to content
/ focus Public

Focus aligns Git worktree content based on outlines of a repository's Bazel build graph. Focused repos are sparse, shallow, and thin and unlock markedly better performance in large repos.

License

Notifications You must be signed in to change notification settings

twitter/focus

Repository files navigation

Focused Development

focus is a tool to manage Git sparse checkouts derived from the Bazel build graph.

Installation

focus is written in Rust and supports macOS and Linux. Git v2.35+ and Bazel need to be installed in the PATH env. General

MacOS Prerequisites

Install Bazel

Install Git > 2.35

Warning: If you run a cargo test you may run out of file descriptors. On MacOS you will need to use ulimit -n X to set a large file limit for the current shell. On macOS Big Sur, you can write a plist to do this permanently:

Write the following to a file named /Library/LaunchDaemons/limit.maxfiles.plist (hint: you'll need to invoke your editor with sudo because this file is protected):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
    <dict>
      <key>Label</key>
        <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
        <array>
	  <string>sudo</string>
          <string>launchctl</string>
          <string>limit</string>
          <string>maxfiles</string>
          <string>655360</string>
          <string>1048576</string>
        </array>
      <key>RunAtLoad</key>
        <true />
    </dict>
  </plist>

then load it with sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist. This seems to work better if you restart your Mac.

Note: these instructions are from a GitHub issue gradle/gradle#17274. Thanks to those folks.

Linux Prerequisites

Install Git: Git 2.35+: get this through your distro's package manager or download pre-built binaries or sources here.

Install Bazel: You'll need Bazel installed. See these instructions for details on how to install on mainstream Linux distros. Alternative distros probably have a reasonable Bazel package available by now.

Common

Install Rust, then install focus with

$ cargo install --locked --git https://github.com/twitter/focus

Usage

If you are the repository administrator, first configure focus for your repo using the Administration instructions.

For end-users, see Usage for instructions on how to use focus to manage your sparse checkouts.

For new or curious users, see Bazel Tutorial for instructions on how to try focus on the bazel repository itself.

Design

See various design documents at https://github.com/twitter/focus/tree/main/focus/doc. Focus was presented at Git Merge 2022; see the slides here.

About

Focus aligns Git worktree content based on outlines of a repository's Bazel build graph. Focused repos are sparse, shallow, and thin and unlock markedly better performance in large repos.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages