Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Mar 25, 2014

  1. Junio C Hamano

    Merge branch 'mh/remove-subtree-long-pathname-fix'

    * mh/remove-subtree-long-pathname-fix:
      entry.c: fix possible buffer overflow in remove_subtree()
      checkout_entry(): use the strbuf throughout the function
    authored March 25, 2014

Oct 24, 2013

  1. Junio C Hamano

    checkout_entry(): clarify the use of topath[] parameter

    The said function has this signature:
    	extern int checkout_entry(struct cache_entry *ce,
    				  const struct checkout *state,
    				  char *topath);
    At first glance, it might appear that the caller of checkout_entry()
    can specify to which path the contents are written out by the last
    parameter, and it is tempting to add "const" in front of its type.
    In reality, however, topath[] is to point at a buffer to store the
    temporary path generated by the callchain originating from this
    function, and the temporary path is always short, much shorter than
    the buffer prepared by its only caller in builtin/checkout-index.c.
    Document the code a bit to clarify so that future callers know how
    to use the function better.
    Noticed-by: Nguyễn Thái Ngọc Duy <>
    Signed-off-by: Junio C Hamano <>
    authored October 23, 2013

Jul 22, 2013

  1. Junio C Hamano

    Merge branch 'nd/const-struct-cache-entry'

    * nd/const-struct-cache-entry:
      Convert "struct cache_entry *" to "const ..." wherever possible
    authored July 22, 2013

Apr 03, 2013

  1. Junio C Hamano

    Merge branch 'jk/check-corrupt-objects-carefully'

    Have the streaming interface and other codepaths more carefully
    examine for corrupt objects.
    * jk/check-corrupt-objects-carefully:
      clone: leave repo in place after checkout errors
      clone: run check_everything_connected
      clone: die on errors from unpack_trees
      add tests for cloning corrupted repositories
      streaming_write_entry: propagate streaming errors
      add test for streaming corrupt blobs
      avoid infinite loop in read_istream_loose
      read_istream_filtered: propagate read error from upstream
      check_sha1_signature: check return value from read_istream
      stream_blob_to_fd: detect errors reading from stream
    authored April 03, 2013

Mar 28, 2013

  1. Junio C Hamano

    Merge branch 'jk/checkout-attribute-lookup'

    Codepath to stream blob object contents directly from the object
    store to filesystem did not use the correct path to find conversion
    filters when writing to temporary files.
    * jk/checkout-attribute-lookup:
      t2003: work around path mangling issue on Windows
      entry: fix filter lookup
      t2003: modernize style
    authored March 28, 2013

Mar 07, 2012

  1. Junio C Hamano

    streaming: make streaming-write-entry to be more reusable

    The static function in entry.c takes a cache entry and streams its blob
    contents to a file in the working tree.  Refactor the logic to a new API
    function stream_blob_to_fd() that takes an object name and an open file
    descriptor, so that it can be reused by other callers.
    Signed-off-by: Nguyễn Thái Ngọc Duy <>
    Signed-off-by: Junio C Hamano <>
    authored March 07, 2012

May 26, 2011

  1. Junio C Hamano

    Add streaming filter API

    This introduces an API to plug custom filters to an input stream.
    The caller gets get_stream_filter("path") to obtain an appropriate
    filter for the path, and then uses it when opening an input stream
    via open_istream().  After that, the caller can read from the stream
    with read_istream(), and close it with close_istream(), just like an
    unfiltered stream.
    This only adds a "null" filter that is a pass-thru filter, but later
    changes can add LF-to-CRLF and other filters, and the callers of the
    streaming API do not have to change.
    Signed-off-by: Junio C Hamano <>
    authored May 20, 2011

May 21, 2011

  1. Junio C Hamano

    streaming_write_entry(): support files with holes

    One typical use of a large binary file is to hold a sparse on-disk hash
    table with a lot of holes. Help preserving the holes with lseek().
    Signed-off-by: Junio C Hamano <>
    authored May 13, 2011
  2. Junio C Hamano

    streaming_write_entry(): use streaming API in write_entry()

    When the output to a path does not have to be converted, we can read from
    the object database from the streaming API and write to the file in the
    working tree, without having to hold everything in the memory.
    The ident, auto- and safe- crlf conversions inherently require you to read
    the whole thing before deciding what to do, so while it is technically
    possible to support them by using a buffer of an unbound size or rewinding
    and reading the stream twice, it is less practical than the traditional
    "read the whole thing in core and convert" approach.
    Adding streaming filters for the other conversions on top of this should
    be doable by tweaking the can_bypass_conversion() function (it should be
    renamed to can_filter_stream() when it happens). Then the streaming API
    can be extended to wrap the git_istream streaming_write_entry() opens on
    the underlying object in another git_istream that reads from it, filters
    what is read, and let the streaming_write_entry() read the filtered
    result. But that is outside the scope of this series.
    Signed-off-by: Junio C Hamano <>
    authored May 12, 2011
  3. Junio C Hamano

    write_entry(): separate two helper functions out

    In the write-out codepath, a block of code determines what file in the
    working tree to write to, and opens an output file descriptor to it.
    After writing the contents out to the file, another block of code runs
    fstat() on the file descriptor when appropriate.
    Separate these blocks out to open_output_fd() and fstat_output()
    helper functions.
    Signed-off-by: Junio C Hamano <>
    authored May 12, 2011

Jan 20, 2010

  1. Junio C Hamano

    Merge branch 'jc/symbol-static'

    * jc/symbol-static:
      date.c: mark file-local function static
      Replace parse_blob() with an explanatory comment
      symlinks.c: remove unused functions
      object.c: remove unused functions
      strbuf.c: remove unused function
      sha1_file.c: remove unused function
      mailmap.c: remove unused function
      utf8.c: mark file-local function static
      submodule.c: mark file-local function static
      quote.c: mark file-local function static
      remote-curl.c: mark file-local function static
      read-cache.c: mark file-local functions static
      parse-options.c: mark file-local function static
      entry.c: mark file-local function static
      http.c: mark file-local functions static
      pretty.c: mark file-local function static
      builtin-rev-list.c: mark file-local function static
      bisect.c: mark file-local function static
    authored January 20, 2010

Jan 13, 2010

  1. Junio C Hamano

    Merge branch 'nd/sparse'

    * nd/sparse: (25 commits)
      t7002: test for not using external grep on skip-worktree paths
      t7002: set test prerequisite "external-grep" if supported
      grep: do not do external grep on skip-worktree entries
      commit: correctly respect skip-worktree bit
      ie_match_stat(): do not ignore skip-worktree bit with CE_MATCH_IGNORE_VALID
      tests: rename duplicate t1009
      sparse checkout: inhibit empty worktree
      Add tests for sparse checkout
      read-tree: add --no-sparse-checkout to disable sparse checkout support
      unpack-trees(): ignore worktree check outside checkout area
      unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index
      unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout
      unpack-trees.c: generalize verify_* functions
      unpack-trees(): add CE_WT_REMOVE to remove on worktree alone
      Introduce "sparse checkout"
      dir.c: export excluded_1() and add_excludes_from_file_1()
      excluded_1(): support exclude files in index
      unpack-trees(): carry skip-worktree bit over in merged_entry()
      Read .gitignore from index if it is skip-worktree
      Avoid writing to buffer in add_excludes_from_file_1()
    authored January 13, 2010

Jan 12, 2010

  1. Junio C Hamano

    entry.c: mark file-local function static

    Signed-off-by: Junio C Hamano <>
    authored January 11, 2010

Aug 18, 2009

  1. Junio C Hamano

    check_path(): allow symlinked directories to checkout-index --prefix

    Merlyn noticed that Documentation/ no longer correctly
    removes old installed documents when the target directory has a leading
    path that is a symlink.  It turns out that "checkout-index --prefix" was
    broken by recent b6986d8 (git-checkout: be careful about untracked
    symlinks, 2009-07-29).
    I suspect has_symlink_leading_path() could learn the third parameter
    (prefix that is allowed to be symlinked directories) to allow us to retire
    a similar function has_dirs_only_path().
    Another avenue of fixing this I considered was to get rid of base_dir and
    base_dir_len from "struct checkout", and instead make "git checkout-index"
    when run with --prefix mkdir the leading path and chdir in there.  It
    might be the best longer term solution to this issue, as the base_dir
    feature is used only by that rather obscure codepath as far as I know.
    But at least this patch should fix this breakage.
    Signed-off-by: Junio C Hamano <>
    authored August 16, 2009

Jan 26, 2009

  1. Junio C Hamano

    Merge branch 'kb/lstat-cache'

    * kb/lstat-cache:
      lstat_cache(): introduce clear_lstat_cache() function
      lstat_cache(): introduce invalidate_lstat_cache() function
      lstat_cache(): introduce has_dirs_only_path() function
      lstat_cache(): introduce has_symlink_or_noent_leading_path() function
      lstat_cache(): more cache effective symlink/directory detection
    authored January 25, 2009

Aug 31, 2008

  1. Junio C Hamano

    'git foo' program identifies itself without dash in die() messages

    This is a mechanical conversion of all '*.c' files with:
    	s/((?:die|error|warning)\("git)-(\S+:)/$1 $2/;
    The result was manually inspected and no false positive was found.
    Signed-off-by: Junio C Hamano <>
    authored August 31, 2008

Nov 14, 2007

  1. Junio C Hamano

    Merge branch 'jc/maint-add-sync-stat'

    * jc/maint-add-sync-stat:
      t2200: test more cases of "add -u"
      git-add: make the entry stat-clean after re-adding the same contents
      ce_match_stat, run_diff_files: use symbolic constants for readability
    authored November 14, 2007

Nov 10, 2007

  1. Junio C Hamano

    ce_match_stat, run_diff_files: use symbolic constants for readability

    ce_match_stat() can be told:
     (1) to ignore CE_VALID bit (used under "assume unchanged" mode)
         and perform the stat comparison anyway;
     (2) not to perform the contents comparison for racily clean
         entries and report mismatch of cached stat information;
    using its "option" parameter.  Give them symbolic constants.
    Similarly, run_diff_files() can be told not to report anything
    on removed paths.  Also give it a symbolic constant for that.
    Signed-off-by: Junio C Hamano <>
    authored November 10, 2007

Aug 15, 2007

  1. Junio C Hamano

    attr.c: read .gitattributes from index as well.

    This makes .gitattributes files to be read from the index when
    they are not checked out to the work tree.  This is in line with
    the way we always allowed low-level tools to operate in sparsely
    checked out work tree in a reasonable way.
    It swaps the order of new file creation and converting the blob
    to work tree representation; otherwise when we are in the middle
    of checking out .gitattributes we would notice an empty but
    unwritten .gitattributes file in the work tree and will ignore
    the copy in the index.
    Signed-off-by: Junio C Hamano <>
    authored August 14, 2007

Jul 19, 2007

  1. Junio C Hamano

    Merge branch 'maint'

    * maint:
      Force listingblocks to be monospaced in manpages
      Do not expect unlink(2) to fail on a directory.
    authored July 18, 2007

Jul 18, 2007

  1. Junio C Hamano

    Do not expect unlink(2) to fail on a directory.

    When "git checkout-index" checks out path A/B/C, it makes sure A
    and A/B are truly directories; if there is a regular file or
    symlink at A, we prefer to remove it.
    We used to do this by catching an error return from mkdir(2),
    and on EEXIST did unlink(2), and when it succeeded, tried
    another mkdir(2).
    Thomas Glanzmann found out the above does not work on Solaris
    for a root user, as unlink(2) was so old fashioned there that it
    allowed to unlink a directory.
    As pointed out, this still doesn't guarantee that git won't call
    "unlink()" on a directory (race conditions etc), but that's
    fundamentally true (there is no "funlink()" like there is
    "fstat()"), and besides, that is in no way git-specific (ie it's
    true of any application that gets run as root).
    Acked-by: Linus Torvalds <>
    Signed-off-by: Junio C Hamano <>
    authored July 17, 2007

Jun 07, 2007

  1. Junio C Hamano

    War on whitespace

    This uses "git-apply --whitespace=strip" to fix whitespace errors that have
    crept in to our source files over time.  There are a few files that need
    to have trailing whitespaces (most notably, test vectors).  The results
    still passes the test, and build result in Documentation/ area is unchanged.
    Signed-off-by: Junio C Hamano <>
    authored June 07, 2007
Something went wrong with that request. Please try again.