git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "David Tweed" <david.tweed@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Git Mailing List" <git@vger.kernel.org>
Subject: Re: behaviour of git diff, GIT_DIR & checked out tree
Date: Mon, 24 Sep 2007 18:09:20 +0100	[thread overview]
Message-ID: <e1dab3980709241009q71f9a40r1f8b551b417f7475@mail.gmail.com> (raw)
In-Reply-To: <7v6420au43.fsf@gitster.siamese.dyndns.org>

On 9/24/07, Junio C Hamano <gitster@pobox.com> wrote:
> It would be illustrative if David did the following.
>
>         $ cd $HOME
>         $ cp -a V W
>         $ rm -fr W/.git
>         $ cd W
>         $ GIT_DIR=$HOME/V/.git git diff @{midnight}
>
> Now we are in a random place outside of the work tree
> (i.e. "W"), and we drive "git diff" with GIT_DIR specified,
> telling it to pretend that we are at the top level of the work
> tree.  So ~/W/frotz is compared with "frotz" at the top level of
> the commit (which usually is compared with ~/V/frotz), etc.  But
> the directory we happen to be in very much resembles the work
> tree, so it would give identical results to
>
>         $ cd $HOME/V
>         $ git diff @{midnight}

To separate the two issues, I did all the commands to the diff
above and then removed one directory from the tree in W.

GIT_DIR=$HOME/V/.git git diff master~1
(which ought not need reflogs, right) and it gave a diff between
the contents of W and master~1. I also tried with commit
master@{midnight} and that also gave the difference between
W and the last commit yesterday. So Junio's explanation of what's going on
is right. I'm just asking if there's a way to say
"the `working dir' associated with this git dir" explicitly (in the same
way I can use `HEAD' to refer to the topmost commit on the
current branch) when you're not somewhere within the 'working dir'.
If there's not I can alias around it with
"cd $HOME/V && command && cd -". (As I say, for reasons unrelated
to git usage I don't actually "do work" within the tracked tree.)

Many thanks,

-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"we had no idea that when we added templates we were adding a Turing-
complete compile-time language." -- C++ standardisation committee

  reply	other threads:[~2007-09-24 17:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 12:45 behaviour of git diff, GIT_DIR & checked out tree David Tweed
2007-09-24 13:03 ` Johannes Schindelin
2007-09-24 13:16   ` David Tweed
2007-09-24 16:47   ` Junio C Hamano
2007-09-24 17:09     ` David Tweed [this message]
2007-09-24 18:31       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1dab3980709241009q71f9a40r1f8b551b417f7475@mail.gmail.com \
    --to=david.tweed@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).