summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-05-09 02:48:47 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-05-09 02:48:47 (GMT)
commita0db0d61fbc447f13cb0aadf01c83eb193b22dc9 (patch)
tree900fc05999875ac255bb152a71f56f32b6672124 /git-gui.sh
parent3e45ee1ef268c73539903f89c737af89034d391f (diff)
downloadgit-a0db0d61fbc447f13cb0aadf01c83eb193b22dc9.zip
git-a0db0d61fbc447f13cb0aadf01c83eb193b22dc9.tar.gz
git-a0db0d61fbc447f13cb0aadf01c83eb193b22dc9.tar.bz2
git-gui: Generate blame on uncommitted working tree file
If the user doesn't give us a revision parameter to our blame subcommand then we can generate blame against the working tree file by passing the file path off to blame with the --contents argument. In this case we cannot obtain the contents of the file from the ODB; instead we must obtain the contents by reading the working directory file as-is. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh20
1 files changed, 12 insertions, 8 deletions
diff --git a/git-gui.sh b/git-gui.sh
index e90cdde..62b1a36 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1605,6 +1605,7 @@ browser {
}
blame {
set subcommand_args {rev? path?}
+ set head {}
set path {}
set is_path 0
foreach a $argv {
@@ -1614,27 +1615,30 @@ blame {
break
} elseif {$a eq {--}} {
if {$path ne {}} {
- if {$current_branch ne {}} usage
- set current_branch $path
+ if {$head ne {}} usage
+ set head $path
set path {}
}
set is_path 1
- } elseif {$current_branch eq {}} {
- if {$current_branch ne {}} usage
- set current_branch $a
+ } elseif {$head eq {}} {
+ if {$head ne {}} usage
+ set head $a
} else {
usage
}
}
unset is_path
- if {$current_branch eq {} && $path ne {}} {
+ if {$head eq {}} {
set current_branch [git symbolic-ref HEAD]
regsub ^refs/((heads|tags|remotes)/)? \
$current_branch {} current_branch
+ } else {
+ set current_branch $head
}
- if {$current_branch eq {} || $path eq {}} usage
- blame::new $current_branch $path
+
+ if {$path eq {}} usage
+ blame::new $head $path
return
}
citool -