Tighten up some equality checks

This commit is contained in:
Tim Pope 2010-01-09 17:35:27 -05:00
parent 969ba4f3bc
commit 93bd4c8944

View File

@ -675,7 +675,7 @@ function! s:Write(force,...) abort
let file = s:repo().translate(path) let file = s:repo().translate(path)
let treebufnr = 0 let treebufnr = 0
for nr in range(1,bufnr('$')) for nr in range(1,bufnr('$'))
if fnamemodify(bufname(nr),':p') == file if fnamemodify(bufname(nr),':p') ==# file
let treebufnr = nr let treebufnr = nr
endif endif
endfor endfor
@ -720,7 +720,7 @@ function! s:Write(force,...) abort
let v:errmsg = 'fugitive: '.error let v:errmsg = 'fugitive: '.error
return 'echoerr v:errmsg' return 'echoerr v:errmsg'
endif endif
if s:buffer().path() == path && s:buffer().commit() =~# '^\d$' if s:buffer().path() ==# path && s:buffer().commit() =~# '^\d$'
set nomodified set nomodified
endif endif
@ -830,7 +830,7 @@ function! s:Move(force,destination)
let destination = a:destination[1:-1] let destination = a:destination[1:-1]
else else
let destination = fnamemodify(s:sub(a:destination,'[%#]%(:\w)*','\=expand(submatch(0))'),':p') let destination = fnamemodify(s:sub(a:destination,'[%#]%(:\w)*','\=expand(submatch(0))'),':p')
if destination[0:strlen(s:repo().tree())] == s:repo().tree('') if destination[0:strlen(s:repo().tree())] ==# s:repo().tree('')
let destination = destination[strlen(s:repo().tree('')):-1] let destination = destination[strlen(s:repo().tree('')):-1]
endif endif
endif endif
@ -1176,7 +1176,7 @@ function! s:BufReadObject()
else else
call s:ReplaceCmd(s:repo().git_command('show','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash)) call s:ReplaceCmd(s:repo().git_command('show','--pretty=format:tree %T%nparent %P%nauthor %an <%ae> %ad%ncommitter %cn <%ce> %cd%nencoding %e%n%n%s%n%n%b',hash))
call search('^parent ') call search('^parent ')
if getline('.') == 'parent ' if getline('.') ==# 'parent '
silent delete_ silent delete_
else else
silent s/\%(^parent\)\@<! /\rparent /ge silent s/\%(^parent\)\@<! /\rparent /ge
@ -1352,7 +1352,7 @@ function! s:GF(mode) abort
endif endif
endif endif
if ref == '/dev/null' if ref ==# '/dev/null'
" Empty blob " Empty blob
let ref = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391' let ref = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
endif endif