Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 30, 2012
  1. @gitster

    remove superfluous newlines in error messages

    Pete Wyckoff authored gitster committed
    The error handling routines add a newline.  Remove
    the duplicate ones in error messages.
    
    Signed-off-by: Pete Wyckoff <pw@padd.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 24, 2012
  1. @gitster

    Merge branch 'hv/submodule-recurse-push'

    gitster authored
    "git push --recurse-submodules" learns to optionally look into the
    histories of submodules bound to the superproject and push them out.
    
    By Heiko Voigt
    * hv/submodule-recurse-push:
      push: teach --recurse-submodules the on-demand option
      Refactor submodule push check to use string list instead of integer
      Teach revision walking machinery to walk multiple times sequencially
Commits on Mar 30, 2012
  1. @gitster

    Teach revision walking machinery to walk multiple times sequencially

    Heiko Voigt authored gitster committed
    Previously it was not possible to iterate revisions twice using the
    revision walking api. We add a reset_revision_walk() which clears the
    used flags. This allows us to do multiple sequencial revision walks.
    
    We add the appropriate calls to the existing submodule machinery doing
    revision walks. This is done to avoid surprises if future code wants to
    call these functions more than once during the processes lifetime.
    
    Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 7, 2012
  1. @pclouds @gitster

    parse_object: avoid putting whole blob in core

    pclouds authored gitster committed
    Traditionally, all the callers of check_sha1_signature() first
    called read_sha1_file() to prepare the whole object data in core,
    and called this function.  The function is used to revalidate what
    we read from the object database actually matches the object name we
    used to ask for the data from the object database.
    
    Update the API to allow callers to pass NULL as the object data, and
    have the function read and hash the object data using streaming API
    to recompute the object name, without having to hold everything in
    core at the same time.  This is most useful in parse_object() that
    parses a blob object, because this caller does not have to keep the
    actual blob data around in memory after a "struct blob" is returned.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 5, 2012
  1. @peff @gitster

    parse_object: try internal cache before reading object db

    peff authored gitster committed
    When parse_object is called, we do the following:
    
      1. read the object data into a buffer via read_sha1_file
    
      2. call parse_object_buffer, which then:
    
         a. calls the appropriate lookup_{commit,tree,blob,tag}
    	to either create a new "struct object", or to find
    	an existing one. We know the appropriate type from
    	the lookup in step 1.
    
         b. calls the appropriate parse_{commit,tree,blob,tag}
            to parse the buffer for the new (or existing) object
    
    In step 2b, all of the called functions are no-ops for
    object "X" if "X->object.parsed" is set. I.e., when we have
    already parsed an object, we end up going to a lot of work
    just to find out at a low level that there is nothing left
    for us to do (and we throw away the data from read_sha1_file
    unread).
    
    We can optimize this by moving the check for "do we have an
    in-memory object" from 2a before the expensive call to
    read_sha1_file in step 1.
    
    This might seem circular, since step 2a uses the type
    information determined in step 1 to call the appropriate
    lookup function. However, we can notice that all of the
    lookup_* functions are backed by lookup_object. In other
    words, all of the objects are kept in a master hash table,
    and we don't actually need the type to do the "do we have
    it" part of the lookup, only to do the "and create it if it
    doesn't exist" part.
    
    This can save time whenever we call parse_object on the same
    sha1 twice in a single program. Some code paths already
    perform this optimization manually, with either:
    
      if (!obj->parsed)
    	  obj = parse_object(obj->sha1);
    
    if you already have a "struct object", or:
    
      struct object *obj = lookup_unknown_object(sha1);
      if (!obj || !obj->parsed)
    	  obj = parse_object(sha1);
    
    if you don't.  This patch moves the optimization into
    parse_object itself.
    
    Most git operations won't notice any impact. Either they
    don't parse a lot of duplicate sha1s, or the calling code
    takes special care not to re-parse objects. I timed two
    code paths that do benefit (there may be more, but these two
    were immediately obvious and easy to time).
    
    The first is fast-export, which calls parse_object on each
    object it outputs, like this:
    
      object = parse_object(sha1);
      if (!object)
    	  die(...);
      if (object->flags & SHOWN)
    	  return;
    
    which means that just to realize we have already shown an
    object, we will read the whole object from disk!
    
    With this patch, my best-of-five time for "fast-export --all" on
    git.git dropped from 26.3s to 21.3s.
    
    The second case is upload-pack, which will call parse_object
    for each advertised ref (because it needs to peel tags to
    show "^{}" entries). This doesn't matter for most
    repositories, because they don't have a lot of refs pointing
    to the same objects. However, if you have a big alternates
    repository with a shared object db for a number of child
    repositories, then the alternates repository will have
    duplicated refs representing each of its children.
    
    For example, GitHub's alternates repository for git.git has
    ~120,000 refs, of which only ~3200 are unique. The time for
    upload-pack to print its list of advertised refs dropped
    from 3.4s to 0.76s.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Nov 17, 2011
  1. @gitster

    receive-pack, fetch-pack: reject bogus pack that records objects twice

    gitster authored
    When receive-pack & fetch-pack are run and store the pack obtained over
    the wire to a local repository, they internally run the index-pack command
    with the --strict option. Make sure that we reject incoming packfile that
    records objects twice to avoid spreading such a damage.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 15, 2011
  1. @gitster

    read_sha1_file(): get rid of read_sha1_file_repl() madness

    gitster authored
    Most callers want to silently get a replacement object, and they do not
    care what the real name of the replacement object is.  Worse yet, no sane
    interface to return the underlying object without replacement is provided.
    
    Remove the function and make only the few callers that want the name of
    the replacement object find it themselves.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 6, 2010
  1. @gitster

    Merge branch 'maint'

    gitster authored
    * maint:
      tag.c: whitespace breakages fix
      Fix whitespace issue in object.c
      t5505: add missing &&
  2. @gitster

    Merge branch 'xx/trivial' into maint

    gitster authored
    * xx/trivial:
      tag.c: whitespace breakages fix
      Fix whitespace issue in object.c
      t5505: add missing &&
  3. @jhance @gitster

    Fix whitespace issue in object.c

    jhance authored gitster committed
    Change some expanded tabs (spaces) to tabs in object.c.
    
    Signed-off-by: Jared Hance <jaredhance@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Sep 4, 2010
  1. @gitster

    Merge branch 'nd/maint-fix-replace'

    gitster authored
    * nd/maint-fix-replace:
      parse_object: pass on the original sha1, not the replaced one
  2. @pclouds @gitster

    parse_object: pass on the original sha1, not the replaced one

    pclouds authored gitster committed
    Commit 0e87c36 (object: call "check_sha1_signature" with the
    replacement sha1) changed the first argument passed to
    parse_object_buffer() from "sha1" to "repl". With that change,
    the returned obj pointer has the replacement SHA1 in obj->sha1,
    not the original one.
    
    But when using lookup_commit() and then parse_commit() on a
    commit, we get an object pointer with the original sha1, but
    the commit content comes from the replacement commit.
    
    So the result we get from using parse_object() is different
    from the we get from using lookup_commit() followed by
    parse_commit().
    
    It looks much simpler and safer to fix this inconsistency by
    passing "sha1" to parse_object_bufer() instead of "repl".
    
    The commit comment should be used to tell the the replacement
    commit is replacing another commit and why. So it should be
    easy to see that we have a replacement commit instead of an
    original one.
    
    And it is not a problem if the content of the commit is not
    consistent with the sha1 as cat-file piped to hash-object can
    be used to see the difference.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 20, 2010
  1. @jrn @gitster

    fix "bundle --stdin" segfault

    jrn authored gitster committed
    When passed an empty list, objects_array_remove_duplicates() corrupts it
    by changing the number of entries from 0 to 1.
    
    The problem lies in the condition of its main loop:
    
    	for (ref = 0; ref < array->nr - 1; ref++) {
    
    The loop body manipulates the supplied object array.  In the case of an
    empty array, it should not be doing anything at all.  But array->nr is an
    unsigned quantity, so the code enters the loop, in particular increasing
    array->nr.  Fix this by comparing (ref + 1 < array->nr) instead.
    
    This bug can be triggered by git bundle --stdin:
    
    	$ echo HEAD | git bundle create some.bundle --stdin’
    	Segmentation fault (core dumped)
    
    The list of commits to bundle appears to be empty because of another bug:
    by the time the revision-walking machinery gets to look at it, standard
    input has already been consumed by rev-list, so this function gets an
    empty list of revisions.
    
    After this patch, git bundle --stdin still does not work; it just doesn’t
    segfault any more.
    
    Reported-by: Joey Hess <joey@kitenet.net>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 18, 2010
  1. @gitster

    object.c: remove unused functions

    gitster authored
    object_list_append() and object_list_length}() are not used anywhere.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 1, 2009
  1. @chriscool @gitster

    object: call "check_sha1_signature" with the replacement sha1

    chriscool authored gitster committed
    Otherwise we get a "sha1 mismatch" error for replaced objects.
    
    Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 20, 2009
  1. @toofishes @gitster

    Unify signedness in hashing calls

    toofishes authored gitster committed
    Our hash_obj and hashtable_index calls and functions were doing a lot of
    funny things with signedness. Unify all of it to 'unsigned int'.
    
    Signed-off-by: Dan McGee <dpmcgee@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 17, 2009
  1. @toofishes @gitster

    Fix type-punning issues

    toofishes authored gitster committed
    In these two places we are casting part of our unsigned char sha1 array into
    an unsigned int, which violates GCCs strict-aliasing rules (and probably
    other compilers).
    
    Signed-off-by: Dan McGee <dpmcgee@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jan 18, 2009
  1. @gitster

    bundle: allow the same ref to be given more than once

    gitster authored
    "git bundle create x master master" used to create a bundle that lists
    the same branch (master) twice.  Cloning from such a bundle resulted in
    a needless warning "warning: Duplicated ref: refs/remotes/origin/master".
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 4, 2008
  1. @gitster

    parse_object_buffer: don't ignore errors from the object specific par…

    Martin Koegler authored gitster committed
    …sing functions
    
    In the case of an malformed object, the object specific parsing functions
    would return an error, which is currently ignored. The object can be partial
    initialized in this case.
    
    This patch make parse_object_buffer propagate such errors.
    
    Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 22, 2007
  1. @gitster

    Don't dereference NULL upon lookup failure.

    Jim Meyering authored gitster committed
    Instead, signal the error just like the case we do upon encountering
    an object with an unknown type.
    
    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 6, 2007
  1. @gitster

    Don't assume tree entries that are not dirs are blobs

    Sam Vilain authored gitster committed
    When scanning the trees in track_tree_refs() there is a "lazy" test
    that assumes that entries are either directories or files.  Don't do
    that.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 25, 2007
  1. Merge branch 'maint-1.5.1' into maint

    Junio C Hamano authored
    * maint-1.5.1:
      fix memory leak in parse_object when check_sha1_signature fails
      name-rev: tolerate clock skew in committer dates
  2. @jasampler

    fix memory leak in parse_object when check_sha1_signature fails

    jasampler authored Junio C Hamano committed
    When check_sha1_signature fails, program is not terminated:
    it prints an error message and returns NULL, so the
    buffer returned by read_sha1_file should be freed before.
    
    Signed-off-by: Carlos Rica <jasampler@gmail.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Apr 24, 2007
  1. add add_object_array_with_mode

    Martin Koegler authored Junio C Hamano committed
    Each object in struct object_array is extended with the mode.
    If not specified, S_IFINVALID is used. An object with an mode value
    can be added with add_object_array_with_mode.
    
    Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Apr 17, 2007
  1. @torvalds

    Clean up object creation to use more common code

    torvalds authored Junio C Hamano committed
    This replaces the fairly odd "created_object()" function that did _most_
    of the object setup with a more complete "create_object()" function that
    also has a more natural calling convention.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. @torvalds

    Use proper object allocators for unknown object nodes too

    torvalds authored Junio C Hamano committed
    We used to use a different allocator scheme for when we didn't know the
    object type.  That meant that objects that were created without any
    up-front knowledge of the type would not go through the same allocation
    paths as normal object allocations, and would miss out on the statistics.
    
    But perhaps more importantly than the statistics (that are useful when
    looking at memory usage but not much else), if we want to make the
    object hash tables use a denser object pointer representation, we need
    to make sure that they all go through the same blocking allocator.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Mar 21, 2007
  1. @torvalds

    Don't ever return corrupt objects from "parse_object()"

    torvalds authored Junio C Hamano committed
    Looking at the SHA1 validation code due to the corruption that Alexander
    Litvinov is seeing under Cygwin, I notice that one of the most central
    places where we read objects, we actually do end up verifying the SHA1 of
    the result, but then we happily parse it anyway.
    
    And using "printf" to write the error message means that it not only can
    get lost, but will actually mess up stdout, and cause other strange and
    hard-to-debug failures downstream.
    
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Feb 27, 2007
  1. get rid of lookup_object_type()

    Nicolas Pitre authored Junio C Hamano committed
    This function is called only once in the whole source tree.  Let's move
    its code inline instead, which is also in the spirit of removing as much
    object type char arrays as possible (not that this patch does anything for
    that but at least it is now a local matter).
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  2. convert object type handling from a string to a number

    Nicolas Pitre authored Junio C Hamano committed
    We currently have two parallel notation for dealing with object types
    in the code: a string and a numerical value.  One of them is obviously
    redundent, and the most used one requires more stack space and a bunch
    of strcmp() all over the place.
    
    This is an initial step for the removal of the version using a char array
    found in object reading code paths.  The patch is unfortunately large but
    there is no sane way to split it in smaller parts without breaking the
    system.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
  3. formalize typename(), and add its reverse type_from_string()

    Nicolas Pitre authored Junio C Hamano committed
    Sometime typename() is used, sometimes type_names[] is accessed directly.
    Let's enforce typename() all the time which allows for validating the
    type.
    
    Also let's add a function to go from a name to a type and use it instead
    of manual memcpy() when appropriate.
    
    Signed-off-by: Nicolas Pitre <nico@cam.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Sep 16, 2006
  1. Add git-for-each-ref: helper for language bindings

    Junio C Hamano authored
    This adds a new command, git-for-each-ref.  You can have it iterate
    over refs and have it output various aspects of the objects they
    refer to.
    
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 28, 2006
  1. @jonas

    Use xcalloc instead of calloc

    jonas authored Junio C Hamano committed
    Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 23, 2006
  1. @spearce

    Convert memcpy(a,b,20) to hashcpy(a,b).

    spearce authored Junio C Hamano committed
    This abstracts away the size of the hash values when copying them
    from memory location to memory location, much as the introduction
    of hashcmp abstracted away hash value comparsion.
    
    A few call sites were using char* rather than unsigned char* so
    I added the cast rather than open hashcpy to be void*.  This is a
    reasonable tradeoff as most call sites already use unsigned char*
    and the existing hashcmp is also declared to be unsigned char*.
    
    [jc: Splitted the patch to "master" part, to be followed by a
     patch for merge-recursive.c which is not in "master" yet.
    
     Fixed the cast in the latter hunk to combine-diff.c which was
     wrong in the original.
    
     Also converted ones left-over in combine-diff.c, diff-lib.c and
     upload-pack.c ]
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Aug 17, 2006
  1. Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length.

    David Rientjes authored Junio C Hamano committed
    Introduces global inline:
    
    	hashcmp(const unsigned char *sha1, const unsigned char *sha2)
    
    Uses memcmp for comparison and returns the result based on the length of
    the hash name (a future runtime decision).
    
    Acked-by: Alex Riesen <raa.lkml@gmail.com>
    Signed-off-by: David Rientjes <rientjes@google.com>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Commits on Jul 13, 2006
  1. Remove TYPE_* constant macros and use object_type enums consistently.

    Linus Torvalds authored Junio C Hamano committed
    This updates the type-enumeration constants introduced to reduce
    the memory footprint of "struct object" to match the type bits
    already used in the packfile format, by removing the former
    (i.e. TYPE_* constant macros) and using the latter (i.e. enum
    object_type) throughout the code for consistency.
    
    Eventually we can stop passing around the "type strings"
    entirely, and this will help - no confusion about two different
    integer enumeration.
    
    Signed-off-by: Linus Torvalds <torvalds@osdl.org>
    Signed-off-by: Junio C Hamano <junkio@cox.net>
Something went wrong with that request. Please try again.