emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VC mode and git


From: Eli Zaretskii
Subject: Re: VC mode and git
Date: Sun, 05 Apr 2015 11:57:07 +0300

> From: "Stephen J. Turnbull" <address@hidden>
> Cc: address@hidden,
>     address@hidden
> Date: Sun, 05 Apr 2015 17:31:53 +0900
> 
>  >     I committed some changes using C-x v v in vc-dir.
>  >     Something went wrong with lisp/ChangeLog.
>  > 
>  >     It appears that my change log entries went into an old version of that
>  >     file; I don't know why this happened, since I wrote them today after
>  >     doing 'git pull'.
> 
> OK, so I interpreted this as
> 
> 1. Hack the "some changes" mentioned above.
> 2. Git pull successfully, implying the files changed in Richard's
>    workspace but (I assume) not committed did not conflict.
> 3. Edit ChangeLog and C-x v v to commit, successfully.
> 
>    But some log messages were missing.

Which ones?  I'm afraid I'm not following you in this part.

>  >     After this, I did 'git pull' again, and it said there was a merge
>  >     conflict in lisp/ChangeLpg.  A lot of text appears to be missing from
>  >     the file.  It said, "fix conflicts and then commit the result."
> 
> If the previous pull succeeded, does this mean that he lost a race in
> a handful of minutes?  And lost "a lot" of text?  Weird.

One possibility is a merge from emacs-24, which can potentially bring
quite a few commits from the release branch, and is done by a program,
so it can be very fast.  Look at the long list of the modified files
that are staged, which the pull succeeded to merge -- they do suggest
a lot of changes were fetched.

>  > The second error message, viz.:
>  > 
>  >   fatal: cannot do a partial commit during a merge.
>  > 
>  > is because "C-x v v" invokes "git commit --only lisp/ChangeLog", which
>  > AFAIR always fails in this situation, for the reason hinted by the
>  > error message.
> 
> Aha!  But "git commit --include lisp/ChangeLog" DTRTs in this case,
> committing the staged changes from the files successfully merged as
> well as the new changes from the files where conflicts were resolved.
> (Tested in a toy repo.)
> 
> In other words, *Emacs* screwed Richard, not git.

Yes, basically.  More accurately, too rudimentary support in VC for
Git and the "popular" problems that need to be resolved with it.

>  > Yes, something like that.  In fact, I think the root cause of the
>  > original problem was that "C-x v v", which tried to commit a single
>  > file in the middle of a merge.  Instead, the correct action is either
>  > 'v' from vc-dir or "git commit" from the shell prompt.
> 
> I don't think "git commit" will actually work.  "git commit" alone
> will either commit only the unconflicted staged files (I think this
> unlikely) or will refuse to commit because it remembers that ChangeLog
> was conflicted (more likely).  You need to "git add lisp/ChangeLog",

Saving a file after resolving all of its conflicts automatically runs
"git add" for that file in Emacs's VC, so it is already staged.

So yes, "git commit" should have worked.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]