From: David Tweed <hidden> Date: 2016-06-15 22:43:36
I'm doing something "sensible people don't do"
-- I know this -- but I'm getting results I don't
understand, so I'd appreciate any insight.
In a git tracked tree rooted at $HOME/V with
git-dir of $HOME/V/.git, if I'm in $HOME/V then
git diff master@{midnight}
tells me the difference between the current modified files
in the tree being tracked in V and the specified commit. In
a different directory, OUTSIDE of $HOME/V, I tried
env GIT_DIR=$HOME/V/.git git diff master@{midnight}
to get the same effect but, whilst I do get a diff output, it
looks like a diff of the commit against an empty tree. (Using
env GIT_DIR=$HOME/V/.git git diff HEAD master@{midnight}
works ok.) I suppose I could alias it to
cd $HOME/V && command && cd -
but that seems a bit clunky; is there another way to explicitly
say "working tree for repo with this GIT_DIR" to git diff?
[Why I'm doing this: I actually work on files in the $HOME/V
via various other directories containing symlinks to the basic
files (with tracked files being pointed to by multiple symlinks).
So I'm almost never actually "in" the tracked tree. This
usage makes more sense for my tasks than being within
the work tree.]
--
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
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:43:36
Hi,
On Mon, 24 Sep 2007, David Tweed wrote:
In a git tracked tree rooted at $HOME/V with
git-dir of $HOME/V/.git, if I'm in $HOME/V then
git diff master@{midnight}
tells me the difference between the current modified files
in the tree being tracked in V and the specified commit. In
a different directory, OUTSIDE of $HOME/V, I tried
env GIT_DIR=$HOME/V/.git git diff master@{midnight}
to get the same effect but, whilst I do get a diff output, it
looks like a diff of the commit against an empty tree.
Yes, this is fully expected.
The @{time} notation accesses the _reflogs_, which are purely local
beasts. They are not transmitted when cloning.
The rationale: in a distributed environment, you cannot trust others'
timestamps. Therefore we don't.
We can only (to a certain extent, at least) trust our _own_ timestamp.
That is why we have timestamp access to the reflogs (which are purely
local, as I mentioned above), but we have no way to reference commits by
timestamp otherwise.
Hth,
Dscho
From: David Tweed <hidden> Date: 2016-06-15 22:43:36
On 9/24/07, Johannes Schindelin [off-list ref] wrote:
Yes, this is fully expected.
The @{time} notation accesses the _reflogs_, which are purely local
beasts. They are not transmitted when cloning.
Thanks of your reply; however I suspect this isn't the problem
here since I just tried with just master and I get the same thing.
To be clear, I'm doing this on the same machine with the same
user account as the git directory, just from a directory outside
the git tree, eg, the git tracked tree is in $HOME/V and I'm
in $HOME/A running
env GIT_DIR=$HOME/V/.git git diff master
As a guess without looking at the code, what I imagine
is happening is that git diff limits showing changes to the directory
tree below $PWD, and when $PWD isn't actually within the git
dir that ends up somehow as an empty tree.
--
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