Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 11, 2008
  1. Christian Couder Junio C Hamano

    rev-parse --verify: do not output anything on error

    chriscool authored gitster committed
    Before this patch, when "git rev-parse --verify" was passed at least one
    good rev and then anything, it would output something for the good rev
    even if it would latter exit on error.
    
    With this patch, we only output something if everything is ok.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Christian Couder Junio C Hamano

    rev-parse: fix using "--default" with "--verify"

    chriscool authored gitster committed
    Before this patch, something like:
    
    $ git rev-parse --verify HEAD --default master
    
    did not work, while:
    
    $ git rev-parse --default master --verify HEAD
    
    worked.
    
    This patch fixes that, so that they both work (assuming
    HEAD and master can be parsed).
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 27, 2008
  1. Christian Couder Junio C Hamano

    rev-parse: fix --verify to error out when passed junk after a good rev

    chriscool authored gitster committed
    Before this patch something like:
    
    $ git rev-parse --verify <good-rev> <junk>
    
    worked whatever junk was as long as <good-rev> could be parsed
    correctly.
    
    This patch makes "git rev-parse --verify" error out when passed
    any junk after a good rev.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Christian Couder Junio C Hamano

    rev-parse: teach "--verify" to be quiet when using "-q" or "--quiet"

    chriscool authored gitster committed
    Currently "git rev-parse --verify <something>" is often used with
    its error output redirected to /dev/null. This patch makes it
    easier to do that.
    
    The -q|--quiet option is designed to work the same way as it does
    for "git symbolic-ref".
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 2, 2008
  1. Pierre Habouzit Junio C Hamano

    parse-opt: bring PARSE_OPT_HIDDEN and NONEG to git-rev-parse --parseopt

    MadCoder authored gitster committed
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 26, 2008
  1. Jay Soffian Junio C Hamano

    rev-parse: fix potential bus error with --parseopt option spec handling

    jaysoffian authored gitster committed
    A non-empty line containing no spaces should be treated by --parseopt as
    an option group header, but was causing a bus error. Also added a test
    script for rev-parse --parseopt.
    
    Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 7, 2008
  1. Junio C Hamano

    git-rev-parse --symbolic-full-name

    gitster authored
    The plumbing level can understand that the user meant
    "refs/heads/master" when the user says "master" or
    "heads/master", but there is no easy way for the scripts to
    figure it out without duplicating the dwim_ref() logic.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 4, 2007
  1. Christian Couder Junio C Hamano

    Trace and quote with argv: get rid of unneeded count argument.

    chriscool authored gitster committed
    Now that str_buf takes care of all the allocations, there is
    no more gain to pass an argument count.
    
    So this patch removes the "count" argument from:
    	- "sq_quote_argv"
    	- "trace_argv_printf"
    and all the callers.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 6, 2007
  1. Junio C Hamano

    git-rev-parse --parseopt

    gitster authored
    The "parseopt mode" of git-rev-parse does not need to be run
    inside a git repository, although the normal mode does.
    
    Most notabily, lack of this fix breaks git-clone script, as
    noticed by Nico.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Pierre Habouzit Junio C Hamano

    Add a parseopt mode to git-rev-parse to bring parse-options to shell …

    MadCoder authored gitster committed
    …scripts.
    
    Signed-off-by: Pierre Habouzit <madcoder@debian.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 1, 2007
  1. dscho Junio C Hamano

    Clean up work-tree handling

    dscho authored gitster committed
    The old version of work-tree support was an unholy mess, barely readable,
    and not to the point.
    
    For example, why do you have to provide a worktree, when it is not used?
    As in "git status".  Now it works.
    
    Another riddle was: if you can have work trees inside the git dir, why
    are some programs complaining that they need a work tree?
    
    IOW it is allowed to call
    
    	$ git --git-dir=../ --work-tree=. bla
    
    when you really want to.  In this case, you are both in the git directory
    and in the working tree.  So, programs have to actually test for the right
    thing, namely if they are inside a working tree, and not if they are
    inside a git directory.
    
    Also, GIT_DIR=../.git should behave the same as if no GIT_DIR was
    specified, unless there is a repository in the current working directory.
    It does now.
    
    The logic to determine if a repository is bare, or has a work tree
    (tertium non datur), is this:
    
    --work-tree=bla overrides GIT_WORK_TREE, which overrides core.bare = true,
    which overrides core.worktree, which overrides GIT_DIR/.. when GIT_DIR
    ends in /.git, which overrides the directory in which .git/ was found.
    
    In related news, a long standing bug was fixed: when in .git/bla/x.git/,
    which is a bare repository, git formerly assumed ../.. to be the
    appropriate git dir.  This problem was reported by Shawn Pearce to have
    caused much pain, where a colleague mistakenly ran "git init" in "/" a
    long time ago, and bare repositories just would not work.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 6, 2007
  1. Matthias Lederhofer Junio C Hamano

    introduce GIT_WORK_TREE to specify the work tree

    matled authored gitster committed
    setup_gdg is used as abbreviation for setup_git_directory_gently.
    
    The work tree can be specified using the environment variable
    GIT_WORK_TREE and the config option core.worktree (the environment
    variable has precendence over the config option).  Additionally
    there is a command line option --work-tree which sets the
    environment variable.
    
    setup_gdg does the following now:
    
    GIT_DIR unspecified
    repository in .git directory
        parent directory of the .git directory is used as work tree,
        GIT_WORK_TREE is ignored
    
    GIT_DIR unspecified
    repository in cwd
        GIT_DIR is set to cwd
        see the cases with GIT_DIR specified what happens next and
        also see the note below
    
    GIT_DIR specified
    GIT_WORK_TREE/core.worktree unspecified
        cwd is used as work tree
    
    GIT_DIR specified
    GIT_WORK_TREE/core.worktree specified
        the specified work tree is used
    
    Note on the case where GIT_DIR is unspecified and repository is in cwd:
        GIT_WORK_TREE is used but is_inside_git_dir is always true.
        I did it this way because setup_gdg might be called multiple
        times (e.g. when doing alias expansion) and in successive calls
        setup_gdg should do the same thing every time.
    
    Meaning of is_bare/is_inside_work_tree/is_inside_git_dir:
    
    (1) is_bare_repository
        A repository is bare if core.bare is true or core.bare is
        unspecified and the name suggests it is bare (directory not
        named .git).  The bare option disables a few protective
        checks which are useful with a working tree.  Currently
        this changes if a repository is bare:
            updates of HEAD are allowed
            git gc packs the refs
            the reflog is disabled by default
    
    (2) is_inside_work_tree
        True if the cwd is inside the associated working tree (if there
        is one), false otherwise.
    
    (3) is_inside_git_dir
        True if the cwd is inside the git directory, false otherwise.
        Before this patch is_inside_git_dir was always true for bare
        repositories.
    
    When setup_gdg finds a repository git_config(git_default_config) is
    always called.  This ensure that is_bare_repository makes use of
    core.bare and does not guess even though core.bare is specified.
    
    inside_work_tree and inside_git_dir are set if setup_gdg finds a
    repository.  The is_inside_work_tree and is_inside_git_dir functions
    will die if they are called before a successful call to setup_gdg.
    
    Signed-off-by: Matthias Lederhofer <matled@gmx.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Matthias Lederhofer Junio C Hamano

    rev-parse: introduce --is-bare-repository

    matled authored gitster committed
    Signed-off-by: Matthias Lederhofer <matled@gmx.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 21, 2007
  1. prefixcmp(): fix-up leftover strncmp().

    Junio C Hamano authored
    There were instances of strncmp() that were formatted improperly
    (e.g. whitespace around parameter before closing parenthesis)
    that caused the earlier mechanical conversion step to miss
    them.  This step cleans them up.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. Mechanical conversion to use prefixcmp()

    Junio C Hamano authored
    This mechanically converts strncmp() to use prefixcmp(), but only when
    the parameters match specific patterns, so that they can be verified
    easily.  Leftover from this will be fixed in a separate step, including
    idiotic conversions like
    
        if (!strncmp("foo", arg, 3))
    
      =>
    
        if (!(-prefixcmp(arg, "foo")))
    
    This was done by using this script in px.perl
    
       #!/usr/bin/perl -i.bak -p
       if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) {
               s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|;
       }
       if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) {
               s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|;
       }
    
    and running:
    
       $ git grep -l strncmp -- '*.c' | xargs perl px.perl
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Feb 5, 2007
  1. dscho

    Commands requiring a work tree must not run in GIT_DIR

    dscho authored Junio C Hamano committed
    This patch helps when you accidentally run something like git-clean
    in the git directory instead of the work tree.
    
    Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 21, 2006
  1. Tell between packed, unpacked and symbolic refs.

    Junio C Hamano authored
    This adds a "int *flag" parameter to resolve_ref() and makes
    for_each_ref() family to call callback function with an extra
    "int flag" parameter.  They are used to give two bits of
    information (REF_ISSYMREF and REF_ISPACKED) about the ref.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. Add callback data to for_each_ref() family.

    Junio C Hamano authored
    This is a long overdue fix to the API for for_each_ref() family
    of functions.  It allows the callers to specify a callback data
    pointer, so that the caller does not have to use static
    variables to communicate with the callback funciton.
    
    The updated for_each_ref() family takes a function of type
    
    	int (*fn)(const char *, const unsigned char *, void *)
    
    and a void pointer as parameters, and calls the function with
    the name of the ref and its SHA-1 with the caller-supplied void
    pointer as parameters.
    
    The commit updates two callers, builtin-name-rev.c and
    builtin-pack-refs.c as an example.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 16, 2006
  1. remove unnecessary initializations

    David Rientjes authored Junio C Hamano committed
    [jc: I needed to hand merge the changes to the updated codebase,
     so the result needs to be checked.]
    
    Signed-off-by: David Rientjes <rientjes@google.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jul 29, 2006
  1. Call setup_git_directory() much earlier

    Linus Torvalds authored Junio C Hamano committed
    This changes the calling convention of built-in commands and
    passes the "prefix" (i.e. pathname of $PWD relative to the
    project root level) down to them.
    
    Signed-off-by: Linus Torvalds <torvalds@osdl.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jul 7, 2006
  1. builtin-rev-parse.c: constness tightening

    Junio C Hamano authored
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jul 4, 2006
  1. Teach rev-parse the ... syntax.

    Santi Béjar authored Junio C Hamano committed
    [jc: moved the difference code around into its own function.]
    
    Signed-off-by: Santi Béjar <sbejar@gmail.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jun 28, 2006
  1. tihirvon

    Make some strings const

    tihirvon authored Junio C Hamano committed
    Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jun 6, 2006
  1. rev-parse: tighten constness properly.

    Junio C Hamano authored
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jun 4, 2006
  1. Christian Couder

    Builtin git-rev-parse.

    chriscool authored Junio C Hamano committed
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Something went wrong with that request. Please try again.