git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] difftool: chdir as early as possible

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 9, 2016, 23:02 UTC
Message-ID
<xmqqbmwkr9ji.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161209085848.10929-2-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 11 quoted lines
> @@ -182,10 +188,6 @@ EOF
>  		}
>  	}
>  
> -	# Go to the root of the worktree so that the left index files
> -	# are properly setup -- the index is toplevel-relative.
> -	chdir($workdir);
> -
>  	# Setup temp directories
>  	my $tmpdir = tempdir('git-difftool.XXXXX', CLEANUP => 0, TMPDIR => 1);
>  	my $ldir = "$tmpdir/left";

What codebase are you basing your work on? I do not see these removed four lines in my tree, so it seems that the patch is fixing up some other fix I do not yet have.

Show 26 quoted lines
> @@ -235,10 +237,10 @@ EOF
>  			symlink("$workdir/$file", "$rdir/$file") or
>  			exit_cleanup($tmpdir, 1);
>  		} else {
> -			copy("$workdir/$file", "$rdir/$file") or
> +			copy($file, "$rdir/$file") or
>  			exit_cleanup($tmpdir, 1);
>  
> -			my $mode = stat("$workdir/$file")->mode;
> +			my $mode = stat($file)->mode;
>  			chmod($mode, "$rdir/$file") or
>  			exit_cleanup($tmpdir, 1);
>  		}
> @@ -430,10 +432,10 @@ sub dir_diff
>  			$error = 1;
>  		} elsif (exists $tmp_modified{$file}) {
>  			my $mode = stat("$b/$file")->mode;
> -			copy("$b/$file", "$workdir/$file") or
> +			copy("$b/$file", $file) or
>  			exit_cleanup($tmpdir, 1);
>  
> -			chmod($mode, "$workdir/$file") or
> +			chmod($mode, $file) or
>  			exit_cleanup($tmpdir, 1);
>  		}
>  	}
Previous: David AguilarNext: David Aguilar
Message 4 of 5 in “difftool: sanitize $workdir as early as possible”
  1. 1/3 difftool: sanitize $workdir as early as possibleDavid Aguilar, Dec 9, 2016
  2. 3/3 difftool: rename variables for consistencyDavid Aguilar, Dec 9, 2016
  3. 2/3 difftool: chdir as early as possibleDavid Aguilar, Dec 9, 2016
  4. Junio C HamanoDec 9, 2016
  5. David AguilarDec 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.