<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,6 @@ Bugs
 * After exiting (:q) a buffer that has diff enabled, subsequent diffs appear to fail.
 * Should restore options like 'wrap' to their original state when turning diff off
 * winsaveview() and winrestview() require Vim 7.x. Autodetect and degrade gracefully.
-* Look for SCM directories based on path of file in current buffer, not on getcwd()
 
 Features
 </diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -40,30 +40,30 @@ endfunction
 function! s:detectSCM()
 
     &quot; Cache the results we find here to save time
-    if exists(&quot;g:scmCWD&quot;) &amp;&amp; g:scmCWD == getcwd() &amp;&amp; exists(&quot;g:scmDiffCommand&quot;)
+    if exists(&quot;g:scmBufPath&quot;) &amp;&amp; g:scmBufPath == expand(&quot;%:p:h&quot;) &amp;&amp; exists(&quot;g:scmDiffCommand&quot;)
         return
     endif
-    let g:scmCWD = getcwd()
+    let g:scmBufPath = expand(&quot;%:p:h&quot;)
 
     &quot; Detect CVS or .svn directories in current path
-    if !exists(&quot;g:scmDiffCommand&quot;) &amp;&amp; isdirectory(g:scmCWD.&quot;/.svn&quot;)
+    if !exists(&quot;g:scmDiffCommand&quot;) &amp;&amp; isdirectory(g:scmBufPath.&quot;/.svn&quot;)
         let g:scmDiffCommand = &quot;svn&quot;
         return
     endif
 
-    if !exists(&quot;g:scmDiffCommand&quot;) &amp;&amp; isdirectory(g:scmCWD.&quot;/CVS&quot;)
+    if !exists(&quot;g:scmDiffCommand&quot;) &amp;&amp; isdirectory(g:scmBufPath.&quot;/CVS&quot;)
         let g:scmDiffCommand = &quot;cvs&quot;
         return
     endif
 
     &quot; Detect .git directories recursively in reverse
-    let my_cwd = g:scmCWD
-    while my_cwd != &quot;/&quot;
-        if !exists(&quot;g:scmDiffCommand&quot;) &amp;&amp; isdirectory(my_cwd.&quot;/.git&quot;)
+    let my_path = g:scmBufPath
+    while my_path != &quot;/&quot;
+        if !exists(&quot;g:scmDiffCommand&quot;) &amp;&amp; isdirectory(my_path.&quot;/.git&quot;)
             let g:scmDiffCommand = &quot;git&quot;
             return
         endif
-        let my_cwd = simplify(my_cwd.&quot;/../&quot;)
+        let my_path = simplify(my_path.&quot;/../&quot;)
     endwhile
 
 endfunction
@@ -98,7 +98,7 @@ function! s:scmDiff(...)
     let cmd = 'cat ' . bufname('%') . ' &gt; ' . b:scmDiffTmpfile
     let cmdOutput = system(cmd)
     let tmpdiff = tempname()
-    let cmd = g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . bufname('%') . ' &gt; ' . tmpdiff
+    let cmd = 'cd ' . g:scmBufPath . ' &amp;&amp; ' . g:scmDiffCommand . ' diff ' . g:scmDiffRev . ' ' . expand('%:p') . ' &gt; ' . tmpdiff
     let cmdOutput = system(cmd)
 
     if v:shell_error &amp;&amp; cmdOutput != ''</diff>
      <filename>scmdiff.vim</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f0d9b81b5e6f3ea08691873166cb85a7dd2cc516</id>
    </parent>
  </parents>
  <author>
    <name>Brian Shire</name>
    <email>shire@shirebook.local</email>
  </author>
  <url>http://github.com/ghewgill/vim-scmdiff/commit/fdef9196e9e65ade1f6cc737512173fb9254fa55</url>
  <id>fdef9196e9e65ade1f6cc737512173fb9254fa55</id>
  <committed-date>2008-08-17T17:46:36-07:00</committed-date>
  <authored-date>2008-08-17T17:46:36-07:00</authored-date>
  <message>Look for SCM directories based on path of file in current buffer, not on getcwd()  (nice catch Greg)</message>
  <tree>7777cc415bb2da256a2975c0f111553c84480740</tree>
  <committer>
    <name>Brian Shire</name>
    <email>shire@shirebook.local</email>
  </committer>
</commit>
