1. 03 3月, 2007 1 次提交
    • J
      Add core.symlinks to mark filesystems that do not support symbolic links. · 78a8d641
      Johannes Sixt 提交于
      Some file systems that can host git repositories and their working copies
      do not support symbolic links. But then if the repository contains a symbolic
      link, it is impossible to check out the working copy.
      
      This patch enables partial support of symbolic links so that it is possible
      to check out a working copy on such a file system.  A new flag
      core.symlinks (which is true by default) can be set to false to indicate
      that the filesystem does not support symbolic links. In this case, symbolic
      links that exist in the trees are checked out as small plain files, and
      checking in modifications of these files preserve the symlink property in
      the database (as long as an entry exists in the index).
      
      Of course, this does not magically make symbolic links work on such defective
      file systems; hence, this solution does not help if the working copy relies
      on that an entry is a real symbolic link.
      Signed-off-by: NJohannes Sixt <johannes.sixt@telecom.at>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      78a8d641
  2. 26 2月, 2007 3 次提交
  3. 23 2月, 2007 1 次提交
    • J
      Teach git-diff-files the new option `--no-index` · d516c2d1
      Johannes Schindelin 提交于
      With this flag and given two paths, git-diff-files behaves as a GNU diff
      lookalike (plus the git goodies like --check, colour, etc.).  This flag
      is also available in git-diff.  It also works outside of a git repository.
      
      In addition, if git-diff{,-files} is called without revision or stage
      parameter, and with exactly two paths at least one of which is not tracked,
      the default is --no-index.
      
      So, you can now say
      
      	git diff /etc/inittab /etc/fstab
      
      and it actually works!
      
      This also unifies the duplicated argument parsing between cmd_diff_files()
      and builtin_diff_files().
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      d516c2d1
  4. 22 2月, 2007 1 次提交
  5. 17 2月, 2007 1 次提交
    • J
      Do not take mode bits from index after type change. · 185c975f
      Junio C Hamano 提交于
      When we do not trust executable bit from lstat(2), we copied
      existing ce_mode bits without checking if the filesystem object
      is a regular file (which is the only thing we apply the "trust
      executable bit" business) nor if the blob in the index is a
      regular file (otherwise, we should do the same as registering a
      new regular file, which is to default non-executable).
      
      Noticed by Johannes Sixt.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      185c975f
  6. 06 2月, 2007 1 次提交
    • J
      git-blame: no rev means start from the working tree file. · 1cfe7733
      Junio C Hamano 提交于
      Warning: this changes the semantics.
      
      This makes "git blame" without any positive rev to start digging
      from the working tree copy, which is made into a fake commit
      whose sole parent is the HEAD.
      
      It also adds --contents <file> option to pretend as if the
      working tree copy has the contents of the named file.  You can
      use '-' to make the command read from the standard input.
      
      If you want the command to start annotating from the HEAD
      commit, you need to explicitly give HEAD parameter.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1cfe7733
  7. 07 1月, 2007 1 次提交
    • J
      diff-index --cached --raw: show tree entry on the LHS for unmerged entries. · e9c84099
      Junio C Hamano 提交于
      This updates the way diffcore represents an unmerged pair
      somewhat.  It used to be that entries with mode=0 on both sides
      were used to represent an unmerged pair, but now it has an
      explicit flag.  This is to allow diff-index --cached to report
      the entry from the tree when the path is unmerged in the index.
      
      This is used in updating "git reset <tree> -- <path>" to restore
      absense of the path in the index from the tree.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e9c84099
  8. 05 9月, 2006 1 次提交
  9. 24 8月, 2006 2 次提交
    • J
      Convert memset(hash,0,20) to hashclr(hash). · a8e0d16d
      Junio C Hamano 提交于
      In the same spirit as hashcmp() and hashcpy().
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      a8e0d16d
    • S
      Convert memcpy(a,b,20) to hashcpy(a,b). · e702496e
      Shawn Pearce 提交于
      This abstracts away the size of the hash values when copying them
      from memory location to memory location, much as the introduction
      of hashcmp abstracted away hash value comparsion.
      
      A few call sites were using char* rather than unsigned char* so
      I added the cast rather than open hashcpy to be void*.  This is a
      reasonable tradeoff as most call sites already use unsigned char*
      and the existing hashcmp is also declared to be unsigned char*.
      
      [jc: Splitted the patch to "master" part, to be followed by a
       patch for merge-recursive.c which is not in "master" yet.
      
       Fixed the cast in the latter hunk to combine-diff.c which was
       wrong in the original.
      
       Also converted ones left-over in combine-diff.c, diff-lib.c and
       upload-pack.c ]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e702496e
  10. 18 8月, 2006 1 次提交
  11. 20 6月, 2006 1 次提交
    • L
      Add "named object array" concept · 1f1e895f
      Linus Torvalds 提交于
      We've had this notion of a "object_list" for a long time, which eventually
      grew a "name" member because some users (notably git-rev-list) wanted to
      name each object as it is generated.
      
      That object_list is great for some things, but it isn't all that wonderful
      for others, and the "name" member is generally not used by everybody.
      
      This patch splits the users of the object_list array up into two: the
      traditional list users, who want the list-like format, and who don't
      actually use or want the name. And another class of users that really used
      the list as an extensible array, and generally wanted to name the objects.
      
      The patch is fairly straightforward, but it's also biggish. Most of it
      really just cleans things up: switching the revision parsing and listing
      over to the array makes things like the builtin-diff usage much simpler
      (we now see exactly how many members the array has, and we don't get the
      objects reversed from the order they were on the command line).
      
      One of the main reasons for doing this at all is that the malloc overhead
      of the simple object list was actually pretty high, and the array is just
      a lot denser. So this patch brings down memory usage by git-rev-list by
      just under 3% (on top of all the other memory use optimizations) on the
      mozilla archive.
      
      It does add more lines than it removes, and more importantly, it adds a
      whole new infrastructure for maintaining lists of objects, but on the
      other hand, the new dynamic array code is pretty obvious. The change to
      builtin-diff-tree.c shows a fairly good example of why an array interface
      is sometimes more natural, and just much simpler for everybody.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1f1e895f
  12. 19 6月, 2006 1 次提交
  13. 22 4月, 2006 3 次提交
    • J
      Libified diff-index: backward compatibility fix. · 5c21ac0e
      Junio C Hamano 提交于
      "diff-index -m" does not mean "do not ignore merges", but means
      "pretend missing files match the index".
      
      The previous round tried to address this, but failed because
      setup_revisions() ate "-m" flag before the caller had a chance
      to intervene.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5c21ac0e
    • J
      Libify diff-index. · e09ad6e1
      Junio C Hamano 提交于
      The second installment to libify diff brothers.  The pathname
      arguments are checked more strictly than before because we now
      use the revision.c::setup_revisions() infrastructure.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e09ad6e1
    • 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
  14. 20 4月, 2006 2 次提交
  15. 19 4月, 2006 3 次提交
  16. 16 4月, 2006 3 次提交
  17. 14 4月, 2006 3 次提交
  18. 12 4月, 2006 1 次提交
  19. 11 4月, 2006 2 次提交
  20. 09 4月, 2006 1 次提交
  21. 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
  22. 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
  23. 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
  24. 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