Skip to content
Commits on Feb 4, 2010
  1. @gitster

    Typofixes outside documentation area

    gitster committed
        begining -> beginning
        canonicalizations -> canonicalization
        comand -> command
        dewrapping -> unwrapping
        dirtyness -> dirtiness
        explicitely -> explicitly
        feeded -> fed
        impiled -> implied
        madatory -> mandatory
        mimick -> mimic
        preceeding -> preceding
        reqeuest -> request
        substition -> substitution
    Signed-off-by: Junio C Hamano <>
Commits on Jan 20, 2010
  1. @gitster

    Merge branch 'bk/fix-relative-gitdir-file'

    gitster committed
    * bk/fix-relative-gitdir-file:
      Handle relative paths in submodule .git files
      Test update-index for a gitlink to a .git file
Commits on Jan 10, 2010
  1. @gitster

    Merge branch 'mm/diag-path-in-treeish'

    gitster committed
    * mm/diag-path-in-treeish:
      Detailed diagnosis when parsing an object name fails.
  2. @bradking @gitster

    Handle relative paths in submodule .git files

    bradking committed with gitster
    Commit 842abf0 (Teach resolve_gitlink_ref() about the .git file, 2008-02-20)
    taught resolve_gitlink_ref() to call read_gitfile_gently() to resolve .git
    files.  In this commit teach read_gitfile_gently() to interpret a relative
    path in a .git file with respect to the file location.
    This change allows update-index to recognize a submodule that uses a relative
    path in its .git file.  It previously failed because the relative path was
    wrongly interpreted with respect to the superproject directory.
    Signed-off-by: Brad King <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 16, 2009
  1. @gitster

    Merge branch 'maint' to sync with

    gitster committed
    * maint:
      worktree: don't segfault with an absolute pathspec without a work tree
      ignore unknown color configuration
      help.autocorrect: do not run a command if the command given is junk
      Illustrate "filter" attribute with an example
  2. @gitster

    worktree: don't segfault with an absolute pathspec without a work tree

    gitster committed
    If a command is run with an absolute path as a pathspec inside a bare
    repository, e.g. "rev-list HEAD -- /home", the code tried to run strlen()
    on NULL, which is the result of get_git_work_tree(), and segfaulted.  It
    should just fail instead.
    Currently the function returns NULL even inside .git/ in a repository
    with a work tree, but that is a separate issue.
    Signed-off-by: Junio C Hamano <>
Commits on Dec 7, 2009
  1. @gitster

    Detailed diagnosis when parsing an object name fails.

    committed with gitster
    The previous error message was the same in many situations (unknown
    revision or path not in the working tree). We try to help the user as
    much as possible to understand the error, especially with the
    sha1:filename notation. In this case, we say whether the sha1 or the
    filename is problematic, and diagnose the confusion between
    relative-to-root and relative-to-$PWD confusion precisely.
    The 7 new error messages are tested.
    Signed-off-by: Matthieu Moy <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 18, 2009
  1. @gitster

    check_filename(): make verify_filename() callable without dying

    gitster committed
    Make it possible to invole the logic of verify_filename() to make sure the
    pathname arguments are unambiguous without actually dying.  The caller may
    want to do something different.
Commits on Sep 19, 2009
  1. @lznuaa @gitster

    Test for WIN32 instead of __MINGW32_

    lznuaa committed with gitster
    The code which is conditional on MinGW32 is actually conditional on Windows.
    Use the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,
    but not by Cygwin.
    Define SNPRINTF_SIZE_CORR=1 for MSVC too, as its vsnprintf function does
    not add NUL at the end of the buffer if the result fits the buffer size
    Signed-off-by: Frank Li <>
    Signed-off-by: Marius Storm-Olsen <>
    Acked-by: Johannes Sixt <>
    Signed-off-by: Junio C Hamano <>
Commits on Jun 27, 2009
  1. @trast @gitster

    Use die_errno() instead of die() when checking syscalls

    trast committed with gitster
    Lots of die() calls did not actually report the kind of error, which
    can leave the user confused as to the real problem.  Use die_errno()
    where we check a system/library call that sets errno on failure, or
    one of the following that wrap such calls:
      Function              Passes on error from
      --------              --------------------
      odb_pack_keep         open
      read_ancestry         fopen
      read_in_full          xread
      strbuf_read           xread
      strbuf_read_file      open or strbuf_read_file
      strbuf_readlink       readlink
      write_in_full         xwrite
    Signed-off-by: Thomas Rast <>
    Signed-off-by: Junio C Hamano <>
  2. @trast @gitster

    Convert existing die(..., strerror(errno)) to die_errno()

    trast committed with gitster
    Change calls to die(..., strerror(errno)) to use the new die_errno().
    In the process, also make slight style adjustments: at least state
    _something_ about the function that failed (instead of just printing
    the pathname), and put paths in single quotes.
    Signed-off-by: Thomas Rast <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 28, 2009
  1. @gitster

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

    gitster committed
    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 <>
Commits on Feb 11, 2009
  1. @gitster

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

    gitster committed
    * js/maint-1.6.0-path-normalize:
      Remove unused normalize_absolute_path()
      Test and fix normalize_path_copy()
      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. @j6t @gitster

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

    j6t committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on Jan 22, 2009
  1. @gitster

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

    gitster committed
    * 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 committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 22, 2008
  1. @RichiH @gitster

    Always show which directory is not a git repository

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

    Make chdir failures visible

    raalkml committed with gitster
    Signed-off-by: Alex Riesen <>
    Signed-off-by: Junio C Hamano <>
Commits on Oct 6, 2008
  1. @dmpot @spearce

    make prefix_path() never return NULL

    dmpot committed with spearce
    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 <>
    Signed-off-by: Shawn O. Pearce <>
Commits on Aug 31, 2008
  1. @pclouds @gitster

    setup_git_directory(): fix move to worktree toplevel directory

    pclouds committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on Jul 7, 2008
  1. @gitster

    Merge branch 'dr/ceiling'

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

    Merge branch 'j6t/mingw'

    gitster committed
    * 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 committed
    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 <>
  2. setup.c: Prepare for Windows directory separators.

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

    Make git_dir a path relative to work_tree in setup_work_tree()

    torvalds committed with gitster
    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:
    		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
    		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:
    		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
    		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
    (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 <>
Commits on May 23, 2008
  1. @gitster

    Eliminate an unnecessary chdir("..")

    David Reiss committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
  2. @gitster


    David Reiss committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on May 14, 2008
  1. @dscho @gitster

    Provide git_config with a callback-data parameter

    dscho committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on May 6, 2008
  1. @gitster

    Merge branch 'lh/git-file'

    gitster committed
    * lh/git-file:
      Teach GIT-VERSION-GEN about the .git file
      Teach 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 committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on Apr 9, 2008
  1. @hjemli @gitster

    Add platform-independent .git "symlink"

    hjemli committed with gitster
    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 <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 26, 2008
  1. @szeder @gitster

    Always set *nongit_ok in setup_git_directory_gently()

    szeder committed with gitster
    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
    Signed-off-by: SZEDER Gábor <>
    Signed-off-by: Junio C Hamano <>
Commits on Mar 7, 2008
  1. @gitster

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

    gitster committed
    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 <>
Commits on Feb 22, 2008
  1. @gitster

    Avoid unnecessary "if-before-free" tests.

    Jim Meyering committed with gitster
    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:
    FYI, the change below was prepared by running the following:
      git ls-files -z | xargs -0 \
      perl -0x3b -pi -e \
    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);
        foo ();
    into this:
      free (x);
        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]
      Remove one more (in imap-send.c), spotted by Jean-Luc Herren <>.
    Signed-off-by: Jim Meyering <>
    Signed-off-by: Junio C Hamano <>
Commits on Feb 21, 2008
  1. @gitster

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

    Johannes Sixt committed with gitster
    Signed-off-by: Johannes Sixt <>
    Signed-off-by: Junio C Hamano <>
Something went wrong with that request. Please try again.