diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-08-24 23:15:50 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-08-24 23:15:50 -0400 |
commit | c80d25dbce759a8483ffc1f085fdf4cd63cf9f05 (patch) | |
tree | 16a959d00646f6c200220e674d3dd5d2e7cea05c /lib/branch_rename.tcl | |
parent | git-gui: Do not offer to stage three-way diff hunks into the index (diff) | |
download | tgif-c80d25dbce759a8483ffc1f085fdf4cd63cf9f05.tar.xz |
git-gui: Correct 'git gui blame' in a subdirectory
David Kastrup pointed out that the following sequence was not
working as we had intended:
$ cd lib
$ git gui blame console.tcl
fatal: cannot stat path lib/console.tcl: No such file or directory
The problem here was we disabled the chdir to the root of the
working tree when we are running with a "bare allowed" feature
such as blame or browser, but we still kept the prefix we found via
`git rev-parse --show-prefix`. This caused us to try and look for
the file "console.tcl" within the subdirectory but also include
the subdirectory's own path from the root of the working tree.
This is unlikely to succeed, unless the user just happened to have
a "lib/lib/console.tcl" file in the repository, in which case we
would produce the wrong result.
In the case of a bare repository we shouldn't get back a value from
`rev-parse --show-prefix`, so really $_prefix should only be set
to the non-empty string if we are in a working tree and we are in a
subdirectory of that working tree. If this is true we really want
to always be at the top level of the working tree, as all paths are
accessed as though they were relative to the top of the working tree.
Converting $_prefix to a ../ sequence is a fairly simple approach
to moving up the requisite levels.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/branch_rename.tcl')
0 files changed, 0 insertions, 0 deletions