Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Mar 28, 2009
  1. @gitster

    "core.sharedrepository = 0mode" should set, not loosen

    gitster authored
    This fixes the behaviour of octal notation to how it is defined in the
    documentation, while keeping the traditional "loosen only" semantics
    intact for "group" and "everybody".
    
    Three main points of this patch are:
    
     - For an explicit octal notation, the internal shared_repository variable
       is set to a negative value, so that we can tell "group" (which is to
       "OR" in 0660) and 0660 (which is to "SET" to 0660);
    
     - git-init did not set shared_repository variable early enough to affect
       the initial creation of many files, notably copied templates and the
       configuration.  We set it very early when a command-line option
       specifies a custom value.
    
     - Many codepaths create files inside $GIT_DIR by various ways that all
       involve mkstemp(), and then call move_temp_to_file() to rename it to
       its final destination.  We can add adjust_shared_perm() call here; for
       the traditional "loosen-only", this would be a no-op for many codepaths
       because the mode is already loose enough, but with the new behaviour it
       makes a difference.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 11, 2009
  1. @gitster

    Merge branch 'js/maint-1.6.0-path-normalize'

    gitster authored
    * js/maint-1.6.0-path-normalize:
      Remove unused normalize_absolute_path()
      Test and fix normalize_path_copy()
      Fix GIT_CEILING_DIRECTORIES on Windows
      Move sanitary_path_copy() to path.c and rename it to normalize_path_copy()
      Make test-path-utils more robust against incorrect use
Commits on Feb 7, 2009
  1. @gitster

    Move sanitary_path_copy() to path.c and rename it to normalize_path_c…

    Johannes Sixt authored gitster committed
    …opy()
    
    This function and normalize_absolute_path() do almost the same thing. The
    former already works on Windows, but the latter crashes.
    
    In subsequent changes we will remove normalize_absolute_path(). Here we
    make the replacement function reusable. On the way we rename it to reflect
    that it does some path normalization. Apart from that this is only moving
    around code.
    
    Signed-off-by: Johannes Sixt <j6t@kdbg.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 22, 2009
  1. @gitster

    Merge branch 'sg/maint-gitdir-in-subdir'

    gitster authored
    * sg/maint-gitdir-in-subdir:
      Fix gitdir detection when in subdir of gitdir
Commits on Jan 18, 2009
  1. @szeder @gitster

    Fix gitdir detection when in subdir of gitdir

    szeder authored gitster committed
    If the current working directory is a subdirectory of the gitdir (e.g.
    <repo>/.git/refs/), then setup_git_directory_gently() will climb its
    parent directories until it finds itself in a gitdir.  However, no
    matter how many parent directories it climbs, it sets
    'GIT_DIR_ENVIRONMENT' to ".", which is obviously wrong.
    
    This behaviour affected at least 'git rev-parse --git-dir' and hence
    caused some errors in bash completion (e.g. customized command prompt
    when on a detached head and completion of refs).
    
    To fix this, we set the absolute path of the found gitdir instead.
    
    Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 22, 2008
  1. @RichiH @gitster

    Always show which directory is not a git repository

    RichiH authored gitster committed
    Unify all
    
      fatal: Not a git repository
    
    error messages so they include path information.
    
    Signed-off-by: Richard Hartmann <richih@net.in.tum.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 5, 2008
  1. @raalkml @gitster

    Make chdir failures visible

    raalkml authored gitster committed
    Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 6, 2008
  1. @dmpot @spearce

    make prefix_path() never return NULL

    dmpot authored spearce committed
    There are 9 places where prefix_path is called, and only in one of
    them the returned pointer was checked to be non-zero and only to
    call exit(128) as it is usually done by die(). In other 8 places,
    the returned value was not checked and it caused SIGSEGV when a
    path outside of the working tree was used. For instance, running
      git update-index --add /some/path/outside
    caused SIGSEGV.
    
    This patch changes prefix_path() to die if the path is outside of
    the repository, so it never returns NULL.
    
    Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Commits on Aug 31, 2008
  1. @pclouds @gitster

    setup_git_directory(): fix move to worktree toplevel directory

    pclouds authored gitster committed
    When setup_git_directory() returns successfully, it is supposed to move
    current working directory to worktree toplevel directory.
    
    However, the code recomputing prefix inside setup_git_directory() has
    to move cwd back to original working directory, in order to get new
    prefix.  After that, it should move cwd back to worktree toplevel
    directory as expected.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 7, 2008
  1. @gitster

    Merge branch 'dr/ceiling'

    gitster authored
    * dr/ceiling:
      Eliminate an unnecessary chdir("..")
      Add support for GIT_CEILING_DIRECTORIES
      Fold test-absolute-path into test-path-utils
      Implement normalize_absolute_path
    
    Conflicts:
    
    	cache.h
    	setup.c
Commits on Jul 3, 2008
  1. @gitster

    Merge branch 'j6t/mingw'

    gitster authored
    * j6t/mingw: (38 commits)
      compat/pread.c: Add a forward declaration to fix a warning
      Windows: Fix ntohl() related warnings about printf formatting
      Windows: TMP and TEMP environment variables specify a temporary directory.
      Windows: Make 'git help -a' work.
      Windows: Work around an oddity when a pipe with no reader is written to.
      Windows: Make the pager work.
      When installing, be prepared that template_dir may be relative.
      Windows: Use a relative default template_dir and ETC_GITCONFIG
      Windows: Compute the fallback for exec_path from the program invocation.
      Turn builtin_exec_path into a function.
      Windows: Use a customized struct stat that also has the st_blocks member.
      Windows: Add a custom implementation for utime().
      Windows: Add a new lstat and fstat implementation based on Win32 API.
      Windows: Implement a custom spawnve().
      Windows: Implement wrappers for gethostbyname(), socket(), and connect().
      Windows: Work around incompatible sort and find.
      Windows: Implement asynchronous functions as threads.
      Windows: Disambiguate DOS style paths from SSH URLs.
      Windows: A rudimentary poll() emulation.
      Windows: Implement start_command().
      ...
Commits on Jun 23, 2008
  1. Windows: Treat Windows style path names.

    Johannes Sixt authored
    GIT's guts work with a forward slash as a path separators. We do not change
    that. Rather we make sure that only "normalized" paths enter the depths
    of the machinery.
    
    We have to translate backslashes to forward slashes in the prefix and in
    command line arguments. Fortunately, all of them are passed through
    functions in setup.c.
    
    A macro has_dos_drive_path() is defined that checks whether a path begins
    with a drive letter+colon combination. This predicate is always false on
    Unix. Another macro is_dir_sep() abstracts that a backslash is also a
    directory separator on Windows.
    
    Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
  2. setup.c: Prepare for Windows directory separators.

    Johannes Sixt authored
    This turns two switch/case statements into an if-else-if cascade because
    we later do not want to have
    
            case '/':
        #ifdef __MINGW32__
            case '\\':
        #endif
    
    but use a predicate is_dir_sep(foo) in order to check for the directory
    separator.
    
    Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Commits on Jun 19, 2008
  1. @torvalds @gitster

    Make git_dir a path relative to work_tree in setup_work_tree()

    torvalds authored gitster committed
    Once we find the absolute paths for git_dir and work_tree, we can make
    git_dir a relative path since we know pwd will be work_tree. This should
    save the kernel some time traversing the path to work_tree all the time
    if git_dir is inside work_tree.
    
    Daniel's patch didn't apply for me as-is, so I recreated it with some
    differences, and here are the numbers from ten runs each.
    
    There is some IO for me - probably due to more-or-less random flushing of
    the journal - so the variation is bigger than I'd like, but whatever:
    
    	Before:
    		real    0m8.135s
    		real    0m7.933s
    		real    0m8.080s
    		real    0m7.954s
    		real    0m7.949s
    		real    0m8.112s
    		real    0m7.934s
    		real    0m8.059s
    		real    0m7.979s
    		real    0m8.038s
    
    	After:
    		real    0m7.685s
    		real    0m7.968s
    		real    0m7.703s
    		real    0m7.850s
    		real    0m7.995s
    		real    0m7.817s
    		real    0m7.963s
    		real    0m7.955s
    		real    0m7.848s
    		real    0m7.969s
    
    Now, going by "best of ten" (on the assumption that the longer numbers
    are all due to IO), I'm saying a 7.933s -> 7.685s reduction, and it does
    seem to be outside of the noise (ie the "after" case never broke 8s, while
    the "before" case did so half the time).
    
    So looks like about 3% to me.
    
    Doing it for a slightly smaller test-case (just the "arch" subdirectory)
    gets more stable numbers probably due to not filling the journal with
    metadata updates, so we have:
    
    	Before:
    		real    0m1.633s
    		real    0m1.633s
    		real    0m1.633s
    		real    0m1.632s
    		real    0m1.632s
    		real    0m1.630s
    		real    0m1.634s
    		real    0m1.631s
    		real    0m1.632s
    		real    0m1.632s
    
    	After:
    		real    0m1.610s
    		real    0m1.609s
    		real    0m1.610s
    		real    0m1.608s
    		real    0m1.607s
    		real    0m1.610s
    		real    0m1.609s
    		real    0m1.611s
    		real    0m1.608s
    		real    0m1.611s
    
    where I'ld just take the averages and say 1.632 vs 1.610, which is just
    over 1% peformance improvement.
    
    So it's not in the noise, but it's not as big as I initially thought and
    measured.
    
    (That said, it obviously depends on how deep the working directory path is
    too, and whether it is behind NFS or something else that might need to
    cause more work to look up).
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 23, 2008
  1. @gitster

    Eliminate an unnecessary chdir("..")

    David Reiss authored gitster committed
    In the case where setup_git_directory_gently fails, avoid the last
    chdir("..") by moving it after the ceil_offset check.
    
    Signed-off-by: David Reiss <dreiss@facebook.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    Add support for GIT_CEILING_DIRECTORIES

    David Reiss authored gitster committed
    Make git recognize a new environment variable that prevents it from
    chdir'ing up into specified directories when looking for a GIT_DIR.
    Useful for avoiding slow network directories.
    
    For example, I use git in an environment where homedirs are automounted
    and "ls /home/nonexistent" takes about 9 seconds.  Setting
    GIT_CEILING_DIRS="/home" allows "git help -a" (for bash completion) and
    "git symbolic-ref" (for my shell prompt) to run in a reasonable time.
    
    Signed-off-by: David Reiss <dreiss@facebook.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 14, 2008
  1. @dscho @gitster

    Provide git_config with a callback-data parameter

    dscho authored gitster committed
    git_config() only had a function parameter, but no callback data
    parameter.  This assumes that all callback functions only modify
    global variables.
    
    With this patch, every callback gets a void * parameter, and it is hoped
    that this will help the libification effort.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 6, 2008
  1. @gitster

    Merge branch 'lh/git-file'

    gitster authored
    * lh/git-file:
      Teach GIT-VERSION-GEN about the .git file
      Teach git-submodule.sh about the .git file
      Teach resolve_gitlink_ref() about the .git file
      Add platform-independent .git "symlink"
Commits on Apr 17, 2008
  1. @heikkiorsila @gitster

    Make core.sharedRepository more generic

    heikkiorsila authored gitster committed
    git init --shared=0xxx, where '0xxx' is an octal number, will create
    a repository with file modes set to '0xxx'. Users with a safe umask
    value (0077) can use this option to force file modes. For example,
    '0640' is a group-readable but not group-writable regardless of
    user's umask value. Values compatible with old Git versions are written
    as they were before, for compatibility reasons. That is, "1" for
    "group" and "2" for "everybody".
    
    "git config core.sharedRepository 0xxx" is also handled.
    
    Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 9, 2008
  1. @hjemli @gitster

    Add platform-independent .git "symlink"

    hjemli authored gitster committed
    This patch allows .git to be a regular textfile containing the path of
    the real git directory (prefixed with "gitdir: "), which can be useful on
    platforms lacking support for real symlinks.
    
    Signed-off-by: Lars Hjemli <hjemli@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 26, 2008
  1. @szeder @gitster

    Always set *nongit_ok in setup_git_directory_gently()

    szeder authored gitster committed
    setup_git_directory_gently() only modified the value of its *nongit_ok
    argument if we were not in a git repository.  Now it will always set it
    to 0 when we are inside a repository.
    
    Also remove now unnecessary initializations in the callers of this
    function.
    
    Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 7, 2008
  1. @gitster

    get_pathspec(): die when an out-of-tree path is given

    gitster authored
    An earlier commit d089eba (setup: sanitize absolute and funny paths) made
    get_pathspec() aware of absolute paths, but with a botched interface that
    forced the callers to count the resulting pathspecs in order to detect
    an error of giving a path that is outside the work tree.
    
    This fixes it, by dying inside the function.
    
    We had ls-tree test that relied on a misfeature in the original
    implementation of its pathspec handling.  Leading slashes were silently
    removed from them.  However we allow giving absolute pathnames (people
    want to cut and paste from elsewhere) that are inside work tree these
    days, so a pathspec that begin with slash _should_ be treated as a full
    path.  The test is adjusted to match the updated rule for get_pathspec().
    
    Earlier I mistook three tests given by Robin that they should succeed, but
    these are attempts to add path outside work tree, which should fail
    loudly.  These tests also have been fixed.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 22, 2008
  1. @gitster

    Avoid unnecessary "if-before-free" tests.

    Jim Meyering authored gitster committed
    This change removes all obvious useless if-before-free tests.
    E.g., it replaces code like this:
    
            if (some_expression)
                    free (some_expression);
    
    with the now-equivalent:
    
            free (some_expression);
    
    It is equivalent not just because POSIX has required free(NULL)
    to work for a long time, but simply because it has worked for
    so long that no reasonable porting target fails the test.
    Here's some evidence from nearly 1.5 years ago:
    
        http://www.winehq.org/pipermail/wine-patches/2006-October/031544.html
    
    FYI, the change below was prepared by running the following:
    
      git ls-files -z | xargs -0 \
      perl -0x3b -pi -e \
        's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+(free\s*\(\s*\1\s*\))/$2/s'
    
    Note however, that it doesn't handle brace-enclosed blocks like
    "if (x) { free (x); }".  But that's ok, since there were none like
    that in git sources.
    
    Beware: if you do use the above snippet, note that it can
    produce syntactically invalid C code.  That happens when the
    affected "if"-statement has a matching "else".
    E.g., it would transform this
    
      if (x)
        free (x);
      else
        foo ();
    
    into this:
    
      free (x);
      else
        foo ();
    
    There were none of those here, either.
    
    If you're interested in automating detection of the useless
    tests, you might like the useless-if-before-free script in gnulib:
    [it *does* detect brace-enclosed free statements, and has a --name=S
     option to make it detect free-like functions with different names]
    
      http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=build-aux/useless-if-before-free
    
    Addendum:
      Remove one more (in imap-send.c), spotted by Jean-Luc Herren <jlh@gmx.ch>.
    
    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 21, 2008
  1. @gitster

    prefix_path: use is_absolute_path() instead of *orig == '/'

    Johannes Sixt authored gitster committed
    Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    Merge branch 'jc/setup'

    gitster authored
    * jc/setup:
      builtin-mv: minimum fix to avoid losing files
      git-add: adjust to the get_pathspec() changes.
      Make blame accept absolute paths
      setup: sanitize absolute and funny paths in get_pathspec()
Commits on Feb 11, 2008
  1. @gitster

    setup.c: guard config parser from value=NULL

    gitster authored
    core.worktree expects a string value
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 5, 2008
  1. @gitster

    setup: sanitize absolute and funny paths in get_pathspec()

    gitster authored
    The prefix_path() function called from get_pathspec() is
    responsible for translating list of user-supplied pathspecs to
    list of pathspecs that is relative to the root of the work
    tree.  When working inside a subdirectory, the user-supplied
    pathspecs are taken to be relative to the current subdirectory.
    
    Among special path components in pathspecs, we used to accept
    and interpret only "." ("the directory", meaning a no-op) and
    ".."  ("up one level") at the beginning.  Everything else was
    passed through as-is.
    
    For example, if you are in Documentation/ directory of the
    project, you can name Documentation/howto/maintain-git.txt as:
    
        howto/maintain-git.txt
        ../Documentation/howto/maitain-git.txt
        ../././Documentation/howto/maitain-git.txt
    
    but not as:
    
        howto/./maintain-git.txt
        $(pwd)/howto/maintain-git.txt
    
    This patch updates prefix_path() in several ways:
    
     - If the pathspec is not absolute, prefix (i.e. the current
       subdirectory relative to the root of the work tree, with
       terminating slash, if not empty) and the pathspec is
       concatenated first and used in the next step.  Otherwise,
       that absolute pathspec is used in the next step.
    
     - Then special path components "." (no-op) and ".." (up one
       level) are interpreted to simplify the path.  It is an error
       to have too many ".." to cause the intermediate result to
       step outside of the input to this step.
    
     - If the original pathspec was not absolute, the result from
       the previous step is the resulting "sanitized" pathspec.
       Otherwise, the result from the previous step is still
       absolute, and it is an error if it does not begin with the
       directory that corresponds to the root of the work tree.  The
       directory is stripped away from the result and is returned.
    
     - In any case, the resulting pathspec in the array
       get_pathspec() returns omit the ones that caused errors.
    
    With this patch, the last two examples also behave as expected.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 3, 2008
  1. @meyering @gitster

    Fix grammar nits in documentation and in code comments.

    meyering authored gitster committed
    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 9, 2007
  1. @pclouds @gitster

    Remove repo version check from setup_git_directory

    pclouds authored gitster committed
    setup_git_directory_gently has done the check already.
    
    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 6, 2007
  1. @gitster

    Merge branch 'maint'

    gitster authored
    * maint:
      git-am -i: report rewritten title
      git grep shows the same hit repeatedly for unmerged paths
      Do check_repository_format() early (re-fix)
      Do check_repository_format() early
      Add missing inside_work_tree setting in setup_git_directory_gently
Commits on Dec 5, 2007
  1. @pclouds @gitster

    Do check_repository_format() early (re-fix)

    pclouds authored gitster committed
    This pushes check_repository_format() (actually _gently() version)
    to setup_git_directory_gently() in order to prevent from
    using unsupported repositories.
    
    New setup_git_directory_gently()'s behaviour is stop searching
    for a valid gitdir and return as if there is no gitdir if a
    unsupported repository is found. Warning will be thrown in these
    cases.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 30, 2007
  1. @pclouds @gitster

    Do check_repository_format() early

    pclouds authored gitster committed
    Repository version check is only performed when
    setup_git_directory() is called. This makes sure
    setup_git_directory_gently() does the check too.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 26, 2007
  1. @sprohaska @gitster

    Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c

    sprohaska authored gitster committed
    Using the helper function to test for absolute paths makes porting easier.
    
    Signed-off-by: Steffen Prohaska <prohaska@zib.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 10, 2007
  1. @dscho @gitster

    builtin-blame: set up the work_tree before the first file access

    dscho authored gitster committed
    We check in cmd_blame() if the specified path is there, but we
    failed to set up the working tree before that.
    
    While at it, make setup_work_tree() just return if it was run
    before.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 8, 2007
  1. @gitster

    Style: place opening brace of a function definition at column 1

    gitster authored
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.