1. 26 7月, 2007 1 次提交
  2. 08 7月, 2007 2 次提交
  3. 07 7月, 2007 1 次提交
    • J
      Fix configuration syntax to specify customized hunk header patterns. · e0e324a4
      Junio C Hamano 提交于
      This updates the hunk header customization syntax.  The special
      case 'funcname' attribute is gone.
      
      You assign the name of the type of contents to path's "diff"
      attribute as a string value in .gitattributes like this:
      
      	*.java diff=java
      	*.perl diff=perl
      	*.doc diff=doc
      
      If you supply "diff.<name>.funcname" variable via the
      configuration mechanism (e.g. in $HOME/.gitconfig), the value is
      used as the regexp set to find the line to use for the hunk
      header (the variable is called "funcname" because such a line
      typically is the one that has the name of the function in
      programming language source text).
      
      If there is no such configuration, built-in default is used, if
      any.  Currently there are two default patterns: default and java.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e0e324a4
  4. 06 7月, 2007 3 次提交
    • J
      Per-path attribute based hunk header selection. · f258475a
      Junio C Hamano 提交于
      This makes"diff -p" hunk headers customizable via gitattributes mechanism.
      It is based on Johannes's earlier patch that allowed to define a single
      regexp to be used for everything.
      
      The mechanism to arrive at the regexp that is used to define hunk header
      is the same as other use of gitattributes.  You assign an attribute, funcname
      (because "diff -p" typically uses the name of the function the patch is about
      as the hunk header), a simple string value.  This can be one of the names of
      built-in pattern (currently, "java" is defined) or a custom pattern name, to
      be looked up from the configuration file.
      
        (in .gitattributes)
        *.java   funcname=java
        *.perl   funcname=perl
      
        (in .git/config)
        [funcname]
          java = ... # ugly and complicated regexp to override the built-in one.
          perl = ... # another ugly and complicated regexp to define a new one.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f258475a
    • J
      Future-proof source for changes in xdemitconf_t · 30b25010
      Johannes Schindelin 提交于
      The instances of xdemitconf_t were initialized member by member.
      Instead, initialize them to all zero, so we do not have
      to update those places each time we introduce a new member.
      
      [jc: minimally fixed by getting rid of a new global]
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      30b25010
    • J
      Introduce diff_filespec_is_binary() · 29a3eefd
      Junio C Hamano 提交于
      This replaces an explicit initialization of filespec->is_binary
      field used for rename/break followed by direct access to that
      field with a wrapper function that lazily iniaitlizes and
      accesses the field.  We would add more attribute accesses for
      the use of diff routines, and it would be better to make this
      abstraction earlier.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      29a3eefd
  5. 04 7月, 2007 2 次提交
  6. 01 7月, 2007 1 次提交
  7. 25 6月, 2007 1 次提交
  8. 23 6月, 2007 1 次提交
    • L
      Finally implement "git log --follow" · 750f7b66
      Linus Torvalds 提交于
      Ok, I've really held off doing this too damn long, because I'm lazy, and I
      was always hoping that somebody else would do it.
      
      But no, people keep asking for it, but nobody actually did anything, so I
      decided I might as well bite the bullet, and instead of telling people
      they could add a "--follow" flag to "git log" to do what they want to do,
      I decided that it looks like I just have to do it for them..
      
      The code wasn't actually that complicated, in that the diffstat for this
      patch literally says "70 insertions(+), 1 deletions(-)", but I will have
      to admit that in order to get to this fairly simple patch, you did have to
      know and understand the internal git diff generation machinery pretty
      well, and had to really be able to follow how commit generation interacts
      with generating patches and generating the log.
      
      So I suspect that while I was right that it wasn't that hard, I might have
      been expecting too much of random people - this patch does seem to be
      firmly in the core "Linus or Junio" territory.
      
      To make a long story short: I'm sorry for it taking so long until I just
      did it.
      
      I'm not going to guarantee that this works for everybody, but you really
      can just look at the patch, and after the appropriate appreciative noises
      ("Ooh, aah") over how clever I am, you can then just notice that the code
      itself isn't really that complicated.
      
      All the real new code is in the new "try_to_follow_renames()" function. It
      really isn't rocket science: we notice that the pathname we were looking
      at went away, so we start a full tree diff and try to see if we can
      instead make that pathname be a rename or a copy from some other previous
      pathname. And if we can, we just continue, except we show *that*
      particular diff, and ever after we use the _previous_ pathname.
      
      One thing to look out for: the "rename detection" is considered to be a
      singular event in the _linear_ "git log" output! That's what people want
      to do, but I just wanted to point out that this patch is *not* carrying
      around a "commit,pathname" kind of pair and it's *not* going to be able to
      notice the file coming from multiple *different* files in earlier history.
      
      IOW, if you use "git log --follow", then you get the stupid CVS/SVN kind
      of "files have single identities" kind of semantics, and git log will just
      pick the identity based on the normal move/copy heuristics _as_if_ the
      history could be linearized.
      
      Put another way: I think the model is broken, but given the broken model,
      I think this patch does just about as well as you can do. If you have
      merges with the same "file" having different filenames over the two
      branches, git will just end up picking _one_ of the pathnames at the point
      where the newer one goes away. It never looks at multiple pathnames in
      parallel.
      
      And if you understood all that, you probably didn't need it explained, and
      if you didn't understand the above blathering, it doesn't really mtter to
      you. What matters to you is that you can now do
      
      	git log -p --follow builtin-rev-list.c
      
      and it will find the point where the old "rev-list.c" got renamed to
      "builtin-rev-list.c" and show it as such.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      750f7b66
  9. 16 6月, 2007 1 次提交
  10. 12 6月, 2007 1 次提交
  11. 08 6月, 2007 1 次提交
  12. 07 6月, 2007 1 次提交
    • J
      War on whitespace · a6080a0a
      Junio C Hamano 提交于
      This uses "git-apply --whitespace=strip" to fix whitespace errors that have
      crept in to our source files over time.  There are a few files that need
      to have trailing whitespaces (most notably, test vectors).  The results
      still passes the test, and build result in Documentation/ area is unchanged.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a6080a0a
  13. 05 6月, 2007 1 次提交
  14. 26 5月, 2007 1 次提交
  15. 22 5月, 2007 1 次提交
  16. 21 5月, 2007 1 次提交
  17. 16 5月, 2007 1 次提交
  18. 08 5月, 2007 2 次提交
  19. 04 5月, 2007 1 次提交
  20. 23 4月, 2007 1 次提交
    • J
      Support 'diff=pgm' attribute · f1af60bd
      Junio C Hamano 提交于
      This enhances the attributes mechanism so that external programs
      meant for existing GIT_EXTERNAL_DIFF interface can be specifed
      per path.
      
      To configure such a custom diff driver, first define a custom
      diff driver in the configuration:
      
      	[diff "my-c-diff"]
      		command = <<your command string comes here>>
      
      Then mark the paths that you want to use this custom driver
      using the attribute mechanism.
      
      	*.c	diff=my-c-diff
      
      The intent of this separation is that the attribute mechanism is
      used for specifying the type of the contents, while the
      configuration mechanism is used to define what needs to be done
      to that type of the contents, which would be specific to both
      platform and personal taste.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      f1af60bd
  21. 21 4月, 2007 1 次提交
  22. 19 4月, 2007 1 次提交
    • J
      Fix funny types used in attribute value representation · a5e92abd
      Junio C Hamano 提交于
      It was bothering me a lot that I abused small integer values
      casted to (void *) to represent non string values in
      gitattributes.  This corrects it by making the type of attribute
      values (const char *), and using the address of a few statically
      allocated character buffer to denote true/false.  Unset attributes
      are represented as having NULLs as their values.
      
      Added in-header documentation to explain how git_checkattr()
      routine should be called.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      a5e92abd
  23. 17 4月, 2007 1 次提交
    • J
      Allow more than true/false to attributes. · 515106fa
      Junio C Hamano 提交于
      This allows you to define three values (and possibly more) to
      each attribute: true, false, and unset.
      
      Typically the handlers that notice and act on attribute values
      treat "unset" attribute to mean "do your default thing"
      (e.g. crlf that is unset would trigger "guess from contents"),
      so being able to override a setting to an unset state is
      actually useful.
      
       - If you want to set the attribute value to true, have an entry
         in .gitattributes file that mentions the attribute name; e.g.
      
      	*.o	binary
      
       - If you want to set the attribute value explicitly to false,
         use '-'; e.g.
      
      	*.a	-diff
      
       - If you want to make the attribute value _unset_, perhaps to
         override an earlier entry, use '!'; e.g.
      
      	*.a	-diff
      	c.i.a	!diff
      
      This also allows string values to attributes, with the natural
      syntax:
      
      	attrname=attrvalue
      
      but you cannot use it, as nobody takes notice and acts on
      it yet.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      515106fa
  24. 16 4月, 2007 2 次提交
    • J
      Fix 'diff' attribute semantics. · 40250af4
      Junio C Hamano 提交于
      This is in the same spirit as the previous one.  Earlier 'diff'
      meant 'do the built-in binary heuristics and disable patch text
      generation based on it' while '!diff' meant 'do not guess, do
      not generate patch text'.  There was no way to say 'do generate
      patch text even when the heuristics says it has NUL in it'.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      40250af4
    • L
      Expose subprojects as special files to "git diff" machinery · 04786756
      Linus Torvalds 提交于
      The same way we generate diffs on symlinks as the the diff of text of the
      symlink, we can generate subproject diffs (when not recursing into them!)
      as the diff of the text that describes the subproject.
      
      Of course, since what descibes a subproject is just the SHA1, that's what
      we'll use. Add some pretty-printing to make it a bit more obvious what is
      going on, and we're done.
      
      So with this, we can get both raw diffs and "textual" diffs of subproject
      changes:
      
       - git diff --raw:
      
      	:160000 160000 2de597b5ad348b7db04bd10cdd38cd81cbc93ab5 0000000... M    sub-A
      
       - git diff:
      
      	diff --git a/sub-A b/sub-A
      	index 2de597b..e8f11a4 160000
      	--- a/sub-A
      	+++ b/sub-A
      	@@ -1 +1 @@
      	-Subproject commit 2de597b5ad348b7db04bd10cdd38cd81cbc93ab5
      	+Subproject commit e8f11a45c5c6b9e2fec6d136d3fb5aff75393d42
      
      NOTE! We'll also want to have the ability to recurse into the subproject
      and actually diff it recursively, but that will involve a new command line
      option (I'd suggest "--subproject" and "-S", but the latter is in use by
      pickaxe), and some very different code.
      
      But regardless of ay future recursive behaviour, we need the non-recursive
      version too (and it should be the default, at least in the absense of
      config options, so that large superprojects don't default to something
      extremely expensive).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      04786756
  25. 14 4月, 2007 1 次提交
  26. 06 4月, 2007 1 次提交
    • A
      Show binary file size change in diff --stat · b1882587
      Andy Parkins 提交于
      Previously, a binary file in the diffstat would show as:
      
       some-binary-file.bin       |  Bin
      
      The space after the "Bin" was never used.  This patch changes binary
      lines in the diffstat to be:
      
       some-binary-file.bin       |  Bin 12345 -> 123456 bytes
      
      The very nice "->" notation was suggested by Johannes Schindelin, and
      shows the before and after sizes more clearly than "+" and "-" would.
      If a size is 0 it's not shown (although it would probably be better to
      treat no-file differently from zero-byte-file).
      
      The user can see what changed in the binary file, and how big the new
      file is.  This is in keeping with the information in the rest of the
      diffstat.
      
      The diffstat_t members "added" and "deleted" were unused when the file
      was binary, so this patch loads them with the file sizes in
      builtin_diffstat().  These figures are then read in show_stats() when
      the file is marked binary.
      Signed-off-by: NAndy Parkins <andyparkins@gmail.com>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      b1882587
  27. 15 3月, 2007 3 次提交
    • J
      diff --quiet · 68aacb2f
      Junio C Hamano 提交于
      This adds the command line option 'quiet' to tell 'git diff-*'
      that we are not interested in the actual diff contents but only
      want to know if there is any change.  This option automatically
      turns --exit-code on, and turns off output formatting, as it
      does not make much sense to show the first hit we happened to
      have found.
      
      The --quiet option is silently turned off (but --exit-code is
      still in effect, so is silent output) if postprocessing filters
      such as pickaxe and diff-filter are used.  For all practical
      purposes I do not think of a reason to want to use these filters
      and not viewing the diff output.
      
      The backends have not been taught about the option with this patch.
      That is a topic for later rounds.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      68aacb2f
    • J
      Remove unused diffcore_std_no_resolve · 3161b4b5
      Junio C Hamano 提交于
      This was only used by diff-tree-helper program, whose purpose
      was to translate a raw diff to a patch.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      3161b4b5
    • A
      Allow git-diff exit with codes similar to diff(1) · 41bbf9d5
      Alex Riesen 提交于
      This introduces a new command-line option: --exit-code. The diff
      programs will return 1 for differences, return 0 for equality, and
      something else for errors.
      Signed-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      41bbf9d5
  28. 08 3月, 2007 1 次提交
    • S
      Cast 64 bit off_t to 32 bit size_t · dc49cd76
      Shawn O. Pearce 提交于
      Some systems have sizeof(off_t) == 8 while sizeof(size_t) == 4.
      This implies that we are able to access and work on files whose
      maximum length is around 2^63-1 bytes, but we can only malloc or
      mmap somewhat less than 2^32-1 bytes of memory.
      
      On such a system an implicit conversion of off_t to size_t can cause
      the size_t to wrap, resulting in unexpected and exciting behavior.
      Right now we are working around all gcc warnings generated by the
      -Wshorten-64-to-32 option by passing the off_t through xsize_t().
      
      In the future we should make xsize_t on such problematic platforms
      detect the wrapping and die if such a file is accessed.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      dc49cd76
  29. 04 3月, 2007 2 次提交
  30. 27 2月, 2007 1 次提交
    • N
      convert object type handling from a string to a number · 21666f1a
      Nicolas Pitre 提交于
      We currently have two parallel notation for dealing with object types
      in the code: a string and a numerical value.  One of them is obviously
      redundent, and the most used one requires more stack space and a bunch
      of strcmp() all over the place.
      
      This is an initial step for the removal of the version using a char array
      found in object reading code paths.  The patch is unfortunately large but
      there is no sane way to split it in smaller parts without breaking the
      system.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      21666f1a
  31. 26 2月, 2007 1 次提交