1. 21 11月, 2013 1 次提交
  2. 01 11月, 2013 1 次提交
  3. 16 7月, 2013 3 次提交
  4. 29 5月, 2013 4 次提交
  5. 02 11月, 2012 1 次提交
    • K
      update-index/diff-index: use core.preloadindex to improve performance · 7349afd2
      Karsten Blees 提交于
      'update-index --refresh' and 'diff-index' (without --cached) don't honor
      the core.preloadindex setting yet. Porcelain commands using these (such as
      git [svn] rebase) suffer from this, especially on Windows.
      
      Use read_cache_preload to improve performance.
      
      Additionally, in builtin/diff.c, don't preload index status if we don't
      access the working copy (--cached).
      
      Results with msysgit on WebKit repo (2GB in 200k files):
      
                      | update-index | diff-index | rebase
      ----------------+--------------+------------+---------
      msysgit-v1.8.0  |       9.157s |    10.536s | 42.791s
      + preloadindex  |       9.157s |    10.536s | 28.725s
      + this patch    |       2.329s |     2.752s | 15.152s
      + fscache [1]   |       0.731s |     1.171s |  8.877s
      
      [1] https://github.com/kblees/git/tree/kb/fscache-v3
      
      Thanks-to: Albert Krawczyk <pro-logic@optusnet.com.au>
      Signed-off-by: NKarsten Blees <blees@dcon.de>
      Signed-off-by: NJeff King <peff@peff.net>
      7349afd2
  6. 29 10月, 2012 1 次提交
  7. 04 8月, 2012 1 次提交
    • T
      diff_setup_done(): return void · 28452655
      Thomas Rast 提交于
      diff_setup_done() has historically returned an error code, but lost
      the last nonzero return in 943d5b73 (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: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      28452655
  8. 30 7月, 2012 1 次提交
    • J
      diff: do not use null sha1 as a sentinel value · e5450100
      Jeff King 提交于
      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: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e5450100
  9. 16 6月, 2012 1 次提交
    • J
      fix pager.diff with diff --no-index · 1af3d977
      Jeff King 提交于
      git-diff does not rely on the git wrapper to setup its
      pager; instead, it sets it up on its own after seeing
      whether --quiet or --exit-code has been specified.  After
      diff_no_index was split off from cmd_diff, commit b3fde6cc
      (git diff --no-index: default to page like other diff
      frontends, 2008-05-26) duplicated the one-liner from
      cmd_diff to turn on the pager.
      
      Later, commit 8f0359f0 (Allow pager of diff command be
      enabled/disabled, 2008-07-21) taught the the version in
      cmd_diff to respect the pager.diff config, but the version
      in diff_no_index was left behind. This meant that
      
        git -c pager.diff=0 diff a b
      
      would not use a pager, but
      
        git -c pager.diff=0 diff --no-index a b
      
      would.  Let's fix it by factoring out a common function.
      
      While we're there, let's update the antiquated comment,
      which claims that the pager interferes with propagating the
      exit code; this has not been the case since ea27a18c (spawn
      pager via run_command interface, 2008-07-22).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1af3d977
  10. 24 3月, 2012 1 次提交
  11. 02 3月, 2012 2 次提交
    • Z
      diff --stat: add config option to limit graph width · df44483a
      Zbigniew Jędrzejewski-Szmek 提交于
      Config option diff.statGraphWidth=<width> is equivalent to
      --stat-graph-width=<width>, except that the config option is ignored
      by format-patch.
      
      For the graph-width limiting to be usable, it should happen
      'automatically' once configured, hence the config option.
      Nevertheless, graph width limiting only makes sense when used on a
      wide terminal, so it should not influence the output of format-patch,
      which adheres to the 80-column standard.
      Signed-off-by: NZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      df44483a
    • Z
      diff --stat: use the full terminal width · af9fedc1
      Zbigniew Jędrzejewski-Szmek 提交于
      Default to the real terminal width for diff --stat output, instead
      of the hard-coded 80 columns.
      
      Some projects (especially in Java), have long filename paths, with
      nested directories or long individual filenames. When files are
      renamed, the filename part in stat output can be almost useless. If
      the middle part between { and } is long (because the file was moved to
      a completely different directory), then most of the path would be
      truncated.
      
      It makes sense to detect and use the full terminal width and display
      full filenames if possible.
      
      The are commands like diff, show, and log, which can adapt the output
      to the terminal width. There are also commands like format-patch,
      whose output should be independent of the terminal width. Since it is
      safer to use the 80-column default, the real terminal width is only
      used if requested by the calling code by setting diffopts.stat_width=-1.
      Normally this value is 0, and can be set by the user only to a
      non-negative value, so -1 is safe to use internally.
      
      This patch only changes the diff builtin to use the full terminal width.
      Signed-off-by: NZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      af9fedc1
  12. 18 12月, 2011 1 次提交
  13. 07 11月, 2011 1 次提交
    • Æ
      cast variable in call to free() in builtin/diff.c and submodule.c · 83838d5c
      Ævar Arnfjörð Bjarmason 提交于
      Both of these free() calls are freeing a "const unsigned char (*)[20]"
      type while free() expects a "void *". This results in the following
      warning under clang 2.9:
      
          builtin/diff.c:185:7: warning: passing 'const unsigned char (*)[20]' to parameter of type 'void *' discards qualifiers
                  free(parent);
                       ^~~~~~
      
          submodule.c:394:7: warning: passing 'const unsigned char (*)[20]' to parameter of type 'void *' discards qualifiers
                  free(parents);
                       ^~~~~~~
      
      This free()-ing without a cast was added by Jim Meyering to
      builtin/diff.c in v1.7.6-rc3~4 and later by Fredrik Gustafsson in
      submodule.c in v1.7.7-rc1~25^2.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      83838d5c
  14. 20 8月, 2011 1 次提交
    • J
      want_color: automatically fallback to color.ui · c9bfb953
      Jeff King 提交于
      All of the "do we want color" flags default to -1 to
      indicate that we don't have any color configured. This value
      is handled in one of two ways:
      
        1. In porcelain, we check early on whether the value is
           still -1 after reading the config, and set it to the
           value of color.ui (which defaults to 0).
      
        2. In plumbing, it stays untouched as -1, and want_color
           defaults it to off.
      
      This works fine, but means that every porcelain has to check
      and reassign its color flag. Now that want_color gives us a
      place to put this check in a single spot, we can do that,
      simplifying the calling code.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c9bfb953
  15. 21 6月, 2011 1 次提交
  16. 23 3月, 2011 1 次提交
  17. 22 3月, 2011 1 次提交
  18. 10 3月, 2011 1 次提交
  19. 08 2月, 2011 1 次提交
  20. 04 2月, 2011 2 次提交
  21. 06 11月, 2010 1 次提交
  22. 10 8月, 2010 1 次提交
  23. 23 2月, 2010 1 次提交
    • L
      Move 'builtin-*' into a 'builtin/' subdirectory · 81b50f3c
      Linus Torvalds 提交于
      This shrinks the top-level directory a bit, and makes it much more
      pleasant to use auto-completion on the thing. Instead of
      
      	[torvalds@nehalem git]$ em buil<tab>
      	Display all 180 possibilities? (y or n)
      	[torvalds@nehalem git]$ em builtin-sh
      	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
      	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
      	[torvalds@nehalem git]$ em builtin-shor<tab>
      	builtin-shortlog.c  builtin-shortlog.o
      	[torvalds@nehalem git]$ em builtin-shortlog.c
      
      you get
      
      	[torvalds@nehalem git]$ em buil<tab>		[type]
      	builtin/   builtin.h
      	[torvalds@nehalem git]$ em builtin		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
      	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
      	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
      	shortlog.c  shortlog.o
      	[torvalds@nehalem git]$ em builtin/shortlog.c
      
      which doesn't seem all that different, but not having that annoying
      break in "Display all 180 possibilities?" is quite a relief.
      
      NOTE! If you do this in a clean tree (no object files etc), or using an
      editor that has auto-completion rules that ignores '*.o' files, you
      won't see that annoying 'Display all 180 possibilities?' message - it
      will just show the choices instead.  I think bash has some cut-off
      around 100 choices or something.
      
      So the reason I see this is that I'm using an odd editory, and thus
      don't have the rules to cut down on auto-completion.  But you can
      simulate that by using 'ls' instead, or something similar.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81b50f3c
  24. 08 8月, 2009 1 次提交
  25. 28 6月, 2009 1 次提交
  26. 08 12月, 2008 2 次提交
    • J
      reorder ALLOW_TEXTCONV option setting · 5ec11af6
      Jeff King 提交于
      Right now for the diff porcelain and the log family, we
      call:
      
        init_revisions();
        setup_revisions();
        DIFF_OPT_SET(ALLOW_TEXTCONV);
      
      However, that means textconv will _always_ be on, instead of
      being a default that can be manipulated with
      setup_revisions. Instead, we want:
      
        init_revisions();
        DIFF_OPT_SET(ALLOW_TEXTCONV);
        setup_revisions();
      
      which is what this patch does.
      
      We'll go ahead and move the callsite in wt-status, also;
      even though the user can't pass any options here, it is a
      cleanup that will help avoid any surprise later if the
      setup_revisions line is changed.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ec11af6
    • M
      "git diff <tree>{3,}": do not reverse order of arguments · dbc2fb6b
      Matt McCutchen 提交于
      According to the message of commit 0fe7c1de,
      "git diff" with three or more trees expects the merged tree first followed by
      the parents, in order.  However, this command reversed the order of its
      arguments, resulting in confusing diffs.  A comment /* Again, the revs are all
      reverse */ suggested there was a reason for this, but I can't figure out the
      reason, so I removed the reversal of the arguments.  Test case included.
      Signed-off-by: NMatt McCutchen <matt@mattmccutchen.net>
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      dbc2fb6b
  27. 27 11月, 2008 1 次提交
    • J
      Teach "git diff" to honour --[no-]ext-diff · 61af494c
      Junio C Hamano 提交于
      The original intention of 72909bef (Add diff-option --ext-diff, 2007-06-30)
      was to optionally allow the use of external diff viewer in "git log"
      family (while keeping them disabled by default).  It exposed the "allow
      external diff" bit to the UI, but forgot to adjust the "git diff" codepath
      that was set up to always allow use of the external diff viewer.
      
      Noticed by Nazri Ramliy; tests by René Scharfe squashed in.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      61af494c
  28. 15 11月, 2008 1 次提交
    • L
      Add cache preload facility · 671c9b7e
      Linus Torvalds 提交于
      This can do the lstat() storm in parallel, giving potentially much
      improved performance for cold-cache cases or things like NFS that have
      weak metadata caching.
      
      Just use "read_cache_preload()" instead of "read_cache()" to force an
      optimistic preload of the index stat data.  The function takes a
      pathspec as its argument, allowing us to preload only the relevant
      portion of the index.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      671c9b7e
  29. 12 11月, 2008 1 次提交
  30. 27 10月, 2008 1 次提交
    • J
      userdiff: require explicitly allowing textconv · c7534ef4
      Jeff King 提交于
      Diffs that have been produced with textconv almost certainly
      cannot be applied, so we want to be careful not to generate
      them in things like format-patch.
      
      This introduces a new diff options, ALLOW_TEXTCONV, which
      controls this behavior. It is off by default, but is
      explicitly turned on for the "log" family of commands, as
      well as the "diff" porcelain (but not diff-* plumbing).
      
      Because both text conversion and external diffing are
      controlled by these diff options, we can get rid of the
      "plumbing versus porcelain" distinction when reading the
      config. This was an attempt to control the same thing, but
      suffered from being too coarse-grained.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c7534ef4
  31. 13 10月, 2008 1 次提交
  32. 19 9月, 2008 1 次提交
    • J
      diff/diff-files: do not use --cc too aggressively · 903e09a3
      Junio C Hamano 提交于
      Textual diff output for unmerged paths was too eager to give condensed
      combined diff.  Even though "diff -c" (and "diff-files -c -p") is a
      request to view combined diff without condensing (otherwise the user would
      have explicitly asked for --cc, not -c), we showed "--cc" output anyway.
      
      0fe7c1de (built-in diff: assorted updates, 2006-04-29) claimed to be
      careful about doing this, but its breakage was hidden because back then
      "git diff" was still a shell script that did not use the codepath it
      introduced fully.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      903e09a3