Re: [PATCH] Create a symbolic link as a regular file on filesystems without symlinks.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Tue, 27 Feb 2007, Johannes Sixt wrote:

> diff --git a/builtin-apply.c b/builtin-apply.c
> index bec95d6..1636807 100644
> --- a/builtin-apply.c
> +++ b/builtin-apply.c
> @@ -2284,7 +2284,7 @@ static int try_create_file(const char *path, unsigned int mode, const char *buf,
>  {
>  	int fd;
>  
> -	if (S_ISLNK(mode))
> +	if (trust_symlink_fmt && S_ISLNK(mode))

First of all why "_fmt"? I would have called it "trust_symlinks".

> diff --git a/entry.c b/entry.c
> index c2641dd..3d5c0e4 100644
> --- a/entry.c
> +++ b/entry.c
> @@ -100,6 +100,11 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
>  		if (to_tempfile) {
>  			strcpy(path, ".merge_link_XXXXXX");
>  			fd = mkstemp(path);
> +		} else if (!trust_symlink_fmt) {
> +			/* write a regular file */
> +			fd = create_file(path, 0666);
> +		}
> +		if (to_tempfile || !trust_symlink_fmt) {

Wouldn't this be better:

-  		if (to_tempfile) {
-  			strcpy(path, ".merge_link_XXXXXX");
-  			fd = mkstemp(path);
+  		if (to_tempfile || !trusk_symlink_fmt) {
+			if (to_tempfile) {
+	  			strcpy(path, ".merge_link_XXXXXX");
+				fd = mkstemp(path);
+			} else
+				fd = create_file(path, 0666);

Hmm?

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]