Bug 17153 - doesn't commit newly created files
Summary: doesn't commit newly created files
Status: CLOSED WONTFIX
Alias: None
Product: Sisyphus
Classification: Development
Component: emacs-git (show other bugs)
Version: unstable
Hardware: all Linux
: P2 enhancement
Assignee: Evgenii Terechkov
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-17 00:11 MSD by Ivan Zakharyaschev
Modified: 2009-01-25 09:18 MSK (History)
0 users

See Also:


Attachments
vc-git.el warn patch (558 bytes, patch)
2008-09-17 20:23 MSD, Evgenii Terechkov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2008-09-17 00:11:09 MSD
emacs-git-1.5.6.5-alt2

If one creates a file, and uses C-x v v, the file is not committed (although it is added to the index). Another bad consequence of this is that the commit message is lost (and one might have been carefully typing it during C-x v v).

In the example session below, I first (1) just use git to commit a new file "a", and it works, then (2) I try to do the same for a new file "b" by means of Emacs, and it fails, then (3) I show that Emacs works for already registered files (I commit a change to "a" by means of Emacs).

[ivan@dell vc]$ mkdir test-emacs-git
[ivan@dell vc]$ cd test-emacs-git/
[ivan@dell test-emacs-git]$ git init
Initialized empty Git repository in /space/ivan/OUT/bugreports/ALT/vc/test-emacs-git/.git/
[ivan@dell test-emacs-git]$ git-show-branch 
No revs to be shown.
[ivan@dell test-emacs-git]$ echo a > a # (1): I create a new file and commit it.
[ivan@dell test-emacs-git]$ git add a
[ivan@dell test-emacs-git]$ git commit
Created initial commit 5d32cd8: Created a.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
[ivan@dell test-emacs-git]$ git-show-branch 
[master] Created a.
[ivan@dell test-emacs-git]$ emacs b # (2): I create a new file and commit by pressing "C-x v v" in Emacs. No success:
[ivan@dell test-emacs-git]$ git-show-branch 
[master] Created a.
[ivan@dell test-emacs-git]$ git --no-pager status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   b
#
[ivan@dell test-emacs-git]$ cat .git/COMMIT_EDITMSG # The new commit message is also lost.
Created a.
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#	new file: a
#
[ivan@dell test-emacs-git]$ cat .git/COMMIT_EDITMSG~

# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#	new file: a
#
[ivan@dell test-emacs-git]$ emacs a # (3): I modify the file and commit it by pressing "C-x v v" in Emacs. Successfully:
[ivan@dell test-emacs-git]$ git-show-branch 
[master] Modified a.
[ivan@dell test-emacs-git]$ git --no-pager status # Emacs circumvents index, so "b" is still uncomitted and in the index.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   b
#
[ivan@dell test-emacs-git]$ 

Expected behavior: 

Emacs should actually commit new files just like it does for modified files.

Another possibility could be to accept the convention that Emacs doesn't commit new files, but rather adds them to the index. But then the useless request for the commit message should be eliminated in Emacs (the commit message is lost in this case now).
Comment 1 Ivan Zakharyaschev 2008-09-17 00:31:17 MSD
I see. The reason for my problem (that Emacs asked the commit message, and I had the impression that it was going to commit the file because of this request) was that I changed the value of `vc-initial-comment' variable in Emacs:

vc-initial-comment's value is t

Documentation:
*If non-nil, prompt for initial comment when a file is registered.


This behavior made some sense for RCS; RCS accepted a comment upon registering a new file, which was interpreted as a "descriptive text" -- from "man ci":

If  the RCS file does not exist, ci creates it and deposits the contents of the working file as the initial revision (default num-
       ber: 1.1).  The access list is initialized to empty.  Instead of the log message, ci requests descriptive text (see -t below).

but it turns out, it makes no sense for git.

So, this is not a bug report, but a feature request: warn in this situation (when vc-initial-comment is on; or, equivalently, when a comment is passed to `vc-git-register') that the comment will be thrown away.
Comment 2 Ivan Zakharyaschev 2008-09-17 00:36:37 MSD
In order to notify the developers actually interested in emacs-git, I'm reassigning the report.

But I think the priority of this thing is very low, so just close it, if you are not interested.
Comment 3 Evgenii Terechkov 2008-09-17 20:23:57 MSD
Created attachment 2919 [details]
vc-git.el warn patch

Простой патч. Делает то, что и требовалось - если при регистраций нам дают комментарий - пишет что коментарий потеряется, т.к. git не поддерживает.

Но вообще vc-git.el всё равно действует "внутри" обёртки vc.el. Вот и в данном случае - vc.el до и после действий vc-git.el пишет свой сообщения, что сводит пользу патча почти на нет - мало кто догадается по такому случаю заглянуть в "*Messages*".

Ещё уточним, что хотелось или хватит? Кстати заранее сообщаю, что общаться с апстримом vc-git.el мне здоровья не хватит.
Comment 4 Evgenii Terechkov 2009-01-25 09:17:19 MSK
Посмотрел ещё раз. В общем, там адъ и погибель, всё плохо и надеяться неначто (кроме самого себя) :-)