Skip to content

Commit 3f15098

Browse files
committed
Sync with v2.2.1
* maint: Git 2.2.1 Git 2.1.4 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
2 parents 9abc44b + 9b7cbb3 commit 3f15098

20 files changed

+442
-43
lines changed

Documentation/RelNotes/1.8.5.6.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v1.8.5.6 Release Notes
2+
==========================
3+
4+
Fixes since v1.8.5.5
5+
--------------------
6+
7+
* We used to allow committing a path ".Git/config" with Git that is
8+
running on a case sensitive filesystem, but an attempt to check out
9+
such a path with Git that runs on a case insensitive filesystem
10+
would have clobbered ".git/config", which is definitely not what
11+
the user would have expected. Git now prevents you from tracking
12+
a path with ".Git" (in any case combination) as a path component.
13+
14+
* On Windows, certain path components that are different from ".git"
15+
are mapped to ".git", e.g. "git~1/config" is treated as if it were
16+
".git/config". HFS+ has a similar issue, where certain unicode
17+
codepoints are ignored, e.g. ".g\u200cit/config" is treated as if
18+
it were ".git/config". Pathnames with these potential issues are
19+
rejected on the affected systems. Git on systems that are not
20+
affected by this issue (e.g. Linux) can also be configured to
21+
reject them to ensure cross platform interoperability of the hosted
22+
projects.
23+
24+
* "git fsck" notices a tree object that records such a path that can
25+
be confused with ".git", and with receive.fsckObjects configuration
26+
set to true, an attempt to "git push" such a tree object will be
27+
rejected. Such a path may not be a problem on a well behaving
28+
filesystem but in order to protect those on HFS+ and on case
29+
insensitive filesystems, this check is enabled on all platforms.
30+
31+
A big "thanks!" for bringing this issue to us goes to our friends in
32+
the Mercurial land, namely, Matt Mackall and Augie Fackler.
33+
34+
Also contains typofixes, documentation updates and trivial code clean-ups.

Documentation/RelNotes/1.9.5.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v1.9.5 Release Notes
2+
========================
3+
4+
Fixes since v1.9.4
5+
------------------
6+
7+
* We used to allow committing a path ".Git/config" with Git that is
8+
running on a case sensitive filesystem, but an attempt to check out
9+
such a path with Git that runs on a case insensitive filesystem
10+
would have clobbered ".git/config", which is definitely not what
11+
the user would have expected. Git now prevents you from tracking
12+
a path with ".Git" (in any case combination) as a path component.
13+
14+
* On Windows, certain path components that are different from ".git"
15+
are mapped to ".git", e.g. "git~1/config" is treated as if it were
16+
".git/config". HFS+ has a similar issue, where certain unicode
17+
codepoints are ignored, e.g. ".g\u200cit/config" is treated as if
18+
it were ".git/config". Pathnames with these potential issues are
19+
rejected on the affected systems. Git on systems that are not
20+
affected by this issue (e.g. Linux) can also be configured to
21+
reject them to ensure cross platform interoperability of the hosted
22+
projects.
23+
24+
* "git fsck" notices a tree object that records such a path that can
25+
be confused with ".git", and with receive.fsckObjects configuration
26+
set to true, an attempt to "git push" such a tree object will be
27+
rejected. Such a path may not be a problem on a well behaving
28+
filesystem but in order to protect those on HFS+ and on case
29+
insensitive filesystems, this check is enabled on all platforms.
30+
31+
A big "thanks!" for bringing this issue to us goes to our friends in
32+
the Mercurial land, namely, Matt Mackall and Augie Fackler.
33+
34+
Also contains typofixes, documentation updates and trivial code clean-ups.

Documentation/RelNotes/2.0.5.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v2.0.5 Release Notes
2+
========================
3+
4+
Fixes since v2.0.4
5+
------------------
6+
7+
* We used to allow committing a path ".Git/config" with Git that is
8+
running on a case sensitive filesystem, but an attempt to check out
9+
such a path with Git that runs on a case insensitive filesystem
10+
would have clobbered ".git/config", which is definitely not what
11+
the user would have expected. Git now prevents you from tracking
12+
a path with ".Git" (in any case combination) as a path component.
13+
14+
* On Windows, certain path components that are different from ".git"
15+
are mapped to ".git", e.g. "git~1/config" is treated as if it were
16+
".git/config". HFS+ has a similar issue, where certain unicode
17+
codepoints are ignored, e.g. ".g\u200cit/config" is treated as if
18+
it were ".git/config". Pathnames with these potential issues are
19+
rejected on the affected systems. Git on systems that are not
20+
affected by this issue (e.g. Linux) can also be configured to
21+
reject them to ensure cross platform interoperability of the hosted
22+
projects.
23+
24+
* "git fsck" notices a tree object that records such a path that can
25+
be confused with ".git", and with receive.fsckObjects configuration
26+
set to true, an attempt to "git push" such a tree object will be
27+
rejected. Such a path may not be a problem on a well behaving
28+
filesystem but in order to protect those on HFS+ and on case
29+
insensitive filesystems, this check is enabled on all platforms.
30+
31+
A big "thanks!" for bringing this issue to us goes to our friends in
32+
the Mercurial land, namely, Matt Mackall and Augie Fackler.
33+
34+
Also contains typofixes, documentation updates and trivial code clean-ups.

Documentation/RelNotes/2.1.4.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v2.1.4 Release Notes
2+
========================
3+
4+
Fixes since v2.1.3
5+
------------------
6+
7+
* We used to allow committing a path ".Git/config" with Git that is
8+
running on a case sensitive filesystem, but an attempt to check out
9+
such a path with Git that runs on a case insensitive filesystem
10+
would have clobbered ".git/config", which is definitely not what
11+
the user would have expected. Git now prevents you from tracking
12+
a path with ".Git" (in any case combination) as a path component.
13+
14+
* On Windows, certain path components that are different from ".git"
15+
are mapped to ".git", e.g. "git~1/config" is treated as if it were
16+
".git/config". HFS+ has a similar issue, where certain unicode
17+
codepoints are ignored, e.g. ".g\u200cit/config" is treated as if
18+
it were ".git/config". Pathnames with these potential issues are
19+
rejected on the affected systems. Git on systems that are not
20+
affected by this issue (e.g. Linux) can also be configured to
21+
reject them to ensure cross platform interoperability of the hosted
22+
projects.
23+
24+
* "git fsck" notices a tree object that records such a path that can
25+
be confused with ".git", and with receive.fsckObjects configuration
26+
set to true, an attempt to "git push" such a tree object will be
27+
rejected. Such a path may not be a problem on a well behaving
28+
filesystem but in order to protect those on HFS+ and on case
29+
insensitive filesystems, this check is enabled on all platforms.
30+
31+
A big "thanks!" for bringing this issue to us goes to our friends in
32+
the Mercurial land, namely, Matt Mackall and Augie Fackler.
33+
34+
Also contains typofixes, documentation updates and trivial code clean-ups.

Documentation/RelNotes/2.2.1.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Git v2.2.1 Release Notes
2+
========================
3+
4+
Fixes since v2.2
5+
----------------
6+
7+
* We used to allow committing a path ".Git/config" with Git that is
8+
running on a case sensitive filesystem, but an attempt to check out
9+
such a path with Git that runs on a case insensitive filesystem
10+
would have clobbered ".git/config", which is definitely not what
11+
the user would have expected. Git now prevents you from tracking
12+
a path with ".Git" (in any case combination) as a path component.
13+
14+
* On Windows, certain path components that are different from ".git"
15+
are mapped to ".git", e.g. "git~1/config" is treated as if it were
16+
".git/config". HFS+ has a similar issue, where certain unicode
17+
codepoints are ignored, e.g. ".g\u200cit/config" is treated as if
18+
it were ".git/config". Pathnames with these potential issues are
19+
rejected on the affected systems. Git on systems that are not
20+
affected by this issue (e.g. Linux) can also be configured to
21+
reject them to ensure cross platform interoperability of the hosted
22+
projects.
23+
24+
* "git fsck" notices a tree object that records such a path that can
25+
be confused with ".git", and with receive.fsckObjects configuration
26+
set to true, an attempt to "git push" such a tree object will be
27+
rejected. Such a path may not be a problem on a well behaving
28+
filesystem but in order to protect those on HFS+ and on case
29+
insensitive filesystems, this check is enabled on all platforms.
30+
31+
A big "thanks!" for bringing this issue to us goes to our friends in
32+
the Mercurial land, namely, Matt Mackall and Augie Fackler.
33+
34+
Also contains typofixes, documentation updates and trivial code clean-ups.

Documentation/config.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,17 @@ core.precomposeunicode::
246246
When false, file names are handled fully transparent by Git,
247247
which is backward compatible with older versions of Git.
248248

249+
core.protectHFS::
250+
If set to true, do not allow checkout of paths that would
251+
be considered equivalent to `.git` on an HFS+ filesystem.
252+
Defaults to `true` on Mac OS, and `false` elsewhere.
253+
254+
core.protectNTFS::
255+
If set to true, do not allow checkout of paths that would
256+
cause problems with the NTFS filesystem, e.g. conflict with
257+
8.3 "short" names.
258+
Defaults to `true` on Windows, and `false` elsewhere.
259+
249260
core.trustctime::
250261
If false, the ctime differences between the index and the
251262
working tree are ignored; useful when the inode change time

Documentation/git.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,40 +43,45 @@ unreleased) version of Git, that is available from the 'master'
4343
branch of the `git.git` repository.
4444
Documentation for older releases are available here:
4545

46-
* link:v2.2.0/git.html[documentation for release 2.2]
46+
* link:v2.2.1/git.html[documentation for release 2.2.1]
4747

4848
* release notes for
49+
link:RelNotes/2.2.1.txt[2.2.1],
4950
link:RelNotes/2.2.0.txt[2.2].
5051

51-
* link:v2.1.3/git.html[documentation for release 2.1.3]
52+
* link:v2.1.4/git.html[documentation for release 2.1.4]
5253

5354
* release notes for
55+
link:RelNotes/2.1.4.txt[2.1.4],
5456
link:RelNotes/2.1.3.txt[2.1.3],
5557
link:RelNotes/2.1.2.txt[2.1.2],
5658
link:RelNotes/2.1.1.txt[2.1.1],
5759
link:RelNotes/2.1.0.txt[2.1].
5860

59-
* link:v2.0.4/git.html[documentation for release 2.0.4]
61+
* link:v2.0.5/git.html[documentation for release 2.0.5]
6062

6163
* release notes for
64+
link:RelNotes/2.0.5.txt[2.0.5],
6265
link:RelNotes/2.0.4.txt[2.0.4],
6366
link:RelNotes/2.0.3.txt[2.0.3],
6467
link:RelNotes/2.0.2.txt[2.0.2],
6568
link:RelNotes/2.0.1.txt[2.0.1],
6669
link:RelNotes/2.0.0.txt[2.0.0].
6770

68-
* link:v1.9.4/git.html[documentation for release 1.9.4]
71+
* link:v1.9.5/git.html[documentation for release 1.9.5]
6972

7073
* release notes for
74+
link:RelNotes/1.9.5.txt[1.9.5],
7175
link:RelNotes/1.9.4.txt[1.9.4],
7276
link:RelNotes/1.9.3.txt[1.9.3],
7377
link:RelNotes/1.9.2.txt[1.9.2],
7478
link:RelNotes/1.9.1.txt[1.9.1],
7579
link:RelNotes/1.9.0.txt[1.9.0].
7680

77-
* link:v1.8.5.5/git.html[documentation for release 1.8.5.5]
81+
* link:v1.8.5.6/git.html[documentation for release 1.8.5.6]
7882

7983
* release notes for
84+
link:RelNotes/1.8.5.6.txt[1.8.5.6],
8085
link:RelNotes/1.8.5.5.txt[1.8.5.5],
8186
link:RelNotes/1.8.5.4.txt[1.8.5.4],
8287
link:RelNotes/1.8.5.3.txt[1.8.5.3],

cache.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,8 @@ extern int fsync_object_files;
617617
extern int core_preload_index;
618618
extern int core_apply_sparse_checkout;
619619
extern int precomposed_unicode;
620+
extern int protect_hfs;
621+
extern int protect_ntfs;
620622

621623
/*
622624
* The character that begins a commented line in user-editable file
@@ -831,6 +833,7 @@ int normalize_path_copy(char *dst, const char *src);
831833
int longest_ancestor_length(const char *path, struct string_list *prefixes);
832834
char *strip_path_suffix(const char *path, const char *suffix);
833835
int daemon_avoid_alias(const char *path);
836+
extern int is_ntfs_dotgit(const char *name);
834837

835838
/* object replacement */
836839
#define LOOKUP_REPLACE_OBJECT 1

config.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,16 @@ static int git_default_core_config(const char *var, const char *value)
896896
return 0;
897897
}
898898

899+
if (!strcmp(var, "core.protecthfs")) {
900+
protect_hfs = git_config_bool(var, value);
901+
return 0;
902+
}
903+
904+
if (!strcmp(var, "core.protectntfs")) {
905+
protect_ntfs = git_config_bool(var, value);
906+
return 0;
907+
}
908+
899909
/* Add other config variables here and to Documentation/config.txt. */
900910
return 0;
901911
}

config.mak.uname

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ ifeq ($(uname_S),Darwin)
105105
HAVE_DEV_TTY = YesPlease
106106
COMPAT_OBJS += compat/precompose_utf8.o
107107
BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
108+
BASIC_CFLAGS += -DPROTECT_HFS_DEFAULT=1
108109
endif
109110
ifeq ($(uname_S),SunOS)
110111
NEEDS_SOCKET = YesPlease
@@ -373,6 +374,7 @@ ifeq ($(uname_S),Windows)
373374
EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib invalidcontinue.obj
374375
PTHREAD_LIBS =
375376
lib =
377+
BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
376378
ifndef DEBUG
377379
BASIC_CFLAGS += -GL -Os -MD
378380
BASIC_LDFLAGS += -LTCG
@@ -514,6 +516,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
514516
COMPAT_OBJS += compat/mingw.o compat/winansi.o \
515517
compat/win32/pthread.o compat/win32/syslog.o \
516518
compat/win32/dirent.o
519+
BASIC_CFLAGS += -DPROTECT_NTFS_DEFAULT=1
517520
BASIC_LDFLAGS += -Wl,--large-address-aware
518521
EXTLIBS += -lws2_32
519522
GITLIBS += git.res

0 commit comments

Comments
 (0)