git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cd
@ 2013-04-03 14:49 jpinheiro
  2013-04-03 22:55 ` cd Andreas Ericsson
  0 siblings, 1 reply; 2+ messages in thread
From: jpinheiro @ 2013-04-03 14:49 UTC (permalink / raw)
  To: git

Hi all,

We are students from Universidade do Minho in Portugal, and we are using git
in project as a case study.
While experimenting with git we found an unexpected behavior with git rm.
Here is a trace of the unexpected behavior:

$ git init
$ mkdir D
$ echo "Hi" > D/F
$ git add D/F
$ rm -r D
$ echo "Hey" > D
$ git rm D/F
warning: 'D/F': Not a directory
rm 'D/F'
fatal: git rm: 'D/F': Not a directory


If the file D created with last echo did not exist or was named differently
then no error would occur as expected. For example:

$ git init
$ mkdir D
$ echo "Hi" > D/F
$ git add D/F
$ rm -r D
$ echo "Hey" > F
$ git rm D/F

This works as expected, and the only difference is the name of the file of
the last echo.
Is this the expected behavior of git rm?




--
View this message in context: http://git.661346.n2.nabble.com/cd-tp7581484.html
Sent from the git mailing list archive at Nabble.com.

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

* Re: cd
  2013-04-03 14:49 cd jpinheiro
@ 2013-04-03 22:55 ` Andreas Ericsson
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Ericsson @ 2013-04-03 22:55 UTC (permalink / raw)
  To: jpinheiro; +Cc: git

On 04/03/2013 04:49 PM, jpinheiro wrote:
> Hi all,
>
> We are students from Universidade do Minho in Portugal, and we are using git
> in project as a case study.
> While experimenting with git we found an unexpected behavior with git rm.
> Here is a trace of the unexpected behavior:
>
> $ git init
> $ mkdir D
> $ echo "Hi" > D/F
> $ git add D/F
> $ rm -r D
> $ echo "Hey" > D
> $ git rm D/F
> warning: 'D/F': Not a directory
> rm 'D/F'
> fatal: git rm: 'D/F': Not a directory
>
>
> If the file D created with last echo did not exist or was named differently
> then no error would occur as expected. For example:
>
> $ git init
> $ mkdir D
> $ echo "Hi" > D/F
> $ git add D/F
> $ rm -r D
> $ echo "Hey" > F
> $ git rm D/F
>
> This works as expected, and the only difference is the name of the file of
> the last echo.
> Is this the expected behavior of git rm?
>

Yes. The only difference between 'git rm' and 'rm' is that git rm also
removes the file from its index and prepares to commit a version without
it. From git's point of view, it's not an error if the file doesn't
exist. It *is* an error if the directory where the file should reside
suddenly no longer a directory though.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

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

end of thread, other threads:[~2013-04-03 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03 14:49 cd jpinheiro
2013-04-03 22:55 ` cd Andreas Ericsson

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).