Merge branch 'bc/maint-diff-hunk-header-fix' into bc/master-diff-hunk-header-fix
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2008 03:32:50 +0000 (20:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2008 03:32:50 +0000 (20:32 -0700)
* bc/maint-diff-hunk-header-fix:
  diff.*.xfuncname which uses "extended" regex's for hunk header selection
  diff.c: associate a flag with each pattern and use it for compiling regex
  diff.c: return pattern entry pointer rather than just the hunk header pattern
  Cosmetical command name fix
  Start conforming code to "git subcmd" style part 3
  t9700/test.pl: remove File::Temp requirement
  t9700/test.pl: avoid bareword 'STDERR' in 3-argument open()
  GIT 1.6.0.2
  Fix some manual typos.
  Use compatibility regex library also on FreeBSD
  Use compatibility regex library also on AIX
  Update draft release notes for 1.6.0.2
  Use compatibility regex library for OSX/Darwin
  git-svn: Fixes my() parameter list syntax error in pre-5.8 Perl
  Git.pm: Use File::Temp->tempfile instead of ->new
  t7501: always use test_cmp instead of diff
  Start conforming code to "git subcmd" style part 2
  diff: Help "less" hide ^M from the output
  checkout: do not check out unmerged higher stages randomly

Conflicts:
Documentation/git.txt
Documentation/gitattributes.txt
Makefile
diff.c
t/t7201-co.sh

13 files changed:
1  2 
Documentation/gitattributes.txt
Makefile
builtin-checkout.c
builtin-commit-tree.c
builtin-fetch-pack.c
builtin-update-index.c
combine-diff.c
diff.c
git-svn.perl
t/t7201-co.sh
t/t9700/test.pl
xdiff-interface.c
xdiff-interface.h

index 75124d26125f736b446b8e18826af3e444503edd,9259637609da2b34d15d217daeebeccc6ba853e4..9a752570f3c2d5a9ae41f3711474e9ab86864964
@@@ -311,9 -311,7 +311,9 @@@ patterns are available
  
  - `bibtex` suitable for files with BibTeX coded references.
  
- - `java` suitable for source code in the Java lanugage.
 +- `html` suitable for HTML/XHTML documents.
 +
+ - `java` suitable for source code in the Java language.
  
  - `pascal` suitable for source code in the Pascal/Delphi language.
  
diff --cc Makefile
index dfed7bae9439675bb734c0f9fb3852ecb01fdf6d,8d81095765b1e73fa79e2950c47fd06f3c475ac7..615d1baa9f7f45e32be8dce271a1cfb37c78a832
+++ b/Makefile
@@@ -682,7 -677,8 +684,9 @@@ ifeq ($(uname_S),FreeBSD
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
        DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
 +      THREADED_DELTA_SEARCH = YesPlease
+       COMPAT_CFLAGS += -Icompat/regex
+       COMPAT_OBJS += compat/regex/regex.o
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
@@@ -760,11 -756,10 +766,11 @@@ ifneq (,$(findstring MINGW,$(uname_S))
        NO_SVN_TESTS = YesPlease
        NO_PERL_MAKEMAKER = YesPlease
        NO_POSIX_ONLY_PROGRAMS = YesPlease
-       COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat
 +      NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
+       COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
        COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
-       COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o compat/winansi.o
+       COMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/regex/regex.o compat/winansi.o
        EXTLIBS += -lws2_32
        X = .exe
        gitexecdir = ../libexec/git-core
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc combine-diff.c
Simple merge
diff --cc diff.c
index e7afbe28c1379fbd003de905e1d7cb87ff37971e,dabb4b4a021414adb89d5647afe14caaff670a76..7b24672d31b09c9f7d7de840c57f75adba598b84
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -1385,12 -1398,7 +1403,9 @@@ static const struct funcname_pattern_en
        return NULL;
  }
  
- static struct builtin_funcname_pattern {
-       const char *name;
-       const char *pattern;
- } builtin_funcname_pattern[] = {
-       { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$" },
-       { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$" },
+ static const struct funcname_pattern_entry builtin_funcname_pattern[] = {
++      { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$", 0 },
++      { "html", "^\\s*\\(<[Hh][1-6]\\s.*>.*\\)$", 0 },
        { "java", "!^[  ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
                        "new\\|return\\|switch\\|throw\\|while\\)\n"
                        "^[     ]*\\(\\([       ]*"
                        "destructor\\|interface\\|implementation\\|"
                        "initialization\\|finalization\\)[ \t]*.*\\)$"
                        "\\|"
-                       "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
-                       },
-       { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)" },
-       { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$" },
-       { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
-       { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$" },
+                       "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$",
+                       0 },
 -      { "bibtex", "\\(@[a-zA-Z]\\{1,\\}[ \t]*{\\{0,1\\}[ \t]*[^ \t\"@',\\#}{~%]*\\).*$", 0 },
 -      { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$", 0 },
++      { "php", "^[\t ]*\\(\\(function\\|class\\).*\\)", 0 },
++      { "python", "^\\s*\\(\\(class\\|def\\)\\s.*\\)$", 0 },
+       { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$", 0 },
++      { "tex", "^\\(\\\\\\(\\(sub\\)*section\\|chapter\\|part\\)\\*\\{0,1\\}{.*\\)$", 0 },
  };
  
- static const char *diff_funcname_pattern(struct diff_filespec *one)
+ static const struct funcname_pattern_entry *diff_funcname_pattern(struct diff_filespec *one)
  {
-       const char *ident, *pattern;
+       const char *ident;
+       const struct funcname_pattern_entry *pe;
        int i;
  
        diff_filespec_check_attr(one);
diff --cc git-svn.perl
Simple merge
diff --cc t/t7201-co.sh
index 543b1c289866d01f8aa3f931f3579565a963de9d,fbec70d3c6abff4a97aa205aa10fbf6fe336fa5f..25181388f8a8f1730d05fce128e0e1fc66eb3c0e
@@@ -337,36 -337,26 +337,58 @@@ test_expect_success 
      test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
      test_must_fail git checkout --track -b track'
  
 +test_expect_success \
 +    'checkout with --track fakes a sensible -b <name>' '
 +    git update-ref refs/remotes/origin/koala/bear renamer &&
 +    git update-ref refs/new/koala/bear renamer &&
 +
 +    git checkout --track origin/koala/bear &&
 +    test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
 +    test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
 +
 +    git checkout master && git branch -D koala/bear &&
 +
 +    git checkout --track refs/remotes/origin/koala/bear &&
 +    test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
 +    test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
 +
 +    git checkout master && git branch -D koala/bear &&
 +
 +    git checkout --track remotes/origin/koala/bear &&
 +    test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
 +    test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
 +
 +    git checkout master && git branch -D koala/bear &&
 +
 +    git checkout --track refs/new/koala/bear &&
 +    test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
 +    test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
 +'
 +
 +test_expect_success \
 +    'checkout with --track, but without -b, fails with too short tracked name' '
 +    test_must_fail git checkout --track renamer'
 +
+ test_expect_success 'checkout an unmerged path should fail' '
+       rm -f .git/index &&
+       O=$(echo original | git hash-object -w --stdin) &&
+       A=$(echo ourside | git hash-object -w --stdin) &&
+       B=$(echo theirside | git hash-object -w --stdin) &&
+       (
+               echo "100644 $A 0       fild" &&
+               echo "100644 $O 1       file" &&
+               echo "100644 $A 2       file" &&
+               echo "100644 $B 3       file" &&
+               echo "100644 $A 0       filf"
+       ) | git update-index --index-info &&
+       echo "none of the above" >sample &&
+       cat sample >fild &&
+       cat sample >file &&
+       cat sample >filf &&
+       test_must_fail git checkout fild file filf &&
+       test_cmp sample fild &&
+       test_cmp sample filf &&
+       test_cmp sample file
+ '
  test_done
diff --cc t/t9700/test.pl
Simple merge
Simple merge
Simple merge