Skip to content
Commits on Aug 27, 2012
  1. @gitster

    Merge branch 'jk/maint-null-in-trees'

    gitster committed Aug 27, 2012
    We do not want a link to 0{40} object stored anywhere in our objects.
    
    * jk/maint-null-in-trees:
      fsck: detect null sha1 in tree entries
      do not write null sha1s to on-disk index
      diff: do not use null sha1 as a sentinel value
Commits on Aug 22, 2012
  1. @gitster

    Merge branch 'tr/void-diff-setup-done'

    gitster committed Aug 22, 2012
    Remove unnecessary code.
    
    * tr/void-diff-setup-done:
      diff_setup_done(): return void
Commits on Aug 3, 2012
  1. @trast @gitster

    diff_setup_done(): return void

    trast committed with gitster Aug 3, 2012
    diff_setup_done() has historically returned an error code, but lost
    the last nonzero return in 943d5b7 (allow diff.renamelimit to be set
    regardless of -M/-C, 2006-08-09).  The callers were in a pretty
    confused state: some actually checked for the return code, and some
    did not.
    
    Let it return void, and patch all callers to take this into account.
    This conveniently also gets rid of a handful of different(!) error
    messages that could never be triggered anyway.
    
    Note that the function can still die().
    
    Signed-off-by: Thomas Rast <trast@student.ethz.ch>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jul 29, 2012
  1. @peff @gitster

    diff: do not use null sha1 as a sentinel value

    peff committed with gitster Jul 28, 2012
    The diff code represents paths using the diff_filespec
    struct. This struct has a sha1 to represent the sha1 of the
    content at that path, as well as a sha1_valid member which
    indicates whether its sha1 field is actually useful. If
    sha1_valid is not true, then the filespec represents a
    working tree file (e.g., for the no-index case, or for when
    the index is not up-to-date).
    
    The diff_filespec is only used internally, though. At the
    interfaces to the diff subsystem, callers feed the sha1
    directly, and we create a diff_filespec from it. It's at
    that point that we look at the sha1 and decide whether it is
    valid or not; callers may pass the null sha1 as a sentinel
    value to indicate that it is not.
    
    We should not typically see the null sha1 coming from any
    other source (e.g., in the index itself, or from a tree).
    However, a corrupt tree might have a null sha1, which would
    cause "diff --patch" to accidentally diff the working tree
    version of a file instead of treating it as a blob.
    
    This patch extends the edges of the diff interface to accept
    a "sha1_valid" flag whenever we accept a sha1, and to use
    that flag when creating a filespec. In some cases, this
    means passing the flag through several layers, making the
    code change larger than would be desirable.
    
    One alternative would be to simply die() upon seeing
    corrupted trees with null sha1s. However, this fix more
    directly addresses the problem (while bogus sha1s in a tree
    are probably a bad thing, it is really the sentinel
    confusion sending us down the wrong code path that is what
    makes it devastating). And it means that git is more capable
    of examining and debugging these corrupted trees. For
    example, you can still "diff --raw" such a tree to find out
    when the bogus entry was introduced; you just cannot do a
    "--patch" diff (just as you could not with any other
    corrupted tree, as we do not have any content to diff).
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 2, 2012
  1. @gitster

    Merge branch 'lp/diffstat-with-graph'

    gitster committed May 2, 2012
    "log --graph" was not very friendly with "--stat" option and its output
    had line breaks at wrong places.
    
    By Lucian Poston (5) and Zbigniew Jędrzejewski-Szmek (2)
    * lp/diffstat-with-graph:
      t4052: work around shells unable to set COLUMNS to 1
      Prevent graph_width of stat width from falling below min
      t4052: Test diff-stat output with minimum columns
      t4052: Adjust --graph --stat output for prefixes
      Adjust stat width calculations to take --graph output into account
      Add output_prefix_length to diff_options
      t4052: test --stat output with --graph
Commits on Apr 16, 2012
  1. @gitster

    Merge branch 'jk/diff-no-rename-empty'

    gitster committed Apr 16, 2012
    Forbids rename detection logic from matching two empty files as renames
    during merge-recursive to prevent mismerges.
    
    By Jeff King
    * jk/diff-no-rename-empty:
      merge-recursive: don't detect renames of empty files
      teach diffcore-rename to optionally ignore empty content
      make is_empty_blob_sha1 available everywhere
      drop casts from users EMPTY_TREE_SHA1_BIN
  2. @lucianposton @gitster

    Add output_prefix_length to diff_options

    lucianposton committed with gitster Apr 16, 2012
    Add output_prefix_length to diff_options. Initialize the value to 0 and only
    set it when graph.c:diff_output_prefix_callback() is called.
    
    Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. @gitster

    Merge branch 'jc/diff-algo-cleanup'

    gitster committed Apr 15, 2012
    Resurrects the preparatory clean-up patches from another topic that was
    discarded, as this would give a saner foundation to build on diff.algo
    configuration option series.
    
    * jc/diff-algo-cleanup:
      xdiff: PATIENCE/HISTOGRAM are not independent option bits
      xdiff: remove XDL_PATCH_* macros
Commits on Mar 23, 2012
  1. @peff @gitster

    teach diffcore-rename to optionally ignore empty content

    peff committed with gitster Mar 22, 2012
    Our rename detection is a heuristic, matching pairs of
    removed and added files with similar or identical content.
    It's unlikely to be wrong when there is actual content to
    compare, and we already take care not to do inexact rename
    detection when there is not enough content to produce good
    results.
    
    However, we always do exact rename detection, even when the
    blob is tiny or empty. It's easy to get false positives with
    an empty blob, simply because it is an obvious content to
    use as a boilerplate (e.g., when telling git that an empty
    directory is worth tracking via an empty .gitignore).
    
    This patch lets callers specify whether or not they are
    interested in using empty files as rename sources and
    destinations. The default is "yes", keeping the original
    behavior. It works by detecting the empty-blob sha1 for
    rename sources and destinations.
    
    One more flexible alternative would be to allow the caller
    to specify a minimum size for a blob to be "interesting" for
    rename detection. But that would catch small boilerplate
    files, not large ones (e.g., if you had the GPL COPYING file
    in many directories).
    
    A better alternative would be to allow a "-rename"
    gitattribute to allow boilerplate files to be marked as
    such. I'll leave the complexity of that solution until such
    time as somebody actually wants it. The complaints we've
    seen so far revolve around empty files, so let's start with
    the simple thing.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 7, 2012
  1. @gitster

    Merge branch 'jc/pickaxe-ignore-case'

    gitster committed Mar 7, 2012
    By Junio C Hamano (2) and Ramsay Jones (1)
    * jc/pickaxe-ignore-case:
      ctype.c: Fix a sparse warning
      pickaxe: allow -i to search in patch case-insensitively
      grep: use static trans-case table
Commits on Mar 6, 2012
  1. @gitster

    Merge branch 'zj/diff-stat-dyncol'

    gitster committed Mar 6, 2012
    By Zbigniew Jędrzejewski-Szmek (8) and Junio C Hamano (1)
    * zj/diff-stat-dyncol:
      : This breaks tests. Perhaps it is not worth using the decimal-width stuff
      : for this series, at least initially.
      diff --stat: add config option to limit graph width
      diff --stat: enable limiting of the graph part
      diff --stat: add a test for output with COLUMNS=40
      diff --stat: use a maximum of 5/8 for the filename part
      merge --stat: use the full terminal width
      log --stat: use the full terminal width
      show --stat: use the full terminal width
      diff --stat: use the full terminal width
      diff --stat: tests for long filenames and big change counts
Commits on Mar 1, 2012
  1. @keszybz @gitster

    diff --stat: enable limiting of the graph part

    keszybz committed with gitster Mar 1, 2012
    A new option --stat-graph-width=<width> can be used to limit the width
    of the graph part even is more space is available. Up to <width>
    columns will be used for the graph.
    
    If commits changing a lot of lines are displayed in a wide terminal
    window (200 or more columns), and the +- graph uses the full width,
    the output can be hard to comfortably scan with a horizontal movement
    of human eyes. Messages wrapped to about 80 columns would be
    interspersed with very long +- lines. It makes sense to limit the
    width of the graph part to a fixed value (e.g. 70 columns), even if
    more columns are available.
    
    Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 29, 2012
  1. @gitster

    pickaxe: allow -i to search in patch case-insensitively

    gitster committed Feb 21, 2012
    "git log -S<string>" is a useful way to find the last commit in the
    codebase that touched the <string>. As it was designed to be used by a
    porcelain script to dig the history starting from a block of text that
    appear in the starting commit, it never had to look for anything but an
    exact match.
    
    When used by an end user who wants to look for the last commit that
    removed a string (e.g. name of a variable) that he vaguely remembers,
    however, it is useful to support case insensitive match.
    
    When given the "--regexp-ignore-case" (or "-i") option, which originally
    was designed to affect case sensitivity of the search done in the commit
    log part, e.g. "log --grep", the matches made with -S/-G pickaxe search is
    done case insensitively now.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 19, 2012
  1. @gitster

    xdiff: PATIENCE/HISTOGRAM are not independent option bits

    gitster committed Feb 19, 2012
    Because the default Myers, patience and histogram algorithms cannot be in
    effect at the same time, XDL_PATIENCE_DIFF and XDL_HISTOGRAM_DIFF are not
    independent bits.  Instead of wasting one bit per algorithm, define a few
    macros to access the few bits they occupy and update the code that access
    them.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Feb 4, 2012
  1. @pclouds @gitster

    Use correct grammar in diffstat summary line

    pclouds committed with gitster Feb 1, 2012
    "git diff --stat" and "git apply --stat" now learn to print the line
    "%d files changed, %d insertions(+), %d deletions(-)" in singular form
    whenever applicable. "0 insertions" and "0 deletions" are also omitted
    unless they are both zero.
    
    This matches how versions of "diffstat" that are not prehistoric produced
    their output, and also makes this line translatable.
    
    [jc: with help from Thomas Dickey in archaeology of "diffstat"]
    [jc: squashed Jonathan's updates to illustrations in tutorials and a test]
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Dec 18, 2011
  1. @gitster

    pass struct commit to diff_tree_combined_merge()

    René Scharfe committed with gitster Dec 17, 2011
    Instead of passing the hash of a commit and then searching that
    same commit in the single caller, simply pass the commit directly.
    
    Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    use struct sha1_array in diff_tree_combined()

    René Scharfe committed with gitster Dec 17, 2011
    Maintaining an array of hashes is easier using sha1_array than
    open-coding it.  This patch also fixes a leak of the SHA1 array
    in  diff_tree_combined_merge().
    
    Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 10, 2011
  1. @gitster

    diff: add option to show whole functions as context

    René Scharfe committed with gitster Oct 9, 2011
    Add the option -W/--function-context to git diff.  It is similar to
    the same option of git grep and expands the context of change hunks
    so that the whole surrounding function is shown.  This "natural"
    context can allow changes to be understood better.
    
    Note: GNU patch doesn't like diffs generated with the new option;
    it seems to expect context lines to be the same before and after
    changes.  git apply doesn't complain.
    
    This implementation has the same shortcoming as the one in grep,
    namely that there is no way to explicitly find the end of a
    function.  That means that a few lines of extra context are shown,
    right up to the next recognized function begins.  It's already
    useful in its current form, though.
    
    The function get_func_line() in xdiff/xemit.c is extended to work
    forward as well as backward to find post-context as well as
    pre-context.  It returns the position of the first found matching
    line.  The func_line parameter is made optional, as we don't need
    it for -W.
    
    The enhanced function is then used in xdl_emit_diff() to extend
    the context as needed.  If the added context overlaps with the
    next change, it is merged into the current hunk.
    
    Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Aug 29, 2011
  1. @gitster

    Merge branch 'jk/color-and-pager'

    gitster committed Aug 28, 2011
    * jk/color-and-pager:
      want_color: automatically fallback to color.ui
      diff: don't load color config in plumbing
      config: refactor get_colorbool function
      color: delay auto-color decision until point of use
      git_config_colorbool: refactor stdout_is_tty handling
      diff: refactor COLOR_DIFF from a flag into an int
      setup_pager: set GIT_PAGER_IN_USE
      t7006: use test_config helpers
      test-lib: add helper functions for config
      t7006: modernize calls to unset
    
    Conflicts:
    	builtin/commit.c
    	parse-options.c
Commits on Aug 18, 2011
  1. @peff @gitster

    diff: refactor COLOR_DIFF from a flag into an int

    peff committed with gitster Aug 17, 2011
    This lets us store more than just a bit flag for whether we
    want color; we can also store whether we want automatic
    colors. This can be useful for making the automatic-color
    decision closer to the point of use.
    
    This mostly just involves replacing DIFF_OPT_* calls with
    manipulations of the flag. The biggest exception is that
    calls to DIFF_OPT_TST must check for "o->use_color > 0",
    which lets an "unknown" value (i.e., the default) stay at
    "no color". In the previous code, a value of "-1" was not
    propagated at all.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 30, 2011
  1. @gitster

    Merge branch 'mg/diff-stat-count'

    gitster committed Jun 29, 2011
    * mg/diff-stat-count:
      diff --stat-count: finishing touches
      diff-options.txt: describe --stat-{width,name-width,count}
      diff: introduce --stat-lines to limit the stat lines
      diff.c: omit hidden entries from namelen calculation with --stat
Commits on Jun 6, 2011
  1. @gitster

    Merge branch 'jk/diff-not-so-quick'

    gitster committed Jun 6, 2011
    * jk/diff-not-so-quick:
      diff: futureproof "stop feeding the backend early" logic
      diff_tree: disable QUICK optimization with diff filter
    
    Conflicts:
    	diff.c
Commits on May 31, 2011
  1. @gitster

    diff: futureproof "stop feeding the backend early" logic

    gitster committed May 31, 2011
    Refactor the "do not stop feeding the backend early" logic into a small
    helper function and use it in both run_diff_files() and diff_tree() that
    has the stop-early optimization. We may later add other types of diffcore
    transformation that require to look at the whole result like diff-filter
    does, and having the logic in a single place is essential for longer term
    maintainability.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 27, 2011
  1. @mjg @gitster

    diff: introduce --stat-lines to limit the stat lines

    mjg committed with gitster May 27, 2011
    Often one is interested in the full --stat output only for commits which
    change a few files, but not others, because larger restructuring gives a
    --stat which fills a few screens.
    
    Introduce a new option --stat-count=<count> which limits the --stat output
    to the first <count> lines, followed by a "..." line. It can
    also be given as the third parameter in
    --stat=<width>,<name-width>,<count>.
    
    Also, the unstuck form is supported analogous to the other two stat
    parameters.
    
    Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 13, 2011
  1. @gitster

    Merge branch 'jh/dirstat-lines'

    gitster committed May 13, 2011
    * jh/dirstat-lines:
      Mark dirstat error messages for translation
      Improve error handling when parsing dirstat parameters
      New --dirstat=lines mode, doing dirstat analysis based on diffstat
      Allow specifying --dirstat cut-off percentage as a floating point number
      Add config variable for specifying default --dirstat behavior
      Refactor --dirstat parsing; deprecate --cumulative and --dirstat-by-file
      Make --dirstat=0 output directories that contribute < 0.1% of changes
      Add several testcases for --dirstat and friends
Commits on May 6, 2011
  1. @gitster

    Merge branch 'jc/fix-diff-files-unmerged'

    gitster committed May 6, 2011
    * jc/fix-diff-files-unmerged:
      diff-files: show unmerged entries correctly
      diff: remove often unused parameters from diff_unmerge()
      diff.c: return filepair from diff_unmerge()
      test: use $_z40 from test-lib
Commits on Apr 29, 2011
  1. @jherland @gitster

    New --dirstat=lines mode, doing dirstat analysis based on diffstat

    jherland committed with gitster Apr 29, 2011
    This patch adds an alternative implementation of show_dirstat(), called
    show_dirstat_by_line(), which uses the more expensive diffstat analysis
    (as opposed to show_dirstat()'s own (relatively inexpensive) analysis)
    to derive the numbers from which the --dirstat output is computed.
    
    The alternative implementation is controlled by the new "lines" parameter
    to the --dirstat option (or the diff.dirstat config variable).
    
    For binary files, the diffstat analysis counts bytes instead of lines,
    so to prevent binary files from dominating the dirstat results, the
    byte counts for binary files are divided by 64 before being compared to
    their textual/line-based counterparts. This is a stupid and ugly - but
    very cheap - heuristic.
    
    In linux-2.6.git, running the three different --dirstat modes:
    
      time git diff v2.6.20..v2.6.30 --dirstat=changes > /dev/null
    vs.
      time git diff v2.6.20..v2.6.30 --dirstat=lines > /dev/null
    vs.
      time git diff v2.6.20..v2.6.30 --dirstat=files > /dev/null
    
    yields the following average runtimes on my machine:
    
     - "changes" (default): ~6.0 s
     - "lines":             ~9.6 s
     - "files":             ~0.1 s
    
    So, as expected, there's a considerable performance hit (~60%) by going
    through the full diffstat analysis as compared to the default "changes"
    analysis (obviously, "files" is much faster than both). As such, the
    "lines" mode is probably only useful if you really need the --dirstat
    numbers to be consistent with the numbers returned from the other
    --*stat options.
    
    The patch also includes documentation and tests for the new dirstat mode.
    
    Improved-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Johan Herland <johan@herland.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @jherland @gitster

    Allow specifying --dirstat cut-off percentage as a floating point number

    jherland committed with gitster Apr 29, 2011
    Only the first digit after the decimal point is kept, as the dirstat
    calculations all happen in permille.
    
    Selftests verifying floating-point percentage input has been added.
    
    Improved-by: Junio C Hamano <gitster@pobox.com>
    Improved-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Johan Herland <johan@herland.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 28, 2011
  1. @gitster

    Merge branch 'jc/diff-irreversible-delete'

    gitster committed Apr 28, 2011
    * jc/diff-irreversible-delete:
      git diff -D: omit the preimage of deletes
Commits on Apr 24, 2011
  1. @gitster

    diff: remove often unused parameters from diff_unmerge()

    gitster committed Apr 22, 2011
    e9c8409 (diff-index --cached --raw: show tree entry on the LHS for
    unmerged entries., 2007-01-05) added a <mode, object name> pair as
    parameters to this function, to store them in the pre-image side of an
    unmerged file pair.  Now the function is fixed to return the filepair it
    queued, we can make the caller on the special case codepath to do so.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. @gitster

    diff.c: return filepair from diff_unmerge()

    gitster committed Apr 22, 2011
    The underlying diff_queue() returns diff_filepair so that the caller can
    further add information to it, and the helper function diff_unmerge()
    utilizes the feature itself, but does not expose it to its callers, which
    was kind of selfish.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 3, 2011
  1. @gitster

    git diff -D: omit the preimage of deletes

    gitster committed Feb 28, 2011
    When reviewing a patch while concentrating primarily on the text after
    then change, wading through pages of deleted text involves a cognitive
    burden.
    
    Introduce the -D option that omits the preimage text from the patch output
    for deleted files.  When used with -B (represent total rewrite as a single
    wholesale deletion followed by a single wholesale addition), the preimage
    text is also omitted.
    
    To prevent such a patch from being applied by mistake, the output is
    designed not to be usable by "git apply" (or GNU "patch"); it is strictly
    for human consumption.
    
    It of course is possible to "apply" such a patch by hand, as a human can
    read the intention out of such a patch.  It however is impossible to apply
    such a patch even manually in reverse, as the whole point of this option
    is to omit the information necessary to do so from the output.
    
    Initial request by Mart Sõmermaa, documentation and tests helped by
    Michael J Gruber.
    
    Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 22, 2011
  1. @gitster

    diffcore-rename: fall back to -C when -C -C busts the rename limit

    gitster committed Jan 6, 2011
    When there are too many paths in the project, the number of rename source
    candidates "git diff -C -C" finds will exceed the rename detection limit,
    and no inexact rename detection is performed.  We however could fall back
    to "git diff -C" if the number of modified paths is sufficiently small.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 20, 2011
  1. @gitster

    Merge branch 'jk/merge-rename-ux'

    gitster committed Mar 19, 2011
    * jk/merge-rename-ux:
      pull: propagate --progress to merge
      merge: enable progress reporting for rename detection
      add inexact rename detection progress infrastructure
      commit: stop setting rename limit
      bump rename limit defaults (again)
      merge: improve inexact rename limit warning
Commits on Feb 21, 2011
  1. @peff @gitster

    add inexact rename detection progress infrastructure

    peff committed with gitster Feb 20, 2011
    We might spend many seconds doing inexact rename detection
    with no output.  It's nice to let the user know that
    something is actually happening.
    
    This patch adds the infrastructure, but no callers actually
    turn on progress reporting.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.