1. 20 12月, 2010 1 次提交
    • K
      fill_textconv(): Don't get/put cache if sha1 is not valid · 9ec09b04
      Kirill Smelkov 提交于
      When blaming files in the working tree, the filespec is marked with
      !sha1_valid, as we have not given the contents an object name yet.  The
      function to cache textconv results (keyed on the object name), however,
      didn't check this condition, and ended up on storing the cached result
      under a random object name.
      
      Cc: Axel Bonnet <axel.bonnet@ensimag.imag.fr>
      Cc: Clément Poulain <clement.poulain@ensimag.imag.fr>
      Cc: Diane Gasselin <diane.gasselin@ensimag.imag.fr>
      Cc: Jeff King <peff@peff.net>
      Signed-off-by: NKirill Smelkov <kirr@landau.phys.spbu.ru>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9ec09b04
  2. 11 12月, 2010 1 次提交
  3. 30 11月, 2010 1 次提交
  4. 25 10月, 2010 1 次提交
  5. 22 10月, 2010 2 次提交
  6. 17 10月, 2010 1 次提交
  7. 30 9月, 2010 3 次提交
  8. 24 9月, 2010 2 次提交
    • C
      do not search functions for patch ID · ad14b450
      Clemens Buchacher 提交于
      Visual aids, such as the function name in the hunk
      header, are not necessary for the purposes of
      computing a patch ID.
      
      This is a performance optimization.
      Signed-off-by: NClemens Buchacher <drizzd@aon.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ad14b450
    • J
      diff: don't use pathname-based diff drivers for symlinks · d391c0ff
      Jeff King 提交于
      When we're diffing symlinks, we consider the contents to be
      the pathname that the symlink points to. When a user sets up
      a userdiff driver like "*.pdf diff=pdf", their "diff.pdf.*"
      config generally tells us what to do with the content of
      pdf files.
      
      With the current code, we will actually process a symlink
      like "link.pdf" using a configured pdf driver, meaning we
      are using contents which consist of a pathname with
      configuration that is expecting contents that consist of an
      actual pdf file.
      
      The most noticeable example of this would have been
      textconv; however, it was already protected in its own
      textconv-specific code path. We can still see the breakage
      with something like "diff.*.binary", though. You could
      also see it with diff.*.funcname, though it is a bit harder
      to trigger accidentally there.
      
      This patch adds a check for S_ISREG lower in the callstack
      than the textconv-specific check, which should block use of
      any userdiff config for non-regular files. We can drop the
      check in the textconv code, which is now redundant.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d391c0ff
  9. 10 9月, 2010 1 次提交
  10. 01 9月, 2010 2 次提交
    • J
      git log/diff: add -G<regexp> that greps in the patch text · f506b8e8
      Junio C Hamano 提交于
      Teach "-G<regexp>" that is similar to "-S<regexp> --pickaxe-regexp" to the
      "git diff" family of commands.  This limits the diff queue to filepairs
      whose patch text actually has an added or a deleted line that matches the
      given regexp.  Unlike "-S<regexp>", changing other parts of the line that
      has a substring that matches the given regexp IS counted as a change, as
      such a change would appear as one deletion followed by one addition in a
      patch text.
      
      Unlike -S (pickaxe) that is intended to be used to quickly detect a commit
      that changes the number of occurrences of hits between the preimage and
      the postimage to serve as a part of larger toolchain, this is meant to be
      used as the top-level Porcelain feature.
      
      The implementation unfortunately has to run "diff" twice if you are
      running "log" family of commands to produce patches in the final output
      (e.g. "git log -p" or "git format-patch").  I think we _could_ cache the
      result in-core if we wanted to, but that would require larger surgery to
      the diffcore machinery (i.e. adding an extra pointer in the filepair
      structure to keep a pointer to a strbuf around, stuff the textual diff to
      the strbuf inside diffgrep_consume(), and make use of it in later stages
      when it is available) and it may not be worth it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f506b8e8
    • J
      diff: pass the entire diff-options to diffcore_pickaxe() · 382f013b
      Junio C Hamano 提交于
      That would make it easier to give enhanced feature to the
      pickaxe transformation.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      382f013b
  11. 17 8月, 2010 1 次提交
    • C
      hash binary sha1 into patch id · 34597c1f
      Clemens Buchacher 提交于
      Since commit 2f82f760 (Take binary diffs into
      account for "git rebase"), binary files are
      included in patch ID computation. Binary files are
      diffed using the text diff algorithm, however,
      which has a huge impact on performance. The
      following tests performance for a 50000 line file
      marked as binary in .gitattributes.
      
      $ git format-patch --stdout --ignore-if-in-upstream master
      
      real    0m0.367s
      user    0m0.354s
      sys     0m0.010s
      
      Instead of diffing the binary files, hash the pre-
      and post-image sha1, which is just as unique. As a
      result, performance is much improved.
      
      $ git format-patch --stdout --ignore-if-in-upstream master
      
      real    0m0.016s
      user    0m0.015s
      sys     0m0.001s
      Signed-off-by: NClemens Buchacher <drizzd@aon.at>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      34597c1f
  12. 14 8月, 2010 1 次提交
    • J
      diff --follow: do call diffcore_std() as necessary · 44c48a90
      Junio C Hamano 提交于
      Usually, diff frontends populate the output queue with filepairs without
      any rename information and call diffcore_std() to sort the renames out.
      When --follow is in effect, however, diff-tree family of frontend has a
      hack that looks like this:
      
          diff-tree frontend
          -> diff_tree_sha1()
             . populate diff_queued_diff
             . if --follow is in effect and there is only one change that
               creates the target path, then
             -> try_to_follow_renames()
      	  -> diff_tree_sha1() with no pathspec but with -C
      	  -> diffcore_std() to find renames
      	  . if rename is found, tweak diff_queued_diff and put a
      	    single filepair that records the found rename there
          -> diffcore_std()
             . tweak elements on diff_queued_diff by
             - rename detection
             - path ordering
             - pickaxe filtering
      
      We need to skip parts of the second call to diffcore_std() that is related
      to rename detection, and do so only when try_to_follow_renames() did find
      a rename.  Earlier 1da6175d (Make diffcore_std only can run once before a
      diff_flush, 2010-05-06) tried to deal with this issue incorrectly; it
      unconditionally disabled any second call to diffcore_std().
      
      This hopefully fixes the breakage.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      44c48a90
  13. 12 8月, 2010 1 次提交
    • J
      diff: strip extra "/" when stripping prefix · d8faea9d
      Jakub Narebski 提交于
      There are two ways a user might want to use "diff --relative":
      
        1. For a file in a directory, like "subdir/file", the user
           can use "--relative=subdir/" to strip the directory.
      
        2. To strip part of a filename, like "foo-10", they can
           use "--relative=foo-".
      
      We currently handle both of those situations. However, if the user passes
      "--relative=subdir" (without the trailing slash), we produce inconsistent
      results. For the unified diff format, we collapse the double-slash of
      "a//file" correctly into "a/file". But for other formats (raw, stat,
      name-status), we end up with "/file".
      
      We can do what the user means here and strip the extra "/" (and only a
      slash).  We are not hurting any existing users of (2) above with this
      behavior change because the existing output for this case was nonsensical.
      
      Patch by Jakub, tests and commit message by Jeff King.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d8faea9d
  14. 10 8月, 2010 2 次提交
    • J
      Add the 'diff.ignoreSubmodules' config setting · be4f2b40
      Johannes Schindelin 提交于
      When you have a lot of submodules checked out, the time penalty to check
      for dirty submodules can easily imply a multiplication of the total time
      by the factor 20. This makes the difference between almost instantaneous
      (< 2 seconds) and unbearably slow (> 50 seconds) here, since the disk
      caches are constantly overloaded.
      
      To this end, the submodule.*.ignore config option was introduced, but it
      is per-submodule.
      
      This commit introduces a global config setting to set a default
      (porcelain) value for the --ignore-submodules option, keeping the
      default at 'none'. It can be overridden by the submodule.*.ignore
      setting and by the --ignore-submodules option.
      
      Incidentally, this commit fixes an issue with the overriding logic:
      multiple --ignore-submodules options would not clear the previously
      set flags.
      
      While at it, fix a typo in the documentation for submodule.*.ignore.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      be4f2b40
    • J
      Submodules: Add the new "ignore" config option for diff and status · aee9c7d6
      Jens Lehmann 提交于
      The new "ignore" config option controls the default behavior for "git
      status" and the diff family. It specifies under what circumstances they
      consider submodules as modified and can be set separately for each
      submodule.
      
      The command line option "--ignore-submodules=" has been extended to accept
      the new parameter "none" for both status and diff.
      
      Users that chose submodules to get rid of long work tree scanning times
      might want to set the "dirty" option for those submodules. This brings
      back the pre 1.7.0 behavior, where submodule work trees were never
      scanned for modifications. By using "--ignore-submodules=none" on the
      command line the status and diff commands can be told to do a full scan.
      
      This option can be set to the following values (which have the same name
      and meaning as for the "--ignore-submodules" option of status and diff):
      
      "all": All changes to the submodule will be ignored.
      
      "dirty": Only differences of the commit recorded in the superproject and
      	the submodules HEAD will be considered modifications, all changes
      	to the work tree of the submodule will be ignored. When using this
      	value, the submodule will not be scanned for work tree changes at
      	all, leading to a performance benefit on large submodules.
      
      "untracked": Only untracked files in the submodules work tree are ignored,
      	a changed HEAD and/or modified files in the submodule will mark it
      	as modified.
      
      "none" (which is the default): Either untracked or modified files in a
      	submodules work tree or a difference between the subdmodules HEAD
      	and the commit recorded in the superproject will make it show up
      	as changed. This value is added as a new parameter for the
      	"--ignore-submodules" option of the diff family and "git status"
      	so the user can override the settings in the configuration.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      aee9c7d6
  15. 07 8月, 2010 3 次提交
  16. 02 8月, 2010 1 次提交
  17. 09 7月, 2010 1 次提交
    • B
      diff.c: fix a graph output bug · e13f38a3
      Bo Yang 提交于
      When --graph is in effect, the line-prefix typically has colored graph
      line segments and ends with reset.  The color sequence "set" given to
      this function is for showing the metainfo part of the patch text and
      (1) it should not be applied to the graph lines, and (2) it will be
      reset at the end of line_prefix so it won't be in effect anyway.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e13f38a3
  18. 26 6月, 2010 1 次提交
    • J
      Add the option "--ignore-submodules" to "git status" · 46a958b3
      Jens Lehmann 提交于
      In some use cases it is not desirable that "git status" considers
      submodules that only contain untracked content as dirty. This may happen
      e.g. when the submodule is not under the developers control and not all
      build generated files have been added to .gitignore by the upstream
      developers. Using the "untracked" parameter for the "--ignore-submodules"
      option disables checking for untracked content and lets git diff report
      them as changed only when they have new commits or modified content.
      
      Sometimes it is not wanted to have submodules show up as changed when they
      just contain changes to their work tree (this was the behavior before
      1.7.0). An example for that are scripts which just want to check for
      submodule commits while ignoring any changes to the work tree. Also users
      having large submodules known not to change might want to use this option,
      as the - sometimes substantial - time it takes to scan the submodule work
      tree(s) is saved when using the "dirty" parameter.
      
      And if you want to ignore any changes to submodules, you can now do that
      by using this option without parameters or with "all" (when the config
      option status.submodulesummary is set, using "all" will also suppress the
      output of the submodule summary).
      
      A new function handle_ignore_submodules_arg() is introduced to parse this
      option new to "git status" in a single location, as "git diff" already
      knew it.
      Signed-off-by: NJens Lehmann <Jens.Lehmann@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      46a958b3
  19. 12 6月, 2010 2 次提交
  20. 07 6月, 2010 1 次提交
  21. 01 6月, 2010 5 次提交
    • B
      Make --color-words work well with --graph · 4297c0ae
      Bo Yang 提交于
      '--color-words' algorithm can be described as:
      
        1. collect a the minus/plus lines of a diff hunk, divided into
           minus-lines and plus-lines;
      
        2. break both minus-lines and plus-lines into words and
           place them into two mmfile_t with one word for each line;
      
        3. use xdiff to run diff on the two mmfile_t to get the words level diff;
      
      And for the common parts of the both file, we output the plus side text.
      diff_words->current_plus is used to trace the current position of the plus file
      which printed. diff_words->last_minus is used to trace the last minus word
      printed.
      
      For '--graph' to work with '--color-words', we need to output the graph prefix
      on each line of color words output. Generally, there are two conditions on
      which we should output the prefix.
      
        1. diff_words->last_minus == 0 &&
           diff_words->current_plus == diff_words->plus.text.ptr
      
           that is: the plus text must start as a new line, and if there is no minus
           word printed, a graph prefix must be printed.
      
        2. diff_words->current_plus > diff_words->plus.text.ptr &&
           *(diff_words->current_plus - 1) == '\n'
      
           that is: a graph prefix must be printed following a '\n'
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4297c0ae
    • B
      Emit a whole line in one go · 2efcc977
      Bo Yang 提交于
      Since the graph prefix will be printed when calling
      emit_line, so the functions should be used to emit a
      complete line out once a time. No one should call
      emit_line to just output some strings instead of a
      complete line.
      Use a strbuf to compose the whole line, and then
      call emit_line to output it once.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2efcc977
    • B
      diff.c: Output the text graph padding before each diff line · 7be57610
      Bo Yang 提交于
      Change output from diff with -p/--dirstat/--binary/--numstat/--stat/
      --shortstat/--check/--summary options to align with graph paddings.
      
      Thanks Jeff King <peff@peff.net> for reporting the '--summary' bug and
      his initial patch.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7be57610
    • B
      Add a prefix output callback to diff output · a3c158d4
      Bo Yang 提交于
      The callback can be used to add some prefix string to each line of
      diff output.
      Signed-off-by: NBo Yang <struggleyb.nku@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a3c158d4
    • J
      diff.c: Ensure "index $from..$to" line contains unambiguous SHA1s · 3e5a188f
      Johan Herland 提交于
      In the metainfo section of git diffs there's an "index" line providing
      abbreviated (unless --full-index is used) blob SHA1s from the
      pre-/post-images used to generate the diff. These provide hints that
      can be used to reconstruct a 3-way merge when applying the patch
      (see the --3way option to 'git am' for more details).
      
      In order for this to work, however, the blob SHA1s must not be
      abbreviated into ambiguity.
      
      This patch eliminates the possible ambiguity by using find_unique_abbrev()
      to produce the abbreviated SHA1s (instead of blind abbreviation by way of
      "%.*s").
      
      A testcase verifying the fix is also included.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3e5a188f
  22. 20 5月, 2010 1 次提交
    • B
      diff: fix coloring of extended diff headers · 37466447
      Bert Wesarg 提交于
      Coloring the extended headers where done as a whole not per line. less with
      option -R (which is the default from git) does not support this coloring
      mode because of performance reasons. The -r option would be an alternative
      but has problems with lines that are longer than the screen. Therefore
      stick to the idiom to color each line separately. The problem is, that the
      result of ill_metainfo() will also be used as an parameter to an external
      diff driver, so we need to disable coloring in this case.
      
      Because coloring is now done inside fill_metainfo() we can simply add this
      string to the diff header and therefore keep the last newline in the
      extended header. This results also into the fact that the external diff
      driver now gets this last newline too. Which is a change in behavior
      but a good one.
      Signed-off-by: NBert Wesarg <bert.wesarg@googlemail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      37466447
  23. 19 5月, 2010 2 次提交
  24. 08 5月, 2010 2 次提交
  25. 05 5月, 2010 1 次提交