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

Re: [PATCH 7/9] difftool: teach difftool to handle directory diffs

From
Tim Henigan <tim.henigan@gmail.com>
Date
Mar 20, 2012, 20:17 UTC
Message-ID
<CAFouethvGQD3RR_Lcu6GFA3pRS7_7nQC77g7coxOBDBP4ATP6A@mail.gmail.com>
In-Reply-To
<7vlimv5del.fsf@alter.siamese.dyndns.org>
On Tue, Mar 20, 2012 at 2:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> Tim Henigan <tim.henigan@gmail.com> writes:
>
>> However, when 'difftool --dir-diff' is run from a subdirectory of the
>> Git repository, there are problems.
>>   - The temporary index file generated by 'git update-index' appears
>> to be correct.
>>   - 'git checkout-index --all --prefix=$tmp' command does not work
>> (output tmp dir is empty).
>
> Hrmph.
>
> $ rm -fr /tmp/xyz
> $ cd Documentation
> $ git checkout-index --all --prefix=/tmp/xyz/
> $ ls -F /tmp/xyz
> Documentation/
> $ rm -fr /tmp/xyz
> $ GIT_DIR=$(pwd)/../.git GIT_WORK_TREE=$(pwd) \
>  git checkout-index --all --prefix=/tmp/xyz/
> $ ls -FC /tmp/xyz | head -2
> abspath.c                   git-merge-octopus.sh*       reflog-walk.c
> aclocal.m4                  git-merge-one-file.sh*      reflog-walk.h
>
> Be sure to have the trailing slash in $tmp.

It turns out that 'Git::command_oneline()' does not honor environment variables set prior to calling the function.

This change fixed the problem:
- $repo->command_oneline(["checkout-index", "-a", "--prefix=$ldir/"]);
+ $ENV{GIT_DIR} = $repo->repo_path();
+ system(('git', 'checkout-index', '-a', "--prefix=$ldir/"));
I'm still testing, but will submit an updated patch soon.
Previous: Junio C Hamano
Message 8 of 8 in “difftool: teach difftool to handle directory diffs”
  1. 7/9 difftool: teach difftool to handle directory diffsTim Henigan, Mar 17, 2012
  2. David AguilarMar 17, 2012
  3. Tim HeniganMar 17, 2012
  4. Jakub NarebskiMar 17, 2012
  5. Tim HeniganMar 18, 2012
  6. Tim HeniganMar 20, 2012
  7. Junio C HamanoMar 20, 2012
  8. Tim HeniganMar 20, 2012

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.