Rename core.unreliableHardlinks to core.createObject
"Unreliable hardlinks" is a misleading description for what is happening. So rename it to something less misleading. Suggested by Linus Torvalds. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Apr 28, 2009 at 00:32 UTC
348df16679cf35b7bba7afea99638e7d81dc3d33
6 files changed
+30
-16
Documentation/config.txt
+8
-4
@@ -429,10 +429,14 @@ relatively high IO latencies. With this set to 'true', git will do the
429
index comparison to the filesystem data in parallel, allowing
430
overlapping IO's.
431
432
-core.unreliableHardlinks::
433
- Some filesystem drivers cannot properly handle hardlinking a file
434
- and deleting the source right away. In such a case, you need to
435
- set this config variable to 'true'.
432
+core.createObject::
433
+ You can set this to 'link', in which case a hardlink followed by
434
+ a delete of the source are used to make sure that object creation
435
+ will not overwrite existing objects.
436
++
437
+On some file system/operating system combinations, this is unreliable.
438
+Set this config setting to 'rename' there; However, This will remove the
439
+check that makes sure that existing object files will not get overwritten.
440
441
alias.*::
442
Command aliases for the linkgit:git[1] command wrapper - e.g.
Makefile
+5
-5
@@ -172,8 +172,8 @@ all::
172
# information on a not yet closed file that lstat would return for the same
173
# file after it was closed.
174
#
175
-# Define UNRELIABLE_HARDLINKS if your operating systems has problems when
176
-# hardlinking a file to another name and unlinking the original file right
175
+# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
176
+# when hardlinking a file to another name and unlinking the original file right
177
# away (some NTFS drivers seem to zero the contents in that scenario).
178
179
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@@ -837,7 +837,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
837
NO_NSEC = YesPlease
838
USE_WIN32_MMAP = YesPlease
839
UNRELIABLE_FSTAT = UnfortunatelyYes
840
- UNRELIABLE_HARDLINKS = UnfortunatelySometimes
840
+ OBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo
841
COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
842
COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
843
COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
@@ -1021,8 +1021,8 @@ else
1021
COMPAT_OBJS += compat/win32mmap.o
1022
endif
1023
endif
1024
-ifdef UNRELIABLE_HARDLINKS
1025
- COMPAT_CFLAGS += -DUNRELIABLE_HARDLINKS=1
1024
+ifdef OBJECT_CREATION_USES_RENAMES
1025
+ COMPAT_CFLAGS += -DOBJECT_CREATION_MODE=1
1026
endif
1027
ifdef NO_PREAD
1028
COMPAT_CFLAGS += -DNO_PREAD
cache.h
+6
-1
@@ -554,7 +554,12 @@ extern enum branch_track git_branch_track;
554
extern enum rebase_setup_type autorebase;
555
extern enum push_default_type push_default;
556
557
-extern int unreliable_hardlinks;
557
+enum object_creation_mode {
558
+ OBJECT_CREATION_USES_HARDLINKS = 0,
559
+ OBJECT_CREATION_USES_RENAMES = 1,
560
+};
561
+
562
+extern enum object_creation_mode object_creation_mode;
563
564
#define GIT_REPO_VERSION 0
565
extern int repository_format_version;
config.c
+7
-2
@@ -495,8 +495,13 @@ static int git_default_core_config(const char *var, const char *value)
495
return 0;
496
}
497
498
- if (!strcmp(var, "core.unreliablehardlinks")) {
499
- unreliable_hardlinks = git_config_bool(var, value);
498
+ if (!strcmp(var, "core.createobject")) {
499
+ if (!strcmp(value, "rename"))
500
+ object_creation_mode = OBJECT_CREATION_USES_RENAMES;
501
+ else if (!strcmp(value, "link"))
502
+ object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
503
+ else
504
+ die("Invalid mode for object creation: %s", value);
505
return 0;
506
}
507
environment.c
+3
-3
@@ -43,10 +43,10 @@ unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
43
enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
44
enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
45
enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
46
-#ifndef UNRELIABLE_HARDLINKS
47
-#define UNRELIABLE_HARDLINKS 0
46
+#ifndef OBJECT_CREATION_MODE
47
+#define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
48
#endif
49
-int unreliable_hardlinks = UNRELIABLE_HARDLINKS;
49
+enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;
50
51
/* Parallel index stat data preload? */
52
int core_preload_index = 0;
sha1_file.c
+1
-1
@@ -2225,7 +2225,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
2225
{
2226
int ret = 0;
2227
2228
- if (unreliable_hardlinks)
2228
+ if (object_creation_mode == OBJECT_CREATION_USES_RENAMES)
2229
goto try_rename;
2230
else if (link(tmpfile, filename))
2231
ret = errno;