Subject: Re: [PATCH] Rename core.unreliableHardlinks to core.createObject

From: Junio C Hamano <[email-masked]>
Date: Mon, 27 Apr 2009 16:48:13 -0700

Johannes Schindelin <[email-masked]> writes:

> diff --git a/Makefile b/Makefile
> index 5c8e83a..9ca1826 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -172,8 +172,8 @@ all::
>  # information on a not yet closed file that lstat would return for the same
>  # file after it was closed.
>  #
> -# Define UNRELIABLE_HARDLINKS if your operating systems has problems when
> -# hardlinking a file to another name and unlinking the original file right
> +# Define OBJECT_CREATION_USES_RENAMES if your operating systems has problems
> +# when hardlinking a file to another name and unlinking the original file right

With the configuration variable for this relatively obscure feature in
place, I wonder if we can simply get rid of the hardcoded compilation
preference.  After all, even on your eeepc, I presume that you have some
filesystems in native format where you do not have the breakages, and some
others mounted with unfsd breakage.  When diagnosing a possible issue on
somebody else's box, having to look into .git/config to see which codepath
is used is bad enough, but it is even worse to have a default that can be
different with compilation switch.

It would essentially boil down to this hunk; instead of introducing
OBJECT_CREATION_MODE, we default to hardlinks, and let the configuration
override it (and do nothing else).

> diff --git a/environment.c b/environment.c
> index 10578d2..801a005 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -43,10 +43,10 @@ unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
>  enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
>  enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
>  enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
> -#ifndef UNRELIABLE_HARDLINKS
> -#define UNRELIABLE_HARDLINKS 0
> +#ifndef OBJECT_CREATION_MODE
> +#define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS
>  #endif
> -int unreliable_hardlinks = UNRELIABLE_HARDLINKS;
> +enum object_creation_mode object_creation_mode = OBJECT_CREATION_MODE;