Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jun 19, 2008
  1. @torvalds

    Make git_dir a path relative to work_tree in setup_work_tree()

    torvalds authored 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 Jun 8, 2008
  1. make_nonrelative_path: Use is_absolute_path()

    Johannes Sixt authored committed
    This helps porting to Windows.
    
    Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 6, 2008
  1. Use nonrelative paths instead of absolute paths for cloned repositories

    Daniel Barkalow authored committed
    Particularly for the "alternates" file, if one will be created, we
    want a path that doesn't depend on the current directory, but we want
    to retain any symlinks in the path as given and any in the user's view
    of the current directory when the path was given.
    
    Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 30, 2008
  1. @heikkiorsila

    Make read_in_full() and write_in_full() consistent with xread() and x…

    heikkiorsila authored committed
    …write()
    
    xread() and xwrite() return ssize_t values as their native POSIX
    counterparts read(2) and write(2).
    
    To be consistent, read_in_full() and write_in_full() should also return
    ssize_t values.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 17, 2008
  1. @heikkiorsila

    Make core.sharedRepository more generic

    heikkiorsila authored 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 Mar 5, 2008
  1. @raalkml

    Do not use GUID on dir in git init --shared=all on FreeBSD

    raalkml authored committed
    It does not allow changing the bit to a non-root user.
    This fixes t1301-shared-repo.sh on the platform.
    
    Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 2, 2008
  1. @dscho

    Fix make_absolute_path() for parameters without a slash

    dscho authored committed
    When passing "xyz" to make_absolute_path(), make_absolute_path()
    erroneously tried to chdir("xyz"), and then append "/xyz".  Instead,
    skip the chdir() completely when no slash was found.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 1, 2007
  1. @dscho

    Add is_absolute_path() and make_absolute_path()

    dscho authored committed
    This patch adds convenience functions to work with absolute paths.
    The function is_absolute_path() should help the efforts to integrate
    the MinGW fork.
    
    Note that make_absolute_path() returns a pointer to a static buffer.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 26, 2007
  1. git_mkstemp(): be careful not to overflow the path buffer.

    authored
    If user's TMPDIR is insanely long, return negative after
    setting errno to ENAMETOOLONG, pretending that the underlying
    mkstemp() choked on a temporary file path that is too long.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 2, 2007
  1. @matled

    getenv/setenv: use constants if available

    matled authored committed
    There were places using "GIT_DIR" instead of GIT_DIR_ENVIRONMENT and
    "GIT_CONFIG" instead of CONFIG_ENVIRONMENT.  This makes it easier to
    find all places touching an environment variable using git grep or
    similar tools.
    
    Signed-off-by: Matthias Lederhofer <matled@gmx.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 7, 2007
  1. @spearce

    General const correctness fixes

    spearce authored Junio C Hamano committed
    We shouldn't attempt to assign constant strings into char*, as the
    string is not writable at runtime.  Likewise we should always be
    treating unsigned values as unsigned values, not as signed values.
    
    Most of these are very straightforward.  The only exception is the
    (unnecessary) xstrdup/free in builtin-branch.c for the detached
    head case.  Since this is a user-level interactive type program
    and that particular code path is executed no more than once, I feel
    that the extra xstrdup call is well worth the easy elimination of
    this warning.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jan 12, 2007
  1. Merge branch 'jc/detached-head'

    Junio C Hamano authored
    * jc/detached-head:
      git-checkout: handle local changes sanely when detaching HEAD
      git-checkout: safety check for detached HEAD checks existing refs
      git-checkout: fix branch name output from the command
      git-checkout: safety when coming back from the detached HEAD state.
      git-checkout: rewording comments regarding detached HEAD.
      git-checkout: do not warn detaching HEAD when it is already detached.
      Detached HEAD (experimental)
      git-branch: show detached HEAD
      git-status: show detached HEAD
Commits on Jan 8, 2007
  1. @awhitcroft

    short i/o: fix calls to read to use xread or read_in_full

    awhitcroft authored Junio C Hamano committed
    We have a number of badly checked read() calls.  Often we are
    expecting read() to read exactly the size we requested or fail, this
    fails to handle interrupts or short reads.  Add a read_in_full()
    providing those semantics.  Otherwise we at a minimum need to check
    for EINTR and EAGAIN, where this is appropriate use xread().
    
    Signed-off-by: Andy Whitcroft <apw@shadowen.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. Detached HEAD (experimental)

    Junio C Hamano authored
    This allows "git checkout v1.4.3" to dissociate the HEAD of
    repository from any branch.  After this point, "git branch"
    starts reporting that you are not on any branch.  You can go
    back to an existing branch by saying "git checkout master", for
    example.
    
    This is still experimental.  While I think it makes sense to
    allow commits on top of detached HEAD, it is rather dangerous
    unless you are careful in the current form.  Next "git checkout
    master" will obviously lose what you have done, so we might want
    to require "git checkout -f" out of a detached HEAD if we find
    that the HEAD commit is not an ancestor of any other branches.
    There is no such safety valve implemented right now.
    
    On the other hand, the reason the user did not start the ad-hoc
    work on a new branch with "git checkout -b" was probably because
    the work was of a throw-away nature, so the convenience of not
    having that safety valve might be even better.  The user, after
    accumulating some commits on top of a detached HEAD, can always
    create a new branch with "git checkout -b" not to lose useful
    work done while the HEAD was detached.
    
    We'll see.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Dec 20, 2006
  1. simplify inclusion of system header files.

    Junio C Hamano authored
    This is a mechanical clean-up of the way *.c files include
    system header files.
    
     (1) sources under compat/, platform sha-1 implementations, and
         xdelta code are exempt from the following rules;
    
     (2) the first #include must be "git-compat-util.h" or one of
         our own header file that includes it first (e.g. config.h,
         builtin.h, pkt-line.h);
    
     (3) system headers that are included in "git-compat-util.h"
         need not be included in individual C source files.
    
     (4) "git-compat-util.h" does not have to include subsystem
         specific header files (e.g. expat.h).
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Nov 6, 2006
  1. adjust_shared_perm: chmod() only when needed.

    Junio C Hamano authored
    When widening permission for files and directories in a 'shared'
    repository for a user with inappropriate umask() setting for
    shared work, make sure we call chmod() only when we actually
    need to.
    
    The primary idea owes credit to Johannes.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 16, 2006
  1. Allow multiple "git_path()" uses

    Linus Torvalds authored Junio C Hamano committed
    This allows you to maintain a few filesystem pathnames concurrently, by
    simply replacing the single static "pathname" buffer with a LRU of four
    buffers.
    
    We did exactly the same thing with sha1_to_hex(), for pretty much exactly
    the same reason. Sometimes you want to use two pathnames, and while it's
    easy enough to xstrdup() them, why not just do the LU buffer thing.
    
    Signed-off-by: Linus Torvalds <torvalds@osdl.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jun 25, 2006
  1. Rename safe_strncpy() to strlcpy().

    Peter Eriksen authored Junio C Hamano committed
    This cleans up the use of safe_strncpy() even more.  Since it has the
    same semantics as strlcpy() use this name instead.  Also move the
    definition from inside path.c to its own file compat/strlcpy.c, and use
    it conditionally at compile time, since some platforms already has
    strlcpy().  It's included in the same way as compat/setenv.c.
    
    Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jun 18, 2006
  1. Merge branch 'js/diff'

    Junio C Hamano authored
Commits on Jun 17, 2006
  1. Implement safe_strncpy() as strlcpy() and use it more.

    Peter Eriksen authored Junio C Hamano committed
    Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jun 10, 2006
  1. shared repository: optionally allow reading to "others".

    Junio C Hamano authored
    This enhances core.sharedrepository to have additionally
    specify that read and exec permissions to be given to others as
    well.  It is useful when serving a repository via gitweb and
    git-daemon that runs as a user outside the project group.
    
    The configuration item can take the following values:
    
        [core]
    	sharedrepository 	 ; the same as "group"
    	sharedrepository = true  ; ditto
    	sharedrepository = 1	 ; ditto
    	sharedrepository = group ; allow rwx to group
    	sharedrepository = all   ; allow rwx to group, allow rx to other
    	sharedrepository = umask ; not shared - use umask
    
    It also extends "git init-db" to take "--shared=all" and friends
    from the command line.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. shared repository - add a few missing calls to adjust_shared_perm().

    Junio C Hamano authored
    There were a few calls to adjust_shared_perm() that were
    missing:
    
     - init-db creates refs, refs/heads, and refs/tags before
       reading from templates that could specify sharedrepository in
       the config file;
    
     - updating config file created it under user's umask without
       adjusting;
    
     - updating refs created it under user's umask without
       adjusting;
    
     - switching branches created .git/HEAD under user's umask
       without adjusting.
    
    This moves adjust_shared_perm() from sha1_file.c to path.c,
    since a few SIMPLE_PROGRAM need to call repository configuration
    functions which in turn need to call adjust_shared_perm().
    sha1_file.c needs to link with SHA1 computation library which
    is usually not linked to SIMPLE_PROGRAM.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Dec 4, 2005
  1. [PATCH] daemon.c and path.enter_repo(): revamp path validation.

    Junio C Hamano authored
    The whitelist of git-daemon is checked against return value from
    enter_repo(), and enter_repo() used to return the value obtained
    from getcwd() to avoid directory aliasing issues as discussed
    earier (mid October 2005).
    
    Unfortunately, it did not go well as we hoped.
    
    For example, /pub on a kernel.org public machine is a symlink to
    its real mountpoint, and it is understandable that the
    administrator does not want to adjust the whitelist every time
    /pub needs to point at a different partition for storage
    allcation or whatever reasons.  Being able to keep using
    /pub/scm as the whitelist is a desirable property.
    
    So this version of enter_repo() reports what it used to chdir()
    and validate, but does not use getcwd() to canonicalize the
    directory name.  When it sees a user relative path ~user/path,
    it internally resolves it to try chdir() there, but it still
    reports ~user/path (possibly after appending .git if allowed to
    do so, in which case it would report ~user/path.git).
    
    What this means is that if a whitelist wants to allow a user
    relative path, it needs to say "~" (for all users) or list user
    home directories like "~alice" "~bob".  And no, you cannot say
    /home if the advertised way to access user home directories are
    ~alice,~bob, etc.  The whole point of this is to avoid
    unnecessary aliasing issues.
    
    Anyway, because of this, daemon needs to do a bit more work to
    guard itself.  Namely, it needs to make sure that the accessor
    does not try to exploit its leading path match rule by inserting
    /../ in the middle or hanging /.. at the end.  I resurrected the
    belts and suspender paranoia code HPA did for this purpose.
    
    This check cannot be done in the enter_repo() unconditionally,
    because there are valid callers of enter_repo() that want to
    honor /../; authorized users coming over ssh to run send-pack
    and fetch-pack should be allowed to do so.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Nov 27, 2005
  1. Check repository format version in enter_repo().

    Junio C Hamano authored
    After daemon, upload-pack and receive-pack find out where the
    git directory is and chdir() there, make sure that repository is
    in a format we understand, after putenv("GIT_DIR=.") so that it
    knows to pick up the configuration file from there.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Nov 21, 2005
  1. Fix "do not DWIM" patch to enter_repo"

    Junio C Hamano authored
    We wanted --strict to mean "do not DWIM", but the code required to
    see absolute path.  daemon does its own path verification and chdirs
    to the verified repository, so enter_repo() called from upload-pack
    will always enter ".".  Requiring absolute path does not make any sense.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. @tihirvon

    Fix sparse warnings

    tihirvon authored Junio C Hamano committed
    Make some functions static and convert func() function prototypes to to
    func(void).  Fix declaration after statement, missing declaration and
    redundant declaration warnings.
    
    Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Nov 20, 2005
  1. Do not DWIM in userpath library under strict mode.

    Junio C Hamano authored
    This should force git-daemon administrator's job a bit harder
    because the exact paths need to be given in the whitelist, but
    at the same time makes the auditing easier.
    
    This moves validate_symref() from refs.c to path.c, because we
    need to link path.c with git-daemon for its "enter_repo()", but
    we do not want to link the daemon with the rest of git libraries
    and its requirements.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. Library code for user-relative paths, take three.

    Andreas Ericsson authored Junio C Hamano committed
    This patch provides the work-horse of the user-relative paths feature,
    using Linus' idea of a blind chdir() and getcwd() which makes it
    remarkably simple.
    
    Signed-off-by: Andreas Ericsson <ae@op5.se>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 27, 2005
  1. [PATCH] Provide access to git_dir through get_git_dir().

    Sven Verdoolaege authored Junio C Hamano committed
    Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 9, 2005
  1. Retire support for old environment variables.

    Junio C Hamano authored
    We have deprecated the old environment variable names for quite a
    while and now it's time to remove them.  Gone are:
    
        SHA1_FILE_DIRECTORIES AUTHOR_DATE AUTHOR_EMAIL AUTHOR_NAME
        COMMIT_AUTHOR_EMAIL COMMIT_AUTHOR_NAME SHA1_FILE_DIRECTORY
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 24, 2005
  1. Fix ?: statements.

    Jason Riedy authored
    Omitting the first branch in ?: is a GNU extension.  Cute,
    but not supported by other compilers.  Replaced mostly
    by explicit tests.  Calls to getenv() simply are repeated
    on non-GNU compilers.
    
    Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
Commits on Aug 9, 2005
  1. [PATCH] git_mkstemp() fix

    Holger Eitzenberger authored Junio C Hamano committed
    git_mkstemp() attempted to use TMPDIR environment variable, but it botched
    copying the templates.
    
    [jc: Holger, please add your own Signed-off-by line, and also if you can,
    send in future patches as non attachments.]
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 6, 2005
  1. [PATCH] git: add git_mkstemp()

    Holger Eitzenberger authored Junio C Hamano committed
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jul 8, 2005
  1. Add "mkpath()" helper function

    Linus Torvalds authored
    I'm bored with doing it by hand all the time.
Something went wrong with that request. Please try again.