1. 26 4月, 2006 1 次提交
  2. 22 4月, 2006 1 次提交
    • J
      Libify diff-files. · 6973dcae
      Junio C Hamano 提交于
      This is the first installment to libify diff brothers.
      
      The updated diff-files uses revision.c::setup_revisions()
      infrastructure to parse its command line arguments, which means
      the pathname arguments are checked more strictly than before.
      The tests are adjusted to separate possibly missing paths from
      the rest of arguments with double-dashes, to show the kosher
      way.
      
      As Linus pointed out, renaming diff.c to diff-lib.c was simply
      stupid, so I am renaming it back.  The new diff-lib.c is to
      contain pieces extracted from diff brothers.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      6973dcae
  3. 20 4月, 2006 2 次提交
  4. 19 4月, 2006 3 次提交
  5. 16 4月, 2006 3 次提交
  6. 14 4月, 2006 3 次提交
  7. 12 4月, 2006 1 次提交
  8. 11 4月, 2006 2 次提交
  9. 09 4月, 2006 1 次提交
  10. 05 4月, 2006 2 次提交
    • J
      diff_flush(): leakfix. · 7d6c4471
      Junio C Hamano 提交于
      We were leaking filepairs when output-format was set to
      NO_OUTPUT.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      7d6c4471
    • P
      Support for pickaxe matching regular expressions · d01d8c67
      Petr Baudis 提交于
      git-diff-* --pickaxe-regex will change the -S pickaxe to match
      POSIX extended regular expressions instead of fixed strings.
      
      The regex.h library is a rather stupid interface and I like pcre too, but
      with any luck it will be everywhere we will want to run Git on, it being
      POSIX.2 and all. I'm not sure if we can expect platforms like AIX to
      conform to POSIX.2 or if win32 has regex.h. We might add a flag to
      Makefile if there is a portability trouble potential.
      Signed-off-by: NPetr Baudis <pasky@suse.cz>
      d01d8c67
  11. 30 3月, 2006 1 次提交
    • J
      tree/diff header cleanup. · 1b0c7174
      Junio C Hamano 提交于
      Introduce tree-walk.[ch] and move "struct tree_desc" and
      associated functions from various places.
      
      Rename DIFF_FILE_CANON_MODE(mode) macro to canon_mode(mode) and
      move it to cache.h.  This macro returns the canonicalized
      st_mode value in the host byte order for files, symlinks and
      directories -- to be compared with a tree_desc entry.
      create_ce_mode(mode) in cache.h is similar but is intended to be
      used for index entries (so it does not work for directories) and
      returns the value in the network byte order.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1b0c7174
  12. 28 3月, 2006 1 次提交
    • M
      xdiff: Show function names in hunk headers. · acb72577
      Mark Wooding 提交于
      The speed of the built-in diff generator is nice; but the function names
      shown by `diff -p' are /really/ nice.  And I hate having to choose.  So,
      we hack xdiff to find the function names and print them.
      
      xdiff has grown a flag to say whether to dig up the function names.  The
      builtin_diff function passes this flag unconditionally.  I suppose it
      could parse GIT_DIFF_OPTS, but it doesn't at the moment.  I've also
      reintroduced the `function name' into the test suite, from which it was
      removed in commit 3ce8f089.
      
      The function names are parsed by a particularly stupid algorithm at the
      moment: it just tries to find a line in the `old' file, from before the
      start of the hunk, whose first character looks plausible.  Still, it's
      most definitely a start.
      Signed-off-by: NMark Wooding <mdw@distorted.org.uk>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      acb72577
  13. 26 3月, 2006 3 次提交
    • J
      true built-in diff: run everything in-core. · cebff98d
      Junio C Hamano 提交于
      This stops using temporary files when we are using the built-in
      diff (including the complete rewrite).
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      cebff98d
    • J
      built-in diff: minimum tweaks · 3ce8f089
      Junio C Hamano 提交于
      This fixes up a couple of minor issues with the real built-in
      diff to be more usable:
      
       - Omit ---/+++ header unless we emit diff output;
      
       - Detect and punt binary diff like GNU does;
      
       - Honor GIT_DIFF_OPTS minimally (only -u<number> and
         --unified=<number> are currently supported);
      
       - Omit line count of 1 from "@@ -l,k +m,n @@" hunk header
         (i.e. when k == 1 or n == 1)
      
       - Adjust testsuite for the lack of -p support.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      3ce8f089
    • L
      Use a *real* built-in diff generator · 3443546f
      Linus Torvalds 提交于
      This uses a simplified libxdiff setup to generate unified diffs _without_
      doing  fork/execve of GNU "diff".
      
      This has several huge advantages, for example:
      
      Before:
      
      	[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
      
      	real    0m24.818s
      	user    0m13.332s
      	sys     0m8.664s
      
      After:
      
      	[torvalds@g5 linux]$ time git diff v2.6.16.. > /dev/null
      
      	real    0m4.563s
      	user    0m2.944s
      	sys     0m1.580s
      
      and the fact that this should be a lot more portable (ie we can ignore all
      the issues with doing fork/execve under Windows).
      
      Perhaps even more importantly, this allows us to do diffs without actually
      ever writing out the git file contents to a temporary file (and without
      any of the shell quoting issues on filenames etc etc).
      
      NOTE! THIS PATCH DOES NOT DO THAT OPTIMIZATION YET! I was lazy, and the
      current "diff-core" code actually will always write the temp-files,
      because it used to be something that you simply had to do. So this current
      one actually writes a temp-file like before, and then reads it into memory
      again just to do the diff. Stupid.
      
      But if this basic infrastructure is accepted, we can start switching over
      diff-core to not write temp-files, which should speed things up even
      further, especially when doing big tree-to-tree diffs.
      
      Now, in the interest of full disclosure, I should also point out a few
      downsides:
      
       - the libxdiff algorithm is different, and I bet GNU diff has gotten a
         lot more testing. And the thing is, generating a diff is not an exact
         science - you can get two different diffs (and you will), and they can
         both be perfectly valid. So it's not possible to "validate" the
         libxdiff output by just comparing it against GNU diff.
      
       - GNU diff does some nice eye-candy, like trying to figure out what the
         last function was, and adding that information to the "@@ .." line.
         libxdiff doesn't do that.
      
       - The libxdiff thing has some known deficiencies. In particular, it gets
         the "\No newline at end of file" case wrong. So this is currently for
         the experimental branch only. I hope Davide will help fix it.
      
      That said, I think the huge performance advantage, and the fact that it
      integrates better is definitely worth it. But it should go into a
      development branch at least due to the missing newline issue.
      
      Technical note: this is based on libxdiff-0.17, but I did some surgery to
      get rid of the extraneous fat - stuff that git doesn't need, and seriously
      cutting down on mmfile_t, which had much more capabilities than the diff
      algorithm either needed or used. In this version, "mmfile_t" is just a
      trivial <pointer,length> tuple.
      
      That said, I tried to keep the differences to simple removals, so that you
      can do a diff between this and the libxdiff origin, and you'll basically
      see just things getting deleted. Even the mmfile_t simplifications are
      left in a state where the diffs should be readable.
      
      Apologies to Davide, whom I'd love to get feedback on this all from (I
      wrote my own "fill_mmfile()" for the new simpler mmfile_t format: the old
      complex format had a helper function for that, but I did my surgery with
      the goal in mind that eventually we _should_ just do
      
      	mmfile_t mf;
      
      	buf = read_sha1_file(sha1, type, &size);
      	mf->ptr = buf;
      	mf->size = size;
      	.. use "mf" directly ..
      
      which was really a nightmare with the old "helpful" mmfile_t, and really
      is that easy with the new cut-down interfaces).
      
      [ Btw, as any hawk-eye can see from the diff, this was actually generated
        with itself, so it is "self-hosting". That's about all the testing it
        has gotten, along with the above kernel diff, which eye-balls correctly,
        but shows the newline issue when you double-check it with "git-apply" ]
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      3443546f
  14. 12 3月, 2006 1 次提交
  15. 27 2月, 2006 1 次提交
  16. 10 2月, 2006 1 次提交
  17. 09 2月, 2006 1 次提交
    • J
      "Assume unchanged" git · 5f73076c
      Junio C Hamano 提交于
      This adds "assume unchanged" logic, started by this message in the list
      discussion recently:
      
      	<Pine.LNX.4.64.0601311807470.7301@g5.osdl.org>
      
      This is a workaround for filesystems that do not have lstat()
      that is quick enough for the index mechanism to take advantage
      of.  On the paths marked as "assumed to be unchanged", the user
      needs to explicitly use update-index to register the object name
      to be in the next commit.
      
      You can use two new options to update-index to set and reset the
      CE_VALID bit:
      
      	git-update-index --assume-unchanged path...
      	git-update-index --no-assume-unchanged path...
      
      These forms manipulate only the CE_VALID bit; it does not change
      the object name recorded in the index file.  Nor they add a new
      entry to the index.
      
      When the configuration variable "core.ignorestat = true" is set,
      the index entries are marked with CE_VALID bit automatically
      after:
      
       - update-index to explicitly register the current object name to the
         index file.
      
       - when update-index --refresh finds the path to be up-to-date.
      
       - when tools like read-tree -u and apply --index update the working
         tree file and register the current object name to the index file.
      
      The flag is dropped upon read-tree that does not check out the index
      entry.  This happens regardless of the core.ignorestat settings.
      
      Index entries marked with CE_VALID bit are assumed to be
      unchanged most of the time.  However, there are cases that
      CE_VALID bit is ignored for the sake of safety and usability:
      
       - while "git-read-tree -m" or git-apply need to make sure
         that the paths involved in the merge do not have local
         modifications.  This sacrifices performance for safety.
      
       - when git-checkout-index -f -q -u -a tries to see if it needs
         to checkout the paths.  Otherwise you can never check
         anything out ;-).
      
       - when git-update-index --really-refresh (a new flag) tries to
         see if the index entry is up to date.  You can start with
         everything marked as CE_VALID and run this once to drop
         CE_VALID bit for paths that are modified.
      
      Most notably, "update-index --refresh" honours CE_VALID and does
      not actively stat, so after you modified a file in the working
      tree, update-index --refresh would not notice until you tell the
      index about it with "git-update-index path" or "git-update-index
      --no-assume-unchanged path".
      
      This version is not expected to be perfect.  I think diff
      between index and/or tree and working files may need some
      adjustment, and there probably needs other cases we should
      automatically unmark paths that are marked to be CE_VALID.
      
      But the basics seem to work, and ready to be tested by people
      who asked for this feature.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5f73076c
  18. 02 2月, 2006 1 次提交
    • P
      Allow diff and index commands to be interrupted · 6a1f79c1
      Petr Baudis 提交于
      So far, e.g. git-update-index --refresh was basically uninterruptable
      by ctrl-c, since it hooked the SIGINT handler, but that handler would
      only unlink the lockfile but not actually quit. This makes it propagate
      the signal to the default handler.
      
      Note that I expected it to work without resetting the signal handler to
      SIG_DFL, but without that it ended in an infinite loop of tgkill()s -
      is my glibc violating SUS or what?
      Signed-off-by: NPetr Baudis <pasky@suse.cz>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      6a1f79c1
  19. 28 1月, 2006 2 次提交
  20. 29 12月, 2005 1 次提交
  21. 27 12月, 2005 2 次提交
  22. 20 12月, 2005 1 次提交
    • J
      diff: --abbrev option · 47dd0d59
      Junio C Hamano 提交于
      When I show transcripts to explain how something works, I often
      find myself hand-editing the diff-raw output to shorten various
      object names in the output.
      
      This adds --abbrev option to the diff family, which shortens
      diff-raw output and diff-tree commit id headers.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      47dd0d59
  23. 22 11月, 2005 3 次提交
    • J
      Move diff.renamelimit out of default configuration. · 9ce392f4
      Junio C Hamano 提交于
      Otherwise we would end up linking all the unneeded stuff into git-daemon
      only to link with git_default_config.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9ce392f4
    • H
      rename/copy score parsing updates. · 1b1480ff
      H. Peter Anvin 提交于
      Better variant, which handles stuff like "4.5%" and rejects
      "192.168.0.1".  Additionally, make sure numbers are unsigned (I'm making
      them unsigned long just for the hell of it), to make sure that
      artificial wraparound scenarios don't cause harm.
      
      	-hpa
      
      [jc: with this, -M100 changes its meaning back to 10%.  People
      wanting to say "pure renames only" should now say -M100% or
      -M1.0; sounds a bit like an earthquake, but arguably things are
      more consistent this way ;-)]
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1b1480ff
    • J
      rename detection with -M100 means "exact renames only". · 9f70b806
      Junio C Hamano 提交于
      When the user is interested in pure renames, there is no point
      doing the similarity scores.  This changes the score argument
      parsing to special case -M100 (otherwise, it is a precision
      scaled value 0 <= v < 1 and would mean 0.1, not 1.0 --- if you
      do mean 0.1, you can say -M1), and optimizes the diffcore_rename
      transformation to only look at pure renames in that case.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9f70b806
  24. 17 11月, 2005 2 次提交