Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 19, 2015
  1. @gitster

    Merge branch 'nd/dwim-wildcards-as-pathspecs'

    gitster authored
    A heuristic to help the "git <cmd> <revs> <pathspec>" command line
    convention to catch mistyped paths is to make sure all the non-rev
    parameters in the later part of the command line are names of the
    files in the working tree, but that means "git grep $str -- \*.c"
    must always be disambiguated with "--", because nobody sane will
    create a file whose name literally is asterisk-dot-see.  Loosen the
    heuristic to declare that with a wildcard string the user likely
    meant to give us a pathspec.
    
    * nd/dwim-wildcards-as-pathspecs:
      pathspec: avoid the need of "--" when wildcard is used
Commits on May 3, 2015
  1. @pclouds @gitster

    pathspec: avoid the need of "--" when wildcard is used

    pclouds authored gitster committed
    When "--" is lacking from the command line and a command can take
    both revs and paths, the idea is if an argument can be seen as both
    an extended SHA-1 and a path, then "--" is required or git refuses
    to continue. It's currently implemented as:
    
     (1) if an argument is rev, then it must not exist in worktree
    
     (2) else, it must exist in worktree
    
     (3) else, "--" is required.
    
    These rules work for literal paths, but when non-literal pathspec is
    involved, it almost always requires the user to add "--" because it
    fails (2) and (1) is really rarely met (take "*.c" for example, (1)
    is met if there is a ref named "*.c").
    
    This patch modifies the rules a bit by considering any valid (*)
    wildcard pathspec "exist in worktree". The rules become:
    
     (1) if an arg is a rev, then it must either exist in worktree or
         not be a valid wildcard pathspec.
    
     (2) else, it either exists in worktree or is a wildcard pathspec
    
     (3) else, "--" is required.
    
    With the new rules, "--" is not needed most of the time when
    wildcard pathspec is involved.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 1, 2014
  1. @pclouds @gitster

    prune: strategies for linked checkouts

    pclouds authored gitster committed
    (alias R=$GIT_COMMON_DIR/worktrees/<id>)
    
     - linked checkouts are supposed to keep its location in $R/gitdir up
       to date. The use case is auto fixup after a manual checkout move.
    
     - linked checkouts are supposed to update mtime of $R/gitdir. If
       $R/gitdir's mtime is older than a limit, and it points to nowhere,
       worktrees/<id> is to be pruned.
    
     - If $R/locked exists, worktrees/<id> is not supposed to be pruned. If
       $R/locked exists and $R/gitdir's mtime is older than a really long
       limit, warn about old unused repo.
    
     - "git checkout --to" is supposed to make a hard link named $R/link
       pointing to the .git file on supported file systems to help detect
       the user manually deleting the checkout. If $R/link exists and its
       link count is greated than 1, the repo is kept.
    
    Helped-by: Marc Branchaud <marcnarc@xiplink.com>
    Helped-by: Eric Sunshine <sunshine@sunshineco.com>
    Helped-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @pclouds @gitster

    setup.c: support multi-checkout repo setup

    pclouds authored gitster committed
    The repo setup procedure is updated to detect $GIT_DIR/commondir and
    set $GIT_COMMON_DIR properly.
    
    The core.worktree is ignored when $GIT_COMMON_DIR is set. This is
    because the config file is shared in multi-checkout setup, but
    checkout directories _are_ different. Making core.worktree effective
    in all checkouts mean it's back to a single checkout.
    
    Helped-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @pclouds @gitster

    setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()

    pclouds authored gitster committed
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @pclouds @gitster

    setup.c: convert check_repository_format_gently to use strbuf

    pclouds authored gitster committed
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. @pclouds @gitster

    setup.c: detect $GIT_COMMON_DIR in is_git_directory()

    pclouds authored gitster committed
    If the file "$GIT_DIR/commondir" exists, it contains the value of
    $GIT_COMMON_DIR.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. @pclouds @gitster

    setup.c: convert is_git_directory() to use strbuf

    pclouds authored gitster committed
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 2, 2014
  1. @gitster

    Merge branch 'rs/strbuf-getcwd'

    gitster authored
    Reduce the use of fixed sized buffer passed to getcwd() calls
    by introducing xgetcwd() helper.
    
    * rs/strbuf-getcwd:
      use strbuf_add_absolute_path() to add absolute paths
      abspath: convert absolute_path() to strbuf
      use xgetcwd() to set $GIT_DIR
      use xgetcwd() to get the current directory or die
      wrapper: add xgetcwd()
      abspath: convert real_path_internal() to strbuf
      abspath: use strbuf_getcwd() to remember original working directory
      setup: convert setup_git_directory_gently_1 et al. to strbuf
      unix-sockets: use strbuf_getcwd()
      strbuf: add strbuf_getcwd()
Commits on Aug 26, 2014
  1. @gitster

    use xgetcwd() to get the current directory or die

    René Scharfe authored gitster committed
    Convert several calls of getcwd() and die() to use xgetcwd() instead.
    This way we get rid of fixed-size buffers (which can be too small
    depending on the used file system) and gain consistent error messages.
    
    Signed-off-by: Rene Scharfe <l.s.r@web.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    setup: convert setup_git_directory_gently_1 et al. to strbuf

    René Scharfe authored gitster committed
    Convert setup_git_directory_gently_1() and its helper functions
    setup_explicit_git_dir(), setup_discovered_git_dir() and
    setup_bare_git_dir() to use a struct strbuf to hold the current working
    directory.  Replacing the PATH_MAX-sized buffer used before removes a
    path length limition on some file systems.  The functions are converted
    all in one go because they all read and write the variable cwd.
    
    Signed-off-by: Rene Scharfe <l.s.r@web.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 29, 2014
  1. @tanayabh @gitster

    add `config_set` API for caching config-like files

    tanayabh authored gitster committed
    Currently `git_config()` uses a callback mechanism and file rereads for
    config values. Due to this approach, it is not uncommon for the config
    files to be parsed several times during the run of a git program, with
    different callbacks picking out different variables useful to themselves.
    
    Add a `config_set`, that can be used to construct an in-memory cache for
    config-like files that the caller specifies (i.e., files like `.gitmodules`,
    `~/.gitconfig` etc.). Add two external functions `git_configset_get_value`
    and `git_configset_get_value_multi` for querying from the config sets.
    `git_configset_get_value` follows `last one wins` semantic (i.e. if there
    are multiple matches for the queried key in the files of the configset the
    value returned will be the last entry in `value_list`).
    `git_configset_get_value_multi` returns a list of values sorted in order of
    increasing priority (i.e. last match will be at the end of the list). Add
    type specific query functions like `git_configset_get_bool` and similar.
    
    Add a default `config_set`, `the_config_set` to cache all key-value pairs
    read from usual config files (repo specific .git/config, user wide
    ~/.gitconfig, XDG config and the global /etc/gitconfig). `the_config_set`
    is populated using `git_config()`.
    
    Add two external functions `git_config_get_value` and
    `git_config_get_value_multi` for querying in a non-callback manner from
    `the_config_set`. Also, add type specific query functions that are
    implemented as a thin wrapper around the `config_set` API.
    
    Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
    Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 2, 2014
  1. @gitster

    Merge branch 'mw/symlinks'

    gitster authored
    A finishing touch fix to a new change already in 'master'.
    
    * mw/symlinks:
      setup: fix windows path buffer over-stepping
Commits on Apr 24, 2014
  1. @ienorand @gitster

    setup: fix windows path buffer over-stepping

    ienorand authored gitster committed
    Fix a buffer over-stepping issue triggered by providing an absolute path
    that is similar to the work tree path.
    
    abspath_part_inside_repo() may currently increment the path pointer by
    offset_1st_component() + wtlen, which is too much, since
    offset_1st_component() is a subset of wtlen.
    
    For the *nix-style prefix '/', this does (by luck) not cause any issues,
    since offset_1st_component() is 1 and there will always be a '/' or '\0'
    that can "absorb" this.
    
    In the case of DOS-style prefixes though, the offset_1st_component() is
    3 and this can potentially over-step the string buffer. For example if
    
        work_tree = "c:/r"
        path      = "c:/rl"
    
    Then wtlen is 4, and incrementing the path pointer by (3 + 4) would
    end up 2 bytes outside a string buffer of length 6.
    
    Similarly if
    
        work_tree = "c:/r"
        path      = "c:/rl/d/a"
    
    Then (since the loop starts by also incrementing the pointer one step),
    this would mean that the function would miss checking if "c:/rl/d" could
    be the work_tree, arguably this is unlikely though, since it would only
    be possible with symlinks on windows.
    
    Fix this by simply avoiding to increment by offset_1st_component() and
    wtlen at the same time.
    
    Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 5, 2014
  1. @gitster

    Merge branch 'nd/daemonize-gc'

    gitster authored
    Allow running "gc --auto" in the background.
    
    * nd/daemonize-gc:
      gc: config option for running --auto in background
      daemon: move daemonize() to libgit.a
Commits on Feb 27, 2014
  1. @gitster

    Merge branch 'mw/symlinks'

    gitster authored
    All subcommands that take pathspecs mishandled an in-tree symbolic
    link when given it as a full path from the root (which arguably is
    a sick way to use pathspecs).  "git ls-files -s $(pwd)/RelNotes" in
    our tree is an easy reproduction recipe.
    
    * mw/symlinks:
      setup: don't dereference in-tree symlinks for absolute paths
      setup: add abspath_part_inside_repo() function
      t0060: add tests for prefix_path when path begins with work tree
      t0060: add test for prefix_path when path == work tree
      t0060: add test for prefix_path on symlinks via absolute paths
      t3004: add test for ls-files on symlinks via absolute paths
Commits on Feb 10, 2014
  1. @pclouds @gitster

    daemon: move daemonize() to libgit.a

    pclouds authored gitster committed
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 4, 2014
  1. @ienorand @gitster

    setup: don't dereference in-tree symlinks for absolute paths

    ienorand authored gitster committed
    The prefix_path_gently() function currently applies real_path to
    everything if given an absolute path, dereferencing symlinks both
    outside and inside the work tree.
    
    This causes most high-level functions to misbehave when acting on
    symlinks given via absolute paths. For example
    
    	$ git add /dir/repo/symlink
    
    attempts to add the target of the symlink rather than the symlink
    itself, which is usually not what the user intends to do.
    
    In order to manipulate symlinks in the work tree using absolute paths,
    symlinks should only be dereferenced outside the work tree.
    
    Modify the prefix_path_gently() to first normalize the path in order to
    make sure path levels are separated by '/', then pass the result to
    'abspath_part_inside_repo' to find the part inside the work tree
    (without dereferencing any symlinks inside the work tree).
    
    For absolute paths, prefix_path_gently() did not, nor does now do, any
    actual prefixing, hence the result from abspath_part_in_repo() is
    returned as-is.
    
    Fixes t0060-82 and t3004-5.
    
    Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
    Reviewed-by: Duy Nguyen <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @ienorand @gitster

    setup: add abspath_part_inside_repo() function

    ienorand authored gitster committed
    In order to extract the part of an absolute path which lies inside the
    repo, it is not possible to directly use real_path, since that would
    dereference symlinks both outside and inside the work tree.
    
    Add an abspath_part_inside_repo() function which first checks if the
    work tree is already the prefix, then incrementally checks each path
    level by temporarily NUL-terminating at each '/' and comparing against
    the work tree path. If a match is found, it overwrites the input path
    with the remainder past the work tree (which will be the part inside the
    work tree).
    
    This function is currently only intended for use in
    'prefix_path_gently'.
    
    Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
    Reviewed-by: Duy Nguyen <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 5, 2013
  1. @chriscool @gitster

    replace {pre,suf}fixcmp() with {starts,ends}_with()

    chriscool authored gitster committed
    Leaving only the function definitions and declarations so that any
    new topic in flight can still make use of the old functions, replace
    existing uses of the prefixcmp() and suffixcmp() with new API
    functions.
    
    The change can be recreated by mechanically applying this:
    
        $ git grep -l -e prefixcmp -e suffixcmp -- \*.c |
          grep -v strbuf\\.c |
          xargs perl -pi -e '
            s|!prefixcmp\(|starts_with\(|g;
            s|prefixcmp\(|!starts_with\(|g;
            s|!suffixcmp\(|ends_with\(|g;
            s|suffixcmp\(|!ends_with\(|g;
          '
    
    on the result of preparatory changes in this series.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 31, 2013
  1. @felipec @gitster

    setup: trivial style fixes

    felipec authored gitster committed
    Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 28, 2013
  1. @gitster

    Merge branch 'jx/relative-path-regression-fix'

    gitster authored
    * jx/relative-path-regression-fix:
      Use simpler relative_path when set_git_dir
      relative_path should honor dos-drive-prefix
      test: use unambigous leading path (/foo) for MSYS
Commits on Oct 14, 2013
  1. @jiangxin @jrn

    Use simpler relative_path when set_git_dir

    jiangxin authored jrn committed
    Using a relative_path as git_dir first appears in v1.5.6-1-g044bbbc.
    It will make git_dir shorter only if git_dir is inside work_tree,
    and this will increase performance. But my last refactor effort on
    relative_path function (commit v1.8.3-rc2-12-ge02ca72) changed that.
    Always use relative_path as git_dir may bring troubles like
    $gmane/234434.
    
    Because new relative_path is a combination of original relative_path
    from path.c and original path_relative from quote.c, so in order to
    restore the origin implementation, save the original relative_path
    as remove_leading_path, and call it in setup.c.
    
    Suggested-by: Karsten Blees <karsten.blees@gmail.com>
    Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Commits on Sep 9, 2013
  1. @gitster

    Merge branch 'jl/submodule-mv'

    gitster authored
    "git mv A B" when moving a submodule A does "the right thing",
    inclusing relocating its working tree and adjusting the paths in
    the .gitmodules file.
    
    * jl/submodule-mv: (53 commits)
      rm: delete .gitmodules entry of submodules removed from the work tree
      mv: update the path entry in .gitmodules for moved submodules
      submodule.c: add .gitmodules staging helper functions
      mv: move submodules using a gitfile
      mv: move submodules together with their work trees
      rm: do not set a variable twice without intermediate reading.
      t6131 - skip tests if on case-insensitive file system
      parse_pathspec: accept :(icase)path syntax
      pathspec: support :(glob) syntax
      pathspec: make --literal-pathspecs disable pathspec magic
      pathspec: support :(literal) syntax for noglob pathspec
      kill limit_pathspec_to_literal() as it's only used by parse_pathspec()
      parse_pathspec: preserve prefix length via PATHSPEC_PREFIX_ORIGIN
      parse_pathspec: make sure the prefix part is wildcard-free
      rename field "raw" to "_raw" in struct pathspec
      tree-diff: remove the use of pathspec's raw[] in follow-rename codepath
      remove match_pathspec() in favor of match_pathspec_depth()
      remove init_pathspec() in favor of parse_pathspec()
      remove diff_tree_{setup,release}_paths
      convert common_prefix() to use struct pathspec
      ...
Commits on Jul 22, 2013
  1. @gitster

    Merge branch 'jx/clean-interactive'

    gitster authored
    Add "interactive" mode to "git clean".
    
    The early part to refactor relative path related helper functions
    looked sensible.
    
    * jx/clean-interactive:
      test: run testcases with POSIX absolute paths on Windows
      test: add t7301 for git-clean--interactive
      git-clean: add documentation for interactive git-clean
      git-clean: add ask each interactive action
      git-clean: add select by numbers interactive action
      git-clean: add filter by pattern interactive action
      git-clean: use a git-add-interactive compatible UI
      git-clean: add colors to interactive git-clean
      git-clean: show items of del_list in columns
      git-clean: add support for -i/--interactive
      git-clean: refactor git-clean into two phases
      write_name{_quoted_relative,}(): remove redundant parameters
      quote_path_relative(): remove redundant parameter
      quote.c: substitute path_relative with relative_path
      path.c: refactor relative_path(), not only strip prefix
      test: add test cases for relative_path
  2. @gitster

    Merge branch 'tr/protect-low-3-fds'

    gitster authored
    When "git" is spawned in such a way that any of the low 3 file
    descriptors is closed, our first open() may yield file descriptor 2,
    and writing error message to it would screw things up in a big way.
    
    * tr/protect-low-3-fds:
      git: ensure 0/1/2 are open in main()
      daemon/shell: refactor redirection of 0/1/2 from /dev/null
Commits on Jul 17, 2013
  1. @gitster

    daemon/shell: refactor redirection of 0/1/2 from /dev/null

    Thomas Rast authored gitster committed
    Both daemon.c and shell.c contain logic to open FDs 0/1/2 from
    /dev/null if they are not already open.  Move the function in daemon.c
    to setup.c and use it in shell.c, too.
    
    While there, remove a 'not' that inverted the meaning of the comment.
    The point is indeed to *avoid* messing up.
    
    Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 15, 2013
  1. @pclouds @gitster

    parse_pathspec: make sure the prefix part is wildcard-free

    pclouds authored gitster committed
    Prepending prefix to pathspec is a trick to workaround the fact that
    commands can be executed in a subdirectory, but all git commands run
    at worktree's root. The prefix part should always be treated as
    literal string. Make it so.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @pclouds @gitster

    move struct pathspec and related functions to pathspec.[ch]

    pclouds authored gitster committed
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 26, 2013
  1. @jiangxin @gitster

    path.c: refactor relative_path(), not only strip prefix

    jiangxin authored gitster committed
    Original design of relative_path() is simple, just strip the prefix
    (*base) from the absolute path (*abs).
    
    In most cases, we need a real relative path, such as: ../foo,
    ../../bar.  That's why there is another reimplementation
    (path_relative()) in quote.c.
    
    Borrow some codes from path_relative() in quote.c to refactor
    relative_path() in path.c, so that it could return real relative
    path, and user can reuse this function without reimplementing
    his/her own.  The function path_relative() in quote.c will be
    substituted, and I would use the new relative_path() function when
    implementing the interactive git-clean later.
    
    Different results for relative_path() before and after this refactor:
    
        abs path  base path  relative (original)  relative (refactor)
        ========  =========  ===================  ===================
        /a/b      /a/b       .                    ./
        /a/b/     /a/b       .                    ./
        /a        /a/b/      /a                   ../
        /         /a/b/      /                    ../../
        /a/c      /a/b/      /a/c                 ../c
        /x/y      /a/b/      /x/y                 ../../x/y
    
        a/b/      a/b/       .                    ./
        a/b/      a/b        .                    ./
        a         a/b        a                    ../
        x/y       a/b/       x/y                  ../../x/y
        a/c       a/b        a/c                  ../c
    
        (empty)   (null)     (empty)              ./
        (empty)   (empty)    (empty)              ./
        (empty)   /a/b       (empty)              ./
        (null)    (null)     (null)               ./
        (null)    (empty)    (null)               ./
        (null)    /a/b       (segfault)           ./
    
    You may notice that return value "." has been changed to "./".
    It is because:
    
     * Function quote_path_relative() in quote.c will show the relative
       path as "./" if abs(in) and base(prefix) are the same.
    
     * Function relative_path() is called only once (in setup.c), and
       it will be OK for the return value as "./" instead of ".".
    
    Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 25, 2013
  1. @gitster

    Merge branch 'lf/setup-prefix-pathspec'

    gitster authored
    "git cmd -- ':(top'" was not diagnosed as an invalid syntax, and
    instead the parser kept reading beyond the end of the string.
    
    * lf/setup-prefix-pathspec:
      setup.c: check that the pathspec magic ends with ")"
      setup.c: stop prefix_pathspec() from looping past the end of string
  2. @gitster

    Merge branch 'jk/alias-in-bare'

    gitster authored
    An aliased command spawned from a bare repository that does not say
    it is bare with "core.bare = yes" is treated as non-bare by mistake.
    
    * jk/alias-in-bare:
      setup: suppress implicit "." work-tree for bare repos
      environment: add GIT_PREFIX to local_repo_env
      cache.h: drop LOCAL_REPO_ENV_SIZE
Commits on Mar 14, 2013
  1. @andrewkww @gitster

    setup.c: check that the pathspec magic ends with ")"

    andrewkww authored gitster committed
    The previous code did not diagnose an incorrectly spelled ":(top"
    as an error.
    
    Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @andrewkww @gitster

    setup.c: stop prefix_pathspec() from looping past the end of string

    andrewkww authored gitster committed
    The code assumes that the string ends at either `)` or `,`, and does
    not handle the case where strcspn() returns length due to end of
    string.  So specifying ":(top" as pathspec will cause the loop to go
    past the end of string.
    
    Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 8, 2013
  1. @peff @gitster

    setup: suppress implicit "." work-tree for bare repos

    peff authored gitster committed
    If an explicit GIT_DIR is given without a working tree, we
    implicitly assume that the current working directory should
    be used as the working tree. E.g.,:
    
      GIT_DIR=/some/repo.git git status
    
    would compare against the cwd.
    
    Unfortunately, we fool this rule for sub-invocations of git
    by setting GIT_DIR internally ourselves. For example:
    
      git init foo
      cd foo/.git
      git status ;# fails, as we expect
      git config alias.st status
      git status ;# does not fail, but should
    
    What happens is that we run setup_git_directory when doing
    alias lookup (since we need to see the config), set GIT_DIR
    as a result, and then leave GIT_WORK_TREE blank (because we
    do not have one). Then when we actually run the status
    command, we do setup_git_directory again, which sees our
    explicit GIT_DIR and uses the cwd as an implicit worktree.
    
    It's tempting to argue that we should be suppressing that
    second invocation of setup_git_directory, as it could use
    the values we already found in memory. However, the problem
    still exists for sub-processes (e.g., if "git status" were
    an external command).
    
    You can see another example with the "--bare" option, which
    sets GIT_DIR explicitly. For example:
    
      git init foo
      cd foo/.git
      git status ;# fails
      git --bare status ;# does NOT fail
    
    We need some way of telling sub-processes "even though
    GIT_DIR is set, do not use cwd as an implicit working tree".
    We could do it by putting a special token into
    GIT_WORK_TREE, but the obvious choice (an empty string) has
    some portability problems.
    
    Instead, we add a new boolean variable, GIT_IMPLICIT_WORK_TREE,
    which suppresses the use of cwd as a working tree when
    GIT_DIR is set. We trigger the new variable when we know we
    are in a bare setting.
    
    The variable is left intentionally undocumented, as this is
    an internal detail (for now, anyway). If somebody comes up
    with a good alternate use for it, and once we are confident
    we have shaken any bugs out of it, we can consider promoting
    it further.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.