* How to commit removed file?
@ 2006-12-31 10:24 Michael S. Tsirkin
2006-12-31 15:06 ` Johannes Schindelin
2007-01-02 20:10 ` Michael S. Tsirkin
0 siblings, 2 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2006-12-31 10:24 UTC (permalink / raw)
To: git
I'd like to remove a file and commit the removal while
leaving out other changes in repository/index.
$git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
$ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match
any file(s) known to git.
Did you forget to 'git add'?
A similiar thing works with "git add".
--
MST
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2006-12-31 10:24 How to commit removed file? Michael S. Tsirkin
@ 2006-12-31 15:06 ` Johannes Schindelin
2007-01-02 20:10 ` Michael S. Tsirkin
1 sibling, 0 replies; 16+ messages in thread
From: Johannes Schindelin @ 2006-12-31 15:06 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: git
Hi,
just a guess: putting "--" before the name of the removed file should
work, no?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2006-12-31 10:24 How to commit removed file? Michael S. Tsirkin
2006-12-31 15:06 ` Johannes Schindelin
@ 2007-01-02 20:10 ` Michael S. Tsirkin
2007-01-02 21:12 ` Johannes Schindelin
1 sibling, 1 reply; 16+ messages in thread
From: Michael S. Tsirkin @ 2007-01-02 20:10 UTC (permalink / raw)
To: git, Junio C Hamano
> I'd like to remove a file and commit the removal while
> leaving out other changes in repository/index.
>
> $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
> rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
>
> $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match
> any file(s) known to git.
> Did you forget to 'git add'?
>
> A similiar thing works with "git add".
Any ideas? Can this be done with git?
--
MST
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 20:10 ` Michael S. Tsirkin
@ 2007-01-02 21:12 ` Johannes Schindelin
2007-01-02 21:40 ` Junio C Hamano
2007-01-02 21:49 ` Juergen Ruehle
0 siblings, 2 replies; 16+ messages in thread
From: Johannes Schindelin @ 2007-01-02 21:12 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: git
Hi,
On Tue, 2 Jan 2007, Michael S. Tsirkin wrote:
> > I'd like to remove a file and commit the removal while
> > leaving out other changes in repository/index.
> >
> > $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
> > rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
> >
> > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> > error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match
> > any file(s) known to git.
> > Did you forget to 'git add'?
> >
> > A similiar thing works with "git add".
>
> Any ideas? Can this be done with git?
Did you actually try the "--" thing I suggested in
http://article.gmane.org/gmane.comp.version-control.git/35699/?
Besides, I just tested with current "next":
$ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
Created commit 89a5bb5ac16fb8be9b6e061284e191cafb3e4da2
1 files changed, 0 insertions(+), 22 deletions(-)
delete mode 100644 a234
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 21:12 ` Johannes Schindelin
@ 2007-01-02 21:40 ` Junio C Hamano
2007-01-02 22:13 ` Jakub Narebski
` (3 more replies)
2007-01-02 21:49 ` Juergen Ruehle
1 sibling, 4 replies; 16+ messages in thread
From: Junio C Hamano @ 2007-01-02 21:40 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Michael S. Tsirkin
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Tue, 2 Jan 2007, Michael S. Tsirkin wrote:
>
>> > I'd like to remove a file and commit the removal while
>> > leaving out other changes in repository/index.
>> >
>> > $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
>> > rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
>> >
>> > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
>> > error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match
>> > any file(s) known to git.
>> > Did you forget to 'git add'?
>> >
>> > A similiar thing works with "git add".
>>
>> Any ideas? Can this be done with git?
>
> Did you actually try the "--" thing I suggested in
> http://article.gmane.org/gmane.comp.version-control.git/35699/?
>
> Besides, I just tested with current "next":
>
> $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> Created commit 89a5bb5ac16fb8be9b6e061284e191cafb3e4da2
> 1 files changed, 0 insertions(+), 22 deletions(-)
> delete mode 100644 a234
The difference is Michael did "git rm" to explicitly tell git to
forget about that path, while you used the vanilla "/bin/rm".
Personally I never saw the point of having "git rm". Maybe we
should remove it to prevent this confusion from happening.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 21:12 ` Johannes Schindelin
2007-01-02 21:40 ` Junio C Hamano
@ 2007-01-02 21:49 ` Juergen Ruehle
1 sibling, 0 replies; 16+ messages in thread
From: Juergen Ruehle @ 2007-01-02 21:49 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Michael S. Tsirkin, git
Johannes Schindelin writes:
> On Tue, 2 Jan 2007, Michael S. Tsirkin wrote:
>
> > > I'd like to remove a file and commit the removal while
> > > leaving out other changes in repository/index.
> > >
> > > $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
> > > rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
> > >
> > > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> > > error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match
> > > any file(s) known to git.
> > > Did you forget to 'git add'?
> > >
> > > A similiar thing works with "git add".
> >
> > Any ideas? Can this be done with git?
>
> Did you actually try the "--" thing I suggested in
> http://article.gmane.org/gmane.comp.version-control.git/35699/?
>
> Besides, I just tested with current "next":
>
> $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> Created commit 89a5bb5ac16fb8be9b6e061284e191cafb3e4da2
> 1 files changed, 0 insertions(+), 22 deletions(-)
> delete mode 100644 a234
But (at least in next from yesterday or something -- having an old
modem here only:-) it doesn't work if you delete the file using
git-rm, because git-commit -o operates only on known files: one of the
first things in this code path is a
git-ls-files --error-unmatch -- $@
This seems wrong because -o is supposed to bypass the index. It
should probably be doing ls-tree --name-only HEAD -- $@ instead, but
ls-tree doesn't have the --error-match functionality.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 21:40 ` Junio C Hamano
@ 2007-01-02 22:13 ` Jakub Narebski
2007-01-02 22:20 ` Johannes Schindelin
` (2 subsequent siblings)
3 siblings, 0 replies; 16+ messages in thread
From: Jakub Narebski @ 2007-01-02 22:13 UTC (permalink / raw)
To: git
Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> On Tue, 2 Jan 2007, Michael S. Tsirkin wrote:
>>
>>>> I'd like to remove a file and commit the removal while
>>>> leaving out other changes in repository/index.
>>>>
>>>> $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
>>>> rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
>>>>
>>>> $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
>>>> error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did
not match
>>>> any file(s) known to git.
>>>> Did you forget to 'git add'?
>>>>
>>>> A similiar thing works with "git add".
>>>
>>> Any ideas? Can this be done with git?
>>
>> Did you actually try the "--" thing I suggested in
>> http://article.gmane.org/gmane.comp.version-control.git/35699/?
>>
>> Besides, I just tested with current "next":
>>
>> $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
>> Created commit 89a5bb5ac16fb8be9b6e061284e191cafb3e4da2
>> 1 files changed, 0 insertions(+), 22 deletions(-)
>> delete mode 100644 a234
>
> The difference is Michael did "git rm" to explicitly tell git to
> forget about that path, while you used the vanilla "/bin/rm".
>
> Personally I never saw the point of having "git rm". Maybe we
> should remove it to prevent this confusion from happening.
Does this happen with new git-rm, which removes file also from
working directory?
BTW. you probably can do this with git-update-index...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 21:40 ` Junio C Hamano
2007-01-02 22:13 ` Jakub Narebski
@ 2007-01-02 22:20 ` Johannes Schindelin
2007-01-03 0:55 ` Carl Worth
2007-01-03 6:06 ` Michael S. Tsirkin
3 siblings, 0 replies; 16+ messages in thread
From: Johannes Schindelin @ 2007-01-02 22:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Michael S. Tsirkin
Hi,
On Tue, 2 Jan 2007, Junio C Hamano wrote:
> The difference is Michael did "git rm" to explicitly tell git to forget
> about that path, while you used the vanilla "/bin/rm".
Ah. In this case, it is enough to just say "git commit"...
> Personally I never saw the point of having "git rm". Maybe we should
> remove it to prevent this confusion from happening.
People seem so used to "cvs remove" that they had to have "git rm". Dunno.
I never used it. (Except to verify that indeed even "--" does not work
with Michael's example.)
Ciao,
Dscho
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 21:40 ` Junio C Hamano
2007-01-02 22:13 ` Jakub Narebski
2007-01-02 22:20 ` Johannes Schindelin
@ 2007-01-03 0:55 ` Carl Worth
2007-01-06 1:57 ` Junio C Hamano
2007-01-03 6:06 ` Michael S. Tsirkin
3 siblings, 1 reply; 16+ messages in thread
From: Carl Worth @ 2007-01-03 0:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git, Michael S. Tsirkin
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
On Tue, 02 Jan 2007 13:40:41 -0800, Junio C Hamano wrote:
> Personally I never saw the point of having "git rm". Maybe we
> should remove it to prevent this confusion from happening.
The one place where it's really "necessary", (as opposed to some users
just expecting it to be there), is to "undo" a git-add, (and I mean a
git-add that actually adds a new path to the index, not one of these
newfangled git-adds that simply updates content for an existing path).
For that scenario, without git-rm, the user would be forced to learn
how to use git-update-index to solve this problem.
(And note, that this is also the one case where it's the _right_ thing
for git-rm to actually leave the file around. I haven't checked to see
if the latest round of git-rm semantic cleanups still handle this use
case correctly.)
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-02 21:40 ` Junio C Hamano
` (2 preceding siblings ...)
2007-01-03 0:55 ` Carl Worth
@ 2007-01-03 6:06 ` Michael S. Tsirkin
2007-01-03 6:51 ` Junio C Hamano
3 siblings, 1 reply; 16+ messages in thread
From: Michael S. Tsirkin @ 2007-01-03 6:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
Mutt Label Removed By VIM
> Quoting r. Junio C Hamano <junkio@cox.net>:
> Subject: Re: How to commit removed file?
>
> >> > I'd like to remove a file and commit the removal while
> >> > leaving out other changes in repository/index.
> >> >
> >> > $git rm kernel_patches/fixes/ib_verbs_warning_fix.patch
> >> > rm 'kernel_patches/fixes/ib_verbs_warning_fix.patch'
> >> >
> >> > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> >> > error: pathspec 'kernel_patches/fixes/ib_verbs_warning_fix.patch' did not match
> >> > any file(s) known to git.
> >> > Did you forget to 'git add'?
> >> >
> >> > A similiar thing works with "git add".
> >>
> >> Any ideas? Can this be done with git?
> >
> > Did you actually try the "--" thing I suggested in
> > http://article.gmane.org/gmane.comp.version-control.git/35699/?
> >
> > Besides, I just tested with current "next":
> >
> > $ git commit kernel_patches/fixes/ib_verbs_warning_fix.patch
> > Created commit 89a5bb5ac16fb8be9b6e061284e191cafb3e4da2
> > 1 files changed, 0 insertions(+), 22 deletions(-)
> > delete mode 100644 a234
>
> The difference is Michael did "git rm" to explicitly tell git to
> forget about that path, while you used the vanilla "/bin/rm".
>
> Personally I never saw the point of having "git rm". Maybe we
> should remove it to prevent this confusion from happening.
But won't the same problem appear with
rm file
git-update-index file
git-commit file
--
MST
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-03 6:06 ` Michael S. Tsirkin
@ 2007-01-03 6:51 ` Junio C Hamano
2007-01-03 7:14 ` Junio C Hamano
0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2007-01-03 6:51 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Johannes Schindelin, git
"Michael S. Tsirkin" <mst@mellanox.co.il> writes:
> But won't the same problem appear with
>
> rm file
> git-update-index file
> git-commit file
If you do index manipulation yourself using update-index, do not
jump the index at the commit time using "git commit file..."
syntax; the sole purpose of that misfeature is to handhold
CVS-braindamaged people who want to make per-path partial
commits.
We bend backwards to allow index-jumping for most cases in
git-commit, and you found that "most" is not "all". That's a
great news.
I am not interested to make it "all" myself -- if somebody else
does it, that is fine, though ;-).
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-03 6:51 ` Junio C Hamano
@ 2007-01-03 7:14 ` Junio C Hamano
2007-01-04 17:41 ` Michael S. Tsirkin
0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2007-01-03 7:14 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Johannes Schindelin, git
Junio C Hamano <junkio@cox.net> writes:
> ... That's a
> great news.
>
> I am not interested to make it "all" myself -- if somebody else
> does it, that is fine, though ;-).
Just in case you do not know me, sorry for too much negative
tone in my message. I was just venting. It was not like I was
offended by something you said or anything like that.
The "commit path..." feature, while I would even agree that it
sometimes is useful in simple cases, is something that goes
quite against what git does normally, and anybody would
understand why after inspecting what git-commit has to do to
implement that. I personally hate that "feature".
Having said that, I am known to support features that I do not
agree with myself for other people, and sometimes even implement
them myself. But that does not mean I have to like them ;-).
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-03 7:14 ` Junio C Hamano
@ 2007-01-04 17:41 ` Michael S. Tsirkin
0 siblings, 0 replies; 16+ messages in thread
From: Michael S. Tsirkin @ 2007-01-04 17:41 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
> > ... That's a
> > great news.
> >
> > I am not interested to make it "all" myself -- if somebody else
> > does it, that is fine, though ;-).
>
> Just in case you do not know me, sorry for too much negative
> tone in my message. I was just venting. It was not like I was
> offended by something you said or anything like that.
>
> The "commit path..." feature, while I would even agree that it
> sometimes is useful in simple cases, is something that goes
> quite against what git does normally, and anybody would
> understand why after inspecting what git-commit has to do to
> implement that. I personally hate that "feature".
>
> Having said that, I am known to support features that I do not
> agree with myself for other people, and sometimes even implement
> them myself. But that does not mean I have to like them ;-).
Well, it's just a minor annoyance for me, so unless more people
ask for this to be fixed, I'm unlikely to invest time in this, either.
--
MST
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-03 0:55 ` Carl Worth
@ 2007-01-06 1:57 ` Junio C Hamano
2007-01-12 1:40 ` Carl Worth
0 siblings, 1 reply; 16+ messages in thread
From: Junio C Hamano @ 2007-01-06 1:57 UTC (permalink / raw)
To: Carl Worth; +Cc: git
Carl Worth <cworth@cworth.org> writes:
> On Tue, 02 Jan 2007 13:40:41 -0800, Junio C Hamano wrote:
>> Personally I never saw the point of having "git rm". Maybe we
>> should remove it to prevent this confusion from happening.
>
> The one place where it's really "necessary", (as opposed to some users
> just expecting it to be there), is to "undo" a git-add, (and I mean a
> git-add that actually adds a new path to the index, not one of these
> newfangled git-adds that simply updates content for an existing path).
"git reset" (i.e. --mixed) is the way to revert the index back
to HEAD and start over.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-06 1:57 ` Junio C Hamano
@ 2007-01-12 1:40 ` Carl Worth
2007-01-12 10:42 ` Jakub Narebski
0 siblings, 1 reply; 16+ messages in thread
From: Carl Worth @ 2007-01-12 1:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 2275 bytes --]
On Fri, 05 Jan 2007 17:57:16 -0800, Junio C Hamano wrote:
> Carl Worth <cworth@cworth.org> writes:
> > On Tue, 02 Jan 2007 13:40:41 -0800, Junio C Hamano wrote:
> >> Personally I never saw the point of having "git rm". Maybe we
> >> should remove it to prevent this confusion from happening.
> >
> > The one place where it's really "necessary", (as opposed to some users
> > just expecting it to be there), is to "undo" a git-add, (and I mean a
> > git-add that actually adds a new path to the index, not one of these
> > newfangled git-adds that simply updates content for an existing path).
>
> "git reset" (i.e. --mixed) is the way to revert the index back
> to HEAD and start over.
But that's a lot more than I want.
Here's something like one of the original use cases that I hit and had
in mind (as best I recall) that motivated be to write the initial
git-rm command. It was something like adding a feature and a new
test-case at the same time:
git update-index src/Makefile
git update-index src/some-feature.c
git add test/feature-test.c
# Hmm, wait, it'd be cleaner to add test/feature-test.c as a separate
# commit. How can I undo that "git add" I just did?
So, at this point, I could git-reset and start over, but I wanted a
way to undo just the "add" and leave all the other updates still in
the index.
It's not really all that important to be able to undo the add,
(there's not really a corresponding way to selectively undo the other
update-index calls without using git-reset for everything).
But now that I tried this case with a recent git (2a3a3c247) for which
git-rm does working-tree removal without -f, I see that it does
irretrievably destroy information in this case:
$ echo "important stuff" > new-file
$ git add new-file
$ git rm new-file
This now deletes new-file from the working tree and there's no copy of
the data inside git. The old git-rm would just return the file to it's
"untracked" state in this case.
I had thought the safety check was going to be that the index state
matched the HEAD state before git-rm would delete from the working
tree.
(Note, that I definitely agree that it's an improvement that git-rm
does delete the working-tree file when the working-tree and index and
HEAD all have the same content.)
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: How to commit removed file?
2007-01-12 1:40 ` Carl Worth
@ 2007-01-12 10:42 ` Jakub Narebski
0 siblings, 0 replies; 16+ messages in thread
From: Jakub Narebski @ 2007-01-12 10:42 UTC (permalink / raw)
To: git
Carl Worth wrote:
> But now that I tried this case with a recent git (2a3a3c247) for which
> git-rm does working-tree removal without -f, I see that it does
> irretrievably destroy information in this case:
>
> $ echo "important stuff" > new-file
> $ git add new-file
> $ git rm new-file
>
> This now deletes new-file from the working tree and there's no copy of
> the data inside git. The old git-rm would just return the file to it's
> "untracked" state in this case.
>
> I had thought the safety check was going to be that the index state
> matched the HEAD state before git-rm would delete from the working
> tree.
That is certainly bug in new git-rm; it should remove file _only_
if it can be recovered with the same state as it was before git-rm.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-01-12 10:43 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-31 10:24 How to commit removed file? Michael S. Tsirkin
2006-12-31 15:06 ` Johannes Schindelin
2007-01-02 20:10 ` Michael S. Tsirkin
2007-01-02 21:12 ` Johannes Schindelin
2007-01-02 21:40 ` Junio C Hamano
2007-01-02 22:13 ` Jakub Narebski
2007-01-02 22:20 ` Johannes Schindelin
2007-01-03 0:55 ` Carl Worth
2007-01-06 1:57 ` Junio C Hamano
2007-01-12 1:40 ` Carl Worth
2007-01-12 10:42 ` Jakub Narebski
2007-01-03 6:06 ` Michael S. Tsirkin
2007-01-03 6:51 ` Junio C Hamano
2007-01-03 7:14 ` Junio C Hamano
2007-01-04 17:41 ` Michael S. Tsirkin
2007-01-02 21:49 ` Juergen Ruehle
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 NNTP newsgroup(s).