unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* vc-git: workaround for "file unregistered" problem
@ 2009-11-12 13:44 David Reitter
  2009-11-12 15:39 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: David Reitter @ 2009-11-12 13:44 UTC (permalink / raw)
  To: Emacs development discussions

I've been having some problems with git:

In some circumstances, git fails to report the status of files and pretends they are unregistered.  One symptom can be that vc-git will try to add the file a second time.   I have inquired about this on the Git list [1], but received no response - I'm not sure if this is a bug in git.  

Either way, specifying full paths works around the problem, and the patch below does that for those who encounter similar issues.


[1] http://marc.info/?l=git&m=125787684318129&w=2


commit c1285a8335c943f319d1597c4332707b3291f967
Author: David Reitter <david.reitter@gmail.com>
Date:   Tue Nov 10 13:16:30 2009 -0500

    vc-git-registered: temporary workaround for a git not finding files
    git doesn't understand relative path specs in some situations

diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index cee3abe..3113c19 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -147,7 +147,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
   (when (vc-git-root file)
     (with-temp-buffer
       (let* (process-file-side-effects
-            (dir (file-name-directory file))
+            (dir (vc-git-root file))
              (name (file-relative-name file dir))
              (str (ignore-errors
                     (when dir (cd dir))



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: vc-git: workaround for "file unregistered" problem
  2009-11-12 13:44 vc-git: workaround for "file unregistered" problem David Reitter
@ 2009-11-12 15:39 ` Stefan Monnier
  2009-11-12 15:57   ` David Reitter
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2009-11-12 15:39 UTC (permalink / raw)
  To: David Reitter; +Cc: Emacs development discussions

> In some circumstances, git fails to report the status of files and
> pretends they are unregistered.  One symptom can be that vc-git will
> try to add the file a second time.   I have inquired about this on the
> Git list [1], but received no response - I'm not sure if this is a bug
> in git.

Can you report it as a bug?

> Either way, specifying full paths works around the problem, and the
> patch below does that for those who encounter similar issues.

It looks acceptable, exept that, like all patches which try to work
around a problem, it should come with a corresponding comment.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vc-git: workaround for "file unregistered" problem
  2009-11-12 15:39 ` Stefan Monnier
@ 2009-11-12 15:57   ` David Reitter
  2009-11-12 17:08     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: David Reitter @ 2009-11-12 15:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs development discussions

On Nov 12, 2009, at 10:39 AM, Stefan Monnier wrote:
>> Git list [1], but received no response - I'm not sure if this is a bug
>> in git.
> 
> Can you report it as a bug?

OK, let's see.  The git folks have been very responsive and helpful in the past.

>> Either way, specifying full paths works around the problem, and the
>> patch below does that for those who encounter similar issues.
> 
> It looks acceptable, exept that, like all patches which try to work
> around a problem, it should come with a corresponding comment.

If only I understood the underlying problem better!
I will try to do more research and check this in with an appropriate comment.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: vc-git: workaround for "file unregistered" problem
  2009-11-12 15:57   ` David Reitter
@ 2009-11-12 17:08     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2009-11-12 17:08 UTC (permalink / raw)
  To: David Reitter; +Cc: Emacs development discussions

>>> Either way, specifying full paths works around the problem, and the
>>> patch below does that for those who encounter similar issues.
>> It looks acceptable, exept that, like all patches which try to work
>> around a problem, it should come with a corresponding comment.
> If only I understood the underlying problem better!
> I will try to do more research and check this in with an appropriate comment.

The comment doesn't need to explain the problem, but it needs to explain
why the code is written the way it is (e.g. "because if we use
a relative name Git seems to sometimes return incorrect data", ideally
even with a reference to the Git bug report).


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-12 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 13:44 vc-git: workaround for "file unregistered" problem David Reitter
2009-11-12 15:39 ` Stefan Monnier
2009-11-12 15:57   ` David Reitter
2009-11-12 17:08     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).