Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Oct 10, 2011
  1. @gitster

    Merge branch 'cb/common-prefix-unification'

    gitster authored
    * cb/common-prefix-unification:
      rename pathspec_prefix() to common_prefix() and move to dir.[ch]
      consolidate pathspec_prefix and common_prefix
      remove prefix argument from pathspec_prefix
  2. @gitster

    Merge branch 'fg/submodule-git-file-git-dir'

    gitster authored
    * fg/submodule-git-file-git-dir:
      Move git-dir for submodules
      rev-parse: add option --resolve-git-dir <path>
    
    Conflicts:
    	cache.h
    	git-submodule.sh
Commits on Sep 12, 2011
  1. @drizzd @gitster

    rename pathspec_prefix() to common_prefix() and move to dir.[ch]

    drizzd authored gitster committed
    Also make common_prefix_len() static as this refactoring makes dir.c
    itself the only caller of this helper function.
    
    Signed-off-by: Clemens Buchacher <drizzd@aon.at>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 6, 2011
  1. @gitster

    consolidate pathspec_prefix and common_prefix

    gitster authored
    The implementation from pathspec_prefix (slightly modified) replaces the
    current common_prefix, because it also respects glob characters.
    
    Based on a patch by Clemens Buchacher.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @drizzd @gitster

    remove prefix argument from pathspec_prefix

    drizzd authored gitster committed
    Passing a prefix to a function that is supposed to find the prefix is
    strange. And it's really only used if the pathspec is NULL. Make the
    callers handle this case instead.
    
    As we are always returning a fresh copy of a string (or NULL), change the
    type of the returned value to non-const "char *".
    
    Signed-off-by: Clemens Buchacher <drizzd@aon.at>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 29, 2011
  1. @gitster

    Merge branch 'nd/maint-clone-gitdir'

    gitster authored
    * nd/maint-clone-gitdir:
      clone: allow to clone from .git file
      read_gitfile_gently(): rename misnamed function to read_gitfile()
Commits on Aug 25, 2011
  1. @gitster

    Merge branch 'di/parse-options-split'

    gitster authored
    * di/parse-options-split:
      Reduce parse-options.o dependencies
      parse-options: export opterr, optbug
Commits on Aug 22, 2011
  1. @gitster

    read_gitfile_gently(): rename misnamed function to read_gitfile()

    gitster authored
    The function was not gentle at all to the callers and died without giving
    them a chance to deal with possible errors. Rename it to read_gitfile(),
    and update all the callers.
    
    As no existing caller needs a true "gently" variant, we do not bother
    adding one at this point.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 16, 2011
  1. @iveqy @gitster

    rev-parse: add option --resolve-git-dir <path>

    iveqy authored gitster committed
    Check if <path> is a valid git-dir or a valid git-file that points
    to a valid git-dir.
    
    We want tests to be independent from the fact that a git-dir may
    be a git-file. Thus we changed tests to use this feature.
    
    Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
    Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
    Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 11, 2011
  1. @divanorama @gitster

    Reduce parse-options.o dependencies

    divanorama authored gitster committed
    Currently parse-options.o pulls quite a big bunch of dependencies.
    his complicates it's usage in contrib/ because it pulls external
    dependencies and it also increases executables size.
    
    Split off less generic and more internal to git part of
    parse-options.c to parse-options-cb.c.
    
    Move prefix_filename function from setup.c to abspath.c. abspath.o
    and wrapper.o pull each other, so it's unlikely to increase the
    dependencies. It was a dependency of parse-options.o that pulled
    many others.
    
    Now parse-options.o pulls just abspath.o, ctype.o, strbuf.o, usage.o,
    wrapper.o, libc directly and strlcpy.o indirectly.
    
    Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    Merge branch 'cb/partial-commit-relative-pathspec'

    gitster authored
    * cb/partial-commit-relative-pathspec:
      commit: allow partial commits with relative paths
Commits on Aug 2, 2011
  1. @drizzd @gitster

    commit: allow partial commits with relative paths

    drizzd authored gitster committed
    In order to do partial commits, git-commit overlays a tree on the
    cache and checks pathspecs against the result. Currently, the
    overlaying is done using "prefix" which prevents relative pathspecs
    with ".." and absolute pathspec from matching when they refer to
    files not under "prefix" and absent from the index, but still in
    the tree (i.e.  files staged for removal).
    
    The point of providing a prefix at all is performance optimization.
    If we say there is no common prefix for the files of interest, then
    we have to read the entire tree into the index.
    
    But even if we cannot use the working directory as a prefix, we can
    still figure out if there is a common prefix for all given paths,
    and use that instead. The pathspec_prefix() routine from ls-files.c
    does exactly that.
    
    Any use of global variables is removed from pathspec_prefix() so
    that it can be called from commit.c.
    
    Reported-by: Reuben Thomas <rrt@sc3d.org>
    Analyzed-by: Michael J Gruber <git@drmicha.warpmail.net>
    Signed-off-by: Clemens Buchacher <drizzd@aon.at>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 30, 2011
  1. @gitster

    Merge branch 'da/git-prefix-everywhere' into next

    gitster authored
    * da/git-prefix-everywhere:
      t/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests
      git-mergetool--lib: Make vimdiff retain the current directory
      git: Remove handling for GIT_PREFIX
      setup: Provide GIT_PREFIX to built-ins
Commits on May 30, 2011
  1. @gitster

    Merge branch 'maint'

    gitster authored
    * maint:
      git-submodule.sh: separate parens by a space to avoid confusing some shells
      Documentation/technical/api-diff.txt: correct name of diff_unmerge()
      read_gitfile_gently: use ssize_t to hold read result
      remove tests of always-false condition
      rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
  2. @gitster

    Merge branch 'jm/maint-misc-fix' into maint

    gitster authored
    * jm/maint-misc-fix:
      read_gitfile_gently: use ssize_t to hold read result
      remove tests of always-false condition
      rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
Commits on May 26, 2011
  1. @davvid @gitster

    setup: Provide GIT_PREFIX to built-ins

    davvid authored gitster committed
    GIT_PREFIX was added in 7cf16a1 so that
    aliases can know the directory from which a !alias was called.
    
    Knowing the prefix relative to the root is helpful in other programs
    so export it to built-ins as well.
    
    Helped-by: Michael J Gruber <git@drmicha.warpmail.net>
    Signed-off-by: David Aguilar <davvid@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @peff @gitster

    read_gitfile_gently: use ssize_t to hold read result

    peff authored gitster committed
    Otherwise, a negative error return becomes a very large read
    value. We catch this in practice because we compare the
    expected and actual numbers of bytes (and you are not likely
    to be reading (size_t)-1 bytes), but this makes the
    correctness a little more obvious.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 23, 2011
  1. @gitster

    Merge branch 'jc/magic-pathspec'

    gitster authored
    * jc/magic-pathspec:
      setup.c: Fix some "symbol not declared" sparse warnings
      t3703: Skip tests using directory name ":" on Windows
      revision.c: leave a note for "a lone :" enhancement
      t3703, t4208: add test cases for magic pathspec
      rev/path disambiguation: further restrict "misspelled index entry" diag
      fix overslow :/no-such-string-ever-existed diagnostics
      fix overstrict :<path> diagnosis
      grep: use get_pathspec() correctly
      pathspec: drop "lone : means no pathspec" from get_pathspec()
      Revert "magic pathspec: add ":(icase)path" to match case insensitively"
      magic pathspec: add ":(icase)path" to match case insensitively
      magic pathspec: futureproof shorthand form
      magic pathspec: add tentative ":/path/from/top/level" pathspec support
Commits on May 18, 2011
  1. @gitster

    setup.c: Fix some "symbol not declared" sparse warnings

    Ramsay Jones authored gitster committed
    In particular, sparse issues the "symbol 'a_symbol' was not declared.
    Should it be static?" warnings for the following symbols:
    
        setup.c:159:3: 'pathspec_magic'
        setup.c:176:12: 'prefix_pathspec'
    
    These symbols only require file scope, so we add the static modifier
    to their declarations.
    
    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 10, 2011
  1. @gitster

    rev/path disambiguation: further restrict "misspelled index entry" diag

    gitster authored
    A colon followed by anything !isalnum() (e.g. ":/heh") at this point is
    known not to be an existing rev.  Just give a generic "neither a rev nor
    a path" error message.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    fix overslow :/no-such-string-ever-existed diagnostics

    gitster authored
    "git cmd :/no-such-string-ever-existed" runs an extra round of get_sha1()
    since 009fee4 (Detailed diagnosis when parsing an object name fails.,
    2009-12-07).  Once without error diagnosis to see there is no commit with
    such a string in the log message (hence "it cannot be a ref"), and after
    seeing that :/no-such-string-ever-existed is not a filename (hence "it
    cannot be a path, either"), another time to give "better diagnosis".
    
    The thing is, the second time it runs, we already know that traversing the
    history all the way down to the root will _not_ find any matching commit.
    
    Rename misguided "gently" parameter, which is turned off _only_ when the
    "detailed diagnosis" codepath knows that it cannot be a ref and making the
    call only for the caller to die with a message.  Flip its meaning (and
    adjust the callers) and call it "only_to_die", which is not a great name,
    but it describes far more clearly what the codepaths that switches their
    behaviour based on this variable do.
    
    On my box, the command spends ~1.8 seconds without the patch to make the
    report; with the patch it spends ~1.12 seconds.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @gitster

    pathspec: drop "lone : means no pathspec" from get_pathspec()

    gitster authored
    We may want to give the pathspec subsystem such a feature, but not while
    we are still using get_pathspec() that returns a stupid "char **" that
    loses subtle nuances that existed in the input string.
    
    In the meantime, the callers of get_pathspec() that want to support it
    could do an equivalent before feeding their argv[] to the function
    themselves quite easily.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. @gitster

    Revert "magic pathspec: add ":(icase)path" to match case insensitively"

    gitster authored
    This reverts commit d0546e2, which
    was only meant to be a Proof-of-concept used during the discussion.
    
    The real implementation of the feature needs to wait until we migrate
    all the code to use "struct pathspec", not "char **", to represent
    richer semantics given to pathspec.
Commits on May 2, 2011
  1. @gitster

    Merge branch 'nd/maint-setup'

    gitster authored
    * nd/maint-setup:
      Kill off get_relative_cwd()
      setup: return correct prefix if worktree is '/'
    
    Conflicts:
    	dir.c
    	setup.c
Commits on Apr 8, 2011
  1. @gitster

    magic pathspec: add ":(icase)path" to match case insensitively

    gitster authored
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    magic pathspec: futureproof shorthand form

    gitster authored
    The earlier design was to take whatever non-alnum that the short format
    parser happens to support, leaving the rest as part of the pattern, so a
    version of git that knows '*' magic and a version that does not would have
    behaved differently when given ":*Makefile".  The former would have
    applied the '*' magic to the pattern "Makefile", while the latter would
    used no magic to the pattern "*Makefile".
    
    Instead, just reserve all non-alnum ASCII letters that are neither glob
    nor regexp special as potential magic signature, and when we see a magic
    that is not supported, die with an error message, just like the longhand
    codepath does.
    
    With this, ":%#!*Makefile" will always mean "%#!" magic applied to the
    pattern "*Makefile", no matter what version of git is used (it is a
    different matter if the version of git supports all of these three magic
    matching rules).
    
    Also make ':' without anything else to mean "there is no pathspec".  This
    would allow differences between "git log" and "git log ." run from the top
    level of the working tree (the latter simplifies no-op commits away from
    the history) to be expressed from a subdirectory by saying "git log :".
    
    Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 7, 2011
  1. @gitster

    magic pathspec: add tentative ":/path/from/top/level" pathspec support

    gitster authored
    Support ":/" magic string that can be prefixed to a pathspec element to
    say "this names the path from the top-level of the working tree", when
    you are in the subdirectory.
    
    For example, you should be able to say:
    
        $ edit Makefile ;# top-level
        $ cd Documentation
        $ edit git.txt ;# in the subdirectory
    
    and then do one of three things, still inside the subdirectory:
    
        $ git add -u .  ;# add only Documentation/git.txt
        $ git add -u :/ ;# add everything, including paths outside Documentation
        $ git add -u    ;# whatever the default setting is.
    
    To truly support magic pathspec, the API needs to be restructured so that
    get_pathspec() and init_pathspec() are unified into one call.  Currently,
    the former just prefixes the user supplied pathspec with the current
    subdirectory path, and the latter takes the output from the former and
    pre-parses them into a bit richer structure for easier handling.  They
    should become a single API function that takes the current subdirectory
    path and the remainder of argv[] (after parsing --options and revision
    arguments from the command line) and returns an array of parsed pathspec
    elements, and "magic" should become attributes of struct pathspec_item.
    
    This patch implements only "top" magic because it can be hacked into the
    system without such a refactoring.
    
    The syntax for magic pathspec prefix is designed to be extensible yet
    simple to type to invoke a simple magic like "from the top".  The parser
    for the magic prefix is hooked into get_pathspec() function in this patch,
    and it needs to be moved when we refactor the API.
    
    But we have to start from somewhere.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 29, 2011
  1. @pclouds @gitster

    setup: return correct prefix if worktree is '/'

    pclouds authored gitster committed
    The same old problem reappears after setup code is reworked.  We tend
    to assume there is at least one path component in a path and forget
    that path can be simply '/'.
    
    Reported-by: Matthijs Kooijman <matthijs@stdin.nl>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 17, 2011
  1. @carlosmn @gitster

    Name make_*_path functions more accurately

    carlosmn authored gitster committed
    Rename the make_*_path functions so it's clearer what they do, in
    particlar make clear what the differnce between make_absolute_path and
    make_nonrelative_path is by renaming them real_path and absolute_path
    respectively. make_relative_path has an understandable name and is
    renamed to relative_path to maintain the name convention.
    
    The function calls have been replaced 1-to-1 in their usage.
    
    Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 10, 2011
  1. @gitster

    Merge branch 'cb/setup'

    gitster authored
    * cb/setup:
      setup: translate symlinks in filename when using absolute paths
Commits on Jan 21, 2011
  1. @jrn @gitster

    Subject: setup: officially support --work-tree without --git-dir

    jrn authored gitster committed
    The original intention of --work-tree was to allow people to work in a
    subdirectory of their working tree that does not have an embedded .git
    directory.  Because their working tree, which their $cwd was in, did not
    have an embedded .git, they needed to use $GIT_DIR to specify where it is,
    and because this meant there was no way to discover where the root level
    of the working tree was, so we needed to add $GIT_WORK_TREE to tell git
    where it was.
    
    However, this facility has long been (mis)used by people's scripts to
    start git from a working tree _with_ an embedded .git directory, let git
    find .git directory, and then pretend as if an unrelated directory were
    the associated working tree of the .git directory found by the discovery
    process.  It happens to work in simple cases, and is not worth causing
    "regression" to these scripts.
    
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 4, 2011
  1. @carenas @gitster

    setup: translate symlinks in filename when using absolute paths

    carenas authored gitster committed
    otherwise, comparison to validate against work tree will fail when
    the path includes a symlink and the name passed is not canonical.
    
    Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 28, 2010
  1. @gitster

    Merge branch 'nd/setup'

    gitster authored
    * nd/setup: (47 commits)
      setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd
      git.txt: correct where --work-tree path is relative to
      Revert "Documentation: always respect core.worktree if set"
      t0001: test git init when run via an alias
      Remove all logic from get_git_work_tree()
      setup: rework setup_explicit_git_dir()
      setup: clean up setup_discovered_git_dir()
      t1020-subdirectory: test alias expansion in a subdirectory
      setup: clean up setup_bare_git_dir()
      setup: limit get_git_work_tree()'s to explicit setup case only
      Use git_config_early() instead of git_config() during repo setup
      Add git_config_early()
      git-rev-parse.txt: clarify --git-dir
      t1510: setup case #31
      t1510: setup case #30
      t1510: setup case #29
      t1510: setup case #28
      t1510: setup case #27
      t1510: setup case #26
      t1510: setup case #25
      ...
Commits on Dec 27, 2010
  1. @pclouds @gitster

    setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd

    pclouds authored gitster committed
    When setup_work_tree() is called, it moves cwd to $GIT_WORK_TREE and
    makes internal copy of $GIT_WORK_TREE absolute. The environt variable,
    if set by user, remains unchanged. If the variable is relative, it is
    no longer correct because its base dir has changed.
    
    Instead of making $GIT_WORK_TREE absolute too, we just say "." and let
    subsequent git processes handle it.
    
    Reported-by: Michel Briand <michelbriand@free.fr>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 22, 2010
  1. @pclouds @gitster

    setup: rework setup_explicit_git_dir()

    pclouds authored gitster committed
    This function is the most complex one among the three setup_*
    functions because all GIT_DIR, GIT_WORK_TREE, core.worktree and
    core.bare are involved.
    
    Because core.worktree is only effective inside
    setup_explicit_git_dir() and the extra code in setup_git_directory()
    is to handle that. The extra code can now be retired.
    
    Also note that setup_explicit assignment is removed, worktree setting
    is no longer decided by get_git_work_tree(). get_git_work_tree() will
    be simplified in the next commit.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.