1. 08 May, 2019 17 commits
    • Duy Nguyen's avatar
      submodule clone: use repo_config_set() · 347b232b
      Duy Nguyen authored
      Avoid direct access to $SUBMODULE/config and do it through
      repo_config_set() instead. Note that repo_submodule_init() cannot be
      used because this early in the submodule initialization process, we
      may fail to get and parse .gitmodules with submodule_from_path().
    • Duy Nguyen's avatar
      submodule deinit: support multiple worktrees · 17238436
      Duy Nguyen authored
      This is the reverse of 'init' or 'add', config from superproject is
      removed from config.worktree (or just config in standard single
      worktree setup)
    • Duy Nguyen's avatar
      submodule sync: support multiple worktrees · d8e680cb
      Duy Nguyen authored
      Both submodule.*.url and remote.*.url are stored per-worktree. If the
      remote key is already there (and shared) it will be overriden. We don't
      want to change the shared value because that might affect other
    • Duy Nguyen's avatar
      submodule update: add tests for multiple worktrees · da0740ea
      Duy Nguyen authored
      There are no changes needed for 'submodule update'. The clones will be
      per-worktree (because $GIT_DIR/modules is already per-worktree) and all
      the support is already in place. Add a test to make sure it actually
    • Duy Nguyen's avatar
      submodule init: support multiple worktrees · 3d3144ec
      Duy Nguyen authored
      The entire submodule section in the superproject will be per-worktree
      and written to $GIT_DIR/config.worktree.
      The behavior when you only have one worktree (and not enabled
      extensions.worktreeConfig) is the same as before, everything is still
      written in $GIT_DIR/config
    • Duy Nguyen's avatar
      submodule add: support multiple worktrees · 8c0f59ed
      Duy Nguyen authored
      The entire submodule section in the superproject will be per-worktree
      and written to $GIT_DIR/config.worktree.
      The behavior when you only have one worktree (and not enabled
      extensions.worktreeConfig) is the same as before, everything is still
      written in $GIT_DIR/config
      If you have multiple worktrees without extensions.worktreeConfig(),
      you'll face this message:
      fatal: submodules cannot be used with multiple working trees unless the
      config extension worktreeConfig is enabled. Please read "CONFIGURATION
      FILE" section in "git help worktree" for details
    • Duy Nguyen's avatar
      config: add --move-to[-regexp] · 790bacd8
      Duy Nguyen authored
      This option can be used to move one or multiple variables from one
      place to another, e.g. to move some aliases from repo config to user
      config, or from repo config to per-worktree config.
      This will be useful for moving config variables around, especially when
      enabling or disabling extensions.worktreeConfig (see the update in
      git-worktree.txt for a real example).
      The implementation is definitely not the best. We could lock both
      source and destination before the move, and perhaps edit these files
      just once instead of once per key. But it adds a lot more complication
      to config write code. Let's stay with something simple. We can
      optimize it later.
    • Duy Nguyen's avatar
      config: factor out set_config_source_file() · 663c797b
      Duy Nguyen authored
      In the next patch, "config" is taught to move some config variables
      from one file to another. We need to specify two locations, source and
      destination, and the plan is reusing the same --global/--local/...
      option. Factor this code out for reuse later.
    • Duy Nguyen's avatar
      config: use OPT_FILENAME() · 66445664
      Duy Nguyen authored
      Do not handle prefix directly. It's simpler to use OPT_FILENAME()
      instead. The othe reason for doing this is because this code (where
      the deleted code is) will be factored out and called when "prefix" is
      not available.
    • Duy Nguyen's avatar
      config.c: add repo_config_set_worktree_gently() · 5e3dc992
      Duy Nguyen authored
      This is C equivalent of "git config --set --worktree". In other words,
      it will
      - write to $GIT_DIR/config in single-worktree setup
      - write to $GIT_COMMON_DIR/worktrees/<x>/config.worktree or
        $GIT_COMMON_DIR/config.worktree (for main worktree)
        if extensions.worktreeConfig is enabled
      - return error in multiple-worktree setup if extensions.worktreeConfig
        is not enabled.
      While at there, also add repo_config_set*() for writing to
      Note, since git_config_set_multivar_in_file_gently() only invalidates
      the config set of the_repository, anybody who uses these functions on
      submodules must do additional invalidation if needed.
    • Duy Nguyen's avatar
      worktree.c: add get_worktree_config() · 68011f27
      Duy Nguyen authored
      "git config --worktree" can write to the write file whether
      extensions.worktreeConfig is enabled or not. In order to do the same
      using config API, we need to determine the right file to write to. Add
      this function for that purpose. This is the basis for the coming
    • Duy Nguyen's avatar
      worktree.c: add repo_get_worktrees() · 9be095a6
      Duy Nguyen authored
    • Duy Nguyen's avatar
    • Duy Nguyen's avatar
      config.c: avoid git_path() in do_git_config_sequence() · 7d8693d7
      Duy Nguyen authored
      This function has both $GIT_COMMON_DIR and $GIT_DIR in "opts". Use it
      to construct config.worktree path instead because git_pathdup() is
      tied to the current worktree, but the given $GIT_DIR could be from
      another one.
    • Duy Nguyen's avatar
      refs.c: remove the_repo from get_worktree_ref_store() · 72094582
      Duy Nguyen authored
      This will allow us access to a specific worktree of any
      repository (i.e. a submodule, most likely). Also one less global variable to
    • Duy Nguyen's avatar
      path.c: add repo_git_common_path() · d6a25a10
      Duy Nguyen authored
      This is a more generic version of git_common_path() where the_repo is
      not implied. It will be used where we do not rely on the_repo
    • Duy Nguyen's avatar
      doc: outline how submodules work with multi worktrees · 07a84fe5
      Duy Nguyen authored
      This lays out the very first step of making multiple worktrees and
      submodules work together. No actual changes are here. And real changes
      are not even in the very next patches since they are cleanup and
      preparation patches.
      When a submodule is added to a superproject, the superproject's config
      file records info related to the submodule in its config file. The
      submodule's config file also has core.worktree to point back to the
      submodule worktree's location.
      Since config files are shared without extensions.worktreeConfig, adding
      a secondary superproject or submodule worktree will run into trouble [1].
      The problem could be solved with extensions.worktreeConfig and we keep
      per-worktree config in config.worktree files, both at superproject
      (submodule.*.*) and submodule (core.worktree) levels.
      The whole directory layout would look like this. This shows how
      multiple worktrees of a submodule or a supermodule are organized:
          config                           contains shared submodule.*
          config.worktree                  contains submodule.sub1.*
                                           for the main worktree
            super1/                   (1)
              config.worktree              submodule.sub1.* for super1
                sub1/                 (2)
                  config.worktree          contains core.worktree
                  objects/            (3)
                  worktrees/          (4)
            super2/                   (5)
              config.worktree              submodule.sub1.* for super2
                sub1/                 (6)
                  config.worktree          contains core.worktree
                  objects/            (7)
          .git                     -> (1)
            .git                   -> (2)
            .git                   -> (4)/wt1
            .git                   -> (4)/wt2
          .git                     -> (5)
            .git                   -> (6)
      This directory layout works, but not optimal. Submodule clones (inside
      the "modules" directory) are per-worktree. If you have two
      superproject worktrees that contain a submodule, you need space for
      _two_ clones, e.g. the object databases (3) and (7) are almost
      identical, but they are still duplicated.
      This is definitely not elegant. The tentative plan is to move the
      clones to a common tree like below. This is however just an idea and
      not implemented in this series.
          config                           contains shared submodule.*
              sub1/                   (0)
                objects/              (shared)
                  super1/             (2)
                  super1-wt1/         (4)/wt1
                  super1-wt2/         (4)/wt2
                  super2/             (6)
            super1/                   (1)
              config.worktree              submodule.sub1.* for super1
            super2/                   (5)
              config.worktree              submodule.sub1.* for super2
      The subtree (0) is shared across all worktrees because it's inside
      "common/" directory. Once we keep the clone in a common place like
      this, the submodule's worktree can be created and managed with
      Another good point about this approach is we could finally safely
      allow "git worktree remove" to work with submodules. With current
      solution, removing $GIT_COMMON_DIR/worktrees/X directory means also
      removing potentially precious clones inside the "modules" subdir.
      But whether we can do this depends on:
      - if we need separate ref namespace for submodule on each worktree.
        Use cases that can share ref namespace will work best.
      - how does submodule's worktrees interact these worktrees
      - handling nested submodules can get very messy (or not?)
      This series does not attempt to implement subtree (0) at all. Once we
      get submodules and worktrees work well together (even wasteful of disk
      space), we can start thinking about absorbing clones back to common/
      [1] It's milder for secondary submodule worktree because core.worktree
          will not be shared (core.worktree by default is only visible to
          the main worktree). But then the second worktree cannot have its
          own core.worktree.
  2. 25 Apr, 2019 23 commits
    • Junio C Hamano's avatar
      The seventh batch · 83232e38
      Junio C Hamano authored
      Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
    • Junio C Hamano's avatar
      Merge branch 'js/macos-gettext-build' · aa8c8d91
      Junio C Hamano authored
      Build with gettext breaks on recent macOS w/ Homebrew when
      /usr/local/bin is not on PATH, which has been corrected.
      * js/macos-gettext-build:
        macOS: make sure that gettext is found
    • Junio C Hamano's avatar
      Merge branch 'bs/sendemail-tighten-anything-by' · 061ed420
      Junio C Hamano authored
      The recently added feature to add addresses that are on
      anything-by: trailers in 'git send-email' was found to be way too
      eager and considered nonsense strings as if they can be legitimate
      beginning of *-by: trailer.  This has been tightened.
      * bs/sendemail-tighten-anything-by:
        send-email: don't cc *-by lines with '-' prefix
    • Junio C Hamano's avatar
      Merge branch 'bc/send-email-qp-cr' · 5983ddc1
      Junio C Hamano authored
      "git send-email" has been taught to use quoted-printable when the
      payload contains carriage-return.  The use of the mechanism is in
      line with the design originally added the codepath that chooses QP
      when the payload has overly long lines.
      * bc/send-email-qp-cr:
        send-email: default to quoted-printable when CR is present
    • Junio C Hamano's avatar
      Merge branch 'nd/submodule-foreach-quiet' · f1c9f6ce
      Junio C Hamano authored
      "git submodule foreach <command> --quiet" did not pass the option
      down correctly, which has been corrected.
      * nd/submodule-foreach-quiet:
        submodule foreach: fix "<command> --quiet" not being respected
    • Junio C Hamano's avatar
      Merge branch 'js/iso8895-test-on-apfs' · 5c2b4ca0
      Junio C Hamano authored
      Test fix on APFS that is incapable of store paths in Latin-1.
      * js/iso8895-test-on-apfs:
        t9822: skip tests if file names cannot be ISO-8859-1 encoded
    • Junio C Hamano's avatar
      Merge branch 'jc/gettext-test-fix' · 49f50f58
      Junio C Hamano authored
      The GETTEXT_POISON test option has been quite broken ever since it
      was made runtime-tunable, which has been fixed.
      * jc/gettext-test-fix:
        gettext tests: export the restored GIT_TEST_GETTEXT_POISON
    • Junio C Hamano's avatar
      Merge branch 'jk/fetch-reachability-error-fix' · 57a6b932
      Junio C Hamano authored
      Code clean-up and a fix for "git fetch" by an explicit object name
      (as opposed to fetching refs by name).
      * jk/fetch-reachability-error-fix:
        fetch: do not consider peeled tags as advertised tips
        remote.c: make singular free_ref() public
        fetch: use free_refs()
        pkt-line: prepare buffer before handling ERR packets
        upload-pack: send ERR packet for non-tip objects
        t5530: check protocol response for "not our ref"
        t5516: drop ok=sigpipe from unreachable-want tests
    • Junio C Hamano's avatar
      Merge branch 'jk/xmalloc' · 449f2db7
      Junio C Hamano authored
      The code is updated to check the result of memory allocation before
      it is used in more places, by using xmalloc and/or xcalloc calls.
      * jk/xmalloc:
        progress: use xmalloc/xcalloc
        xdiff: use xmalloc/xrealloc
        xdiff: use git-compat-util
        test-prio-queue: use xmalloc
    • Junio C Hamano's avatar
      Merge branch 'km/t3000-retitle' · c8e8b5c3
      Junio C Hamano authored
      A test update.
      * km/t3000-retitle:
        t3000 (ls-files -o): widen description to reflect current tests
    • Junio C Hamano's avatar
      Merge branch 'js/untracked-cache-allocfix' · 0830eac1
      Junio C Hamano authored
      An underallocation in the code to read the untracked cache
      extension has been corrected.
      * js/untracked-cache-allocfix:
        untracked cache: fix off-by-one
    • Junio C Hamano's avatar
      Merge branch 'js/t3301-unbreak-notes-test' · af152bd5
      Junio C Hamano authored
      Test fix.
      * js/t3301-unbreak-notes-test:
        t3301: fix false negative
    • Junio C Hamano's avatar
      Merge branch 'tz/doc-apostrophe-no-longer-needed' · c42986f4
      Junio C Hamano authored
      Doc formatting fix.
      * tz/doc-apostrophe-no-longer-needed:
        Documentation/git-show-branch: avoid literal {apostrophe}
    • Junio C Hamano's avatar
      Merge branch 'sg/blame-in-bare-start-at-head' · d8620d3c
      Junio C Hamano authored
      "git blame -- path" in a non-bare repository starts blaming from
      the working tree, and the same command in a bare repository errors
      out because there is no working tree by definition.  The command
      has been taught to instead start blaming from the commit at HEAD,
      which is more useful.
      * sg/blame-in-bare-start-at-head:
        blame: default to HEAD in a bare repo when no start commit is given
    • Junio C Hamano's avatar
      Merge branch 'tg/ls-files-debug-format-fix' · 503f5809
      Junio C Hamano authored
      Debugging code fix.
      * tg/ls-files-debug-format-fix:
        ls-files: use correct format string
    • Junio C Hamano's avatar
      Merge branch 'po/describe-not-necessarily-7' · 18c3ae0d
      Junio C Hamano authored
      * po/describe-not-necessarily-7:
        describe doc: remove '7-char' abbreviation reference
    • Junio C Hamano's avatar
      Merge branch 'po/rerere-doc-fmt' · 98a8fcc8
      Junio C Hamano authored
      * po/rerere-doc-fmt:
        rerere doc: quote `rerere.enabled`
    • Junio C Hamano's avatar
      Merge branch 'sg/overlong-progress-fix' · 425e51e5
      Junio C Hamano authored
      Updating the display with progress message has been cleaned up to
      deal better with overlong messages.
      * sg/overlong-progress-fix:
        progress: break too long progress bar lines
        progress: clear previous progress update dynamically
        progress: assemble percentage and counters in a strbuf before printing
        progress: make display_progress() return void
    • Junio C Hamano's avatar
      Merge branch 'jt/batch-fetch-blobs-in-diff' · 32dc15de
      Junio C Hamano authored
      While running "git diff" in a lazy clone, we can upfront know which
      missing blobs we will need, instead of waiting for the on-demand
      machinery to discover them one by one.  Aim to achieve better
      performance by batching the request for these promised blobs.
      * jt/batch-fetch-blobs-in-diff:
        diff: batch fetching of missing blobs
        sha1-file: support OBJECT_INFO_FOR_PREFETCH
    • Junio C Hamano's avatar
      Merge branch 'ab/gc-docs' · ac70c531
      Junio C Hamano authored
      Update docs around "gc".
      * ab/gc-docs:
        gc docs: remove incorrect reference to gc.auto=0
        gc docs: clarify that "gc" doesn't throw away referenced objects
        gc docs: note "gc --aggressive" in "fast-import"
        gc docs: downplay the usefulness of --aggressive
        gc docs: note how --aggressive impacts --window & --depth
        gc docs: fix formatting for "gc.writeCommitGraph"
        gc docs: re-flow the "gc.*" section in "config"
        gc docs: include the "gc.*" section from "config" in "gc"
        gc docs: clean grammar for "gc.bigPackThreshold"
        gc docs: stop noting "repack" flags
        gc docs: modernize the advice for manually running "gc"
    • Junio C Hamano's avatar
      Merge branch 'dl/submodule-set-branch' · 01f8d788
      Junio C Hamano authored
      "git submodule" learns "set-branch" subcommand that allows the
      submodule.*.branch settings to be modified.
      * dl/submodule-set-branch:
        submodule: teach set-branch subcommand
        submodule--helper: teach config subcommand --unset
        git-submodule.txt: "--branch <branch>" option defaults to 'master'
    • Junio C Hamano's avatar
      Merge branch 'jk/revision-rewritten-parents-in-prio-queue' · d9d65e9f
      Junio C Hamano authored
      Performance fix for "rev-list --parents -- pathspec".
      * jk/revision-rewritten-parents-in-prio-queue:
        revision: use a prio_queue to hold rewritten parents
    • Junio C Hamano's avatar
      Merge branch 'dk/blame-keep-origin-blob' · 4d8c4da9
      Junio C Hamano authored
      Performance fix around "git blame", especially in a linear history
      (which is the norm we should optimize for).
      * dk/blame-keep-origin-blob:
        blame.c: don't drop origin blobs as eagerly