]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Sync with v2.0.5
authorJunio C Hamano <gitster@pobox.com>
Wed, 17 Dec 2014 19:42:28 +0000 (11:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Dec 2014 19:42:28 +0000 (11:42 -0800)
* maint-2.0:
  Git 2.0.5
  Git 1.9.5
  Git 1.8.5.6
  fsck: complain about NTFS ".git" aliases in trees
  read-cache: optionally disallow NTFS .git variants
  path: add is_ntfs_dotgit() helper
  fsck: complain about HFS+ ".git" aliases in trees
  read-cache: optionally disallow HFS+ .git variants
  utf8: add is_hfs_dotgit() helper
  fsck: notice .git case-insensitively
  t1450: refactor ".", "..", and ".git" fsck tests
  verify_dotfile(): reject .git case-insensitively
  read-tree: add tests for confusing paths like ".." and ".git"
  unpack-trees: propagate errors adding entries to the index

13 files changed:
1  2 
Documentation/config.txt
Documentation/git.txt
cache.h
config.c
config.mak.uname
environment.c
fsck.c
path.c
read-cache.c
t/t1450-fsck.sh
t/test-lib.sh
unpack-trees.c
utf8.c

Simple merge
index 56278451140b49fa13332ebf74f58a6713df2c26,674ecf9a3ba9dded1fd9226133ccdc894f79ac23..ffde2b80b9beaad3fb7a930e7ac54b24ef527143
@@@ -43,17 -43,10 +43,18 @@@ unreleased) version of Git, that is ava
  branch of the `git.git` repository.
  Documentation for older releases are available here:
  
- * link:v2.0.4/git.html[documentation for release 2.0.4]
 +* link:v2.1.3/git.html[documentation for release 2.1.3]
 +
 +* release notes for
 +  link:RelNotes/2.1.3.txt[2.1.3],
 +  link:RelNotes/2.1.2.txt[2.1.2],
 +  link:RelNotes/2.1.1.txt[2.1.1],
 +  link:RelNotes/2.1.0.txt[2.1].
 +
+ * link:v2.0.5/git.html[documentation for release 2.0.5]
  
  * release notes for
+   link:RelNotes/2.0.5.txt[2.0.5],
    link:RelNotes/2.0.4.txt[2.0.4],
    link:RelNotes/2.0.3.txt[2.0.3],
    link:RelNotes/2.0.2.txt[2.0.2],
diff --cc cache.h
index dcf3a2afe9d782e4b2474d8834602f80610ba25f,f23fdbee96fc9ad14e3a16e77d277293207dd6c3..a258d805cda7c155cbe60629f38bd3f323c21d78
+++ b/cache.h
@@@ -847,6 -812,8 +849,7 @@@ int normalize_path_copy(char *dst, cons
  int longest_ancestor_length(const char *path, struct string_list *prefixes);
  char *strip_path_suffix(const char *path, const char *suffix);
  int daemon_avoid_alias(const char *path);
 -int offset_1st_component(const char *path);
+ extern int is_ntfs_dotgit(const char *name);
  
  /* object replacement */
  #define LOOKUP_REPLACE_OBJECT 1
diff --cc config.c
Simple merge
index 15ee15e98c2cb232e1e42315dc44f7efd87b4f1c,aba56dcfad74919491360d0914d1390a9cbba110..0941e30a67faa3c0ab2e0ff312ca5f58c92f9dff
@@@ -368,8 -362,9 +369,9 @@@ ifeq ($(uname_S),Windows
        EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
        PTHREAD_LIBS =
        lib =
+       BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
  ifndef DEBUG
 -      BASIC_CFLAGS += -GL -Os -MT
 +      BASIC_CFLAGS += -GL -Os -MD
        BASIC_LDFLAGS += -LTCG
        AR += -LTCG
  else
diff --cc environment.c
Simple merge
diff --cc fsck.c
Simple merge
diff --cc path.c
index 3afcdb432a009b5e1c869123139192cf1a688292,f10c91a92708d2e9915aa2855658243d90a4b9df..757d0b057d3d72842e182864cc0f52b6457e4079
--- 1/path.c
--- 2/path.c
+++ b/path.c
@@@ -821,3 -821,43 +821,36 @@@ int daemon_avoid_alias(const char *p
                }
        }
  }
 -int offset_1st_component(const char *path)
 -{
 -      if (has_dos_drive_prefix(path))
 -              return 2 + is_dir_sep(path[2]);
 -      return is_dir_sep(path[0]);
 -}
 -
+ static int only_spaces_and_periods(const char *path, size_t len, size_t skip)
+ {
+       if (len < skip)
+               return 0;
+       len -= skip;
+       path += skip;
+       while (len-- > 0) {
+               char c = *(path++);
+               if (c != ' ' && c != '.')
+                       return 0;
+       }
+       return 1;
+ }
+ int is_ntfs_dotgit(const char *name)
+ {
+       int len;
+       for (len = 0; ; len++)
+               if (!name[len] || name[len] == '\\' || is_dir_sep(name[len])) {
+                       if (only_spaces_and_periods(name, len, 4) &&
+                                       !strncasecmp(name, ".git", 4))
+                               return 1;
+                       if (only_spaces_and_periods(name, len, 5) &&
+                                       !strncasecmp(name, "git~1", 5))
+                               return 1;
+                       if (name[len] != '\\')
+                               return 0;
+                       name += len + 1;
+                       len = -1;
+               }
+ }
diff --cc read-cache.c
index 6f0057fe66a59e1239703ee4458de200304f727a,36a6f73fedc2fdb7c5dc2e1fb73ca5c5c76979c0..f0426938565e89d870aa07b65557e7d5b890b382
@@@ -14,8 -14,7 +14,9 @@@
  #include "resolve-undo.h"
  #include "strbuf.h"
  #include "varint.h"
 +#include "split-index.h"
 +#include "sigchain.h"
+ #include "utf8.h"
  
  static struct cache_entry *refresh_cache_entry(struct cache_entry *ce,
                                               unsigned int options);
diff --cc t/t1450-fsck.sh
index b52397afd3352b873c9c7fabb91eb850aaf0db3b,983568a4b9f81d95c5142b02a3760be3644b5bd8..426f753fe3e4907a151be87be247a32bf9741905
@@@ -271,91 -251,40 +271,96 @@@ test_expect_success 'fsck notices submo
        )
  '
  
- test_expect_success 'fsck notices "." and ".." in trees' '
-       (
-               git init dots &&
-               cd dots &&
-               blob=$(echo foo | git hash-object -w --stdin) &&
-               tab=$(printf "\\t") &&
-               git mktree <<-EOF &&
-               100644 blob $blob$tab.
-               100644 blob $blob$tab..
-               EOF
-               git fsck 2>out &&
-               cat out &&
-               grep "warning.*\\." out
-       )
- '
- test_expect_success 'fsck notices ".git" in trees' '
-       (
-               git init dotgit &&
-               cd dotgit &&
-               blob=$(echo foo | git hash-object -w --stdin) &&
-               tab=$(printf "\\t") &&
-               git mktree <<-EOF &&
-               100644 blob $blob$tab.git
-               EOF
-               git fsck 2>out &&
-               cat out &&
-               grep "warning.*\\.git" out
-       )
- '
+ while read name path pretty; do
+       while read mode type; do
+               : ${pretty:=$path}
+               test_expect_success "fsck notices $pretty as $type" '
+               (
+                       git init $name-$type &&
+                       cd $name-$type &&
+                       echo content >file &&
+                       git add file &&
+                       git commit -m base &&
+                       blob=$(git rev-parse :file) &&
+                       tree=$(git rev-parse HEAD^{tree}) &&
+                       value=$(eval "echo \$$type") &&
+                       printf "$mode $type %s\t%s" "$value" "$path" >bad &&
+                       bad_tree=$(git mktree <bad) &&
+                       git fsck 2>out &&
+                       cat out &&
+                       grep "warning.*tree $bad_tree" out
+               )'
+       done <<-\EOF
+       100644 blob
+       040000 tree
+       EOF
+ done <<-EOF
+ dot .
+ dotdot ..
+ dotgit .git
+ dotgit-case .GIT
+ dotgit-unicode .gI${u200c}T .gI{u200c}T
+ dotgit-case2 .Git
+ git-tilde1 git~1
+ dotgitdot .git.
+ dot-backslash-case .\\\\.GIT\\\\foobar
+ dotgit-case-backslash .git\\\\foobar
+ EOF
  
 +# create a static test repo which is broken by omitting
 +# one particular object ($1, which is looked up via rev-parse
 +# in the new repository).
 +create_repo_missing () {
 +      rm -rf missing &&
 +      git init missing &&
 +      (
 +              cd missing &&
 +              git commit -m one --allow-empty &&
 +              mkdir subdir &&
 +              echo content >subdir/file &&
 +              git add subdir/file &&
 +              git commit -m two &&
 +              unrelated=$(echo unrelated | git hash-object --stdin -w) &&
 +              git tag -m foo tag $unrelated &&
 +              sha1=$(git rev-parse --verify "$1") &&
 +              path=$(echo $sha1 | sed 's|..|&/|') &&
 +              rm .git/objects/$path
 +      )
 +}
 +
 +test_expect_success 'fsck notices missing blob' '
 +      create_repo_missing HEAD:subdir/file &&
 +      test_must_fail git -C missing fsck
 +'
 +
 +test_expect_success 'fsck notices missing subtree' '
 +      create_repo_missing HEAD:subdir &&
 +      test_must_fail git -C missing fsck
 +'
 +
 +test_expect_success 'fsck notices missing root tree' '
 +      create_repo_missing HEAD^{tree} &&
 +      test_must_fail git -C missing fsck
 +'
 +
 +test_expect_success 'fsck notices missing parent' '
 +      create_repo_missing HEAD^ &&
 +      test_must_fail git -C missing fsck
 +'
 +
 +test_expect_success 'fsck notices missing tagged object' '
 +      create_repo_missing tag^{blob} &&
 +      test_must_fail git -C missing fsck
 +'
 +
 +test_expect_success 'fsck notices ref pointing to missing commit' '
 +      create_repo_missing HEAD &&
 +      test_must_fail git -C missing fsck
 +'
 +
 +test_expect_success 'fsck notices ref pointing to missing tag' '
 +      create_repo_missing tag &&
 +      test_must_fail git -C missing fsck
 +'
 +
  test_done
diff --cc t/test-lib.sh
Simple merge
diff --cc unpack-trees.c
Simple merge
diff --cc utf8.c
Simple merge