# Choosing between "renaming" and "copy"

2 messages from 2009-03-12 to 2009-03-12. Participants: Samuel Tardieu, Andreas Ericsson.
Thread: https://gitlist.dev/t/18287

## Samuel Tardieu, 2009-03-12 13:01

Subject: Choosing between "renaming" and "copy"
Message-ID: <2009-03-12-14-01-15+trackit+sam@rfc1149.net>
URL: https://gitlist.dev/e/2009-03-12-14-01-15%2Btrackit%2Bsam%40rfc1149.net

```
I renamed a file in my repository, and made a slightly modified copy
of it. It looks like GIT gets confused on which one is the renaming
and which one is the copy, and doesn't favour the 100% identical one
to be chosen as the renaming.

Not a big deal, but maybe git could be more clever here.

% git commit -m "Split into flash and ram alternatives." 
[stm32-sk 601462c] Split into flash and ram alternatives.
 3 files changed, 3 insertions(+), 2 deletions(-)
 copy Demo/CORTEX_STM32SK_GCC/{stm32f103r8t6.ld => stm32f103r8t6_flash.ld} (100%)
 rename Demo/CORTEX_STM32SK_GCC/{stm32f103r8t6.ld => stm32f103r8t6_ram.ld} (98%)

% git --version
git version 1.6.2.rc2.305.g23381

  Sam
-- 
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/

```

## Andreas Ericsson, 2009-03-12 14:44

Subject: Re: Choosing between "renaming" and "copy"
Message-ID: <49B91FC9.6090700@op5.se>
URL: https://gitlist.dev/e/49B91FC9.6090700%40op5.se
In-Reply-To: <2009-03-12-14-01-15+trackit+sam@rfc1149.net>

```
Samuel Tardieu wrote:
> I renamed a file in my repository, and made a slightly modified copy
> of it. It looks like GIT gets confused on which one is the renaming
> and which one is the copy, and doesn't favour the 100% identical one
> to be chosen as the renaming.
> 
> Not a big deal, but maybe git could be more clever here.
> 
> % git commit -m "Split into flash and ram alternatives." 
> [stm32-sk 601462c] Split into flash and ram alternatives.
>  3 files changed, 3 insertions(+), 2 deletions(-)
>  copy Demo/CORTEX_STM32SK_GCC/{stm32f103r8t6.ld => stm32f103r8t6_flash.ld} (100%)
>  rename Demo/CORTEX_STM32SK_GCC/{stm32f103r8t6.ld => stm32f103r8t6_ram.ld} (98%)
> 

There isn't that much more to be clever about, really. One is a rename+edit,
the other is a copy. The other way around would have been copy+edit + rename
which isn't necessarily an improvement.

Looking at how git internally[1] does things and remembering the meanings of
"copy" and "rename" though, it makes perfect sense to leave it as-is.

[1].
In git, the content is part of the (object) name, so changing the content
makes it closer to a rename than a copy, while changing the location always
makes it a copy, although sometimes coupled with a delete.

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

```
