Question

Recently I analysed the commit log of my local repo and noticed the following and I would like to know what is happening here. Can anybody give an answer or a pointer to a web site explaining this?

Let's say I have the following file structure:

/path/a.txt  
/path/b.txt  
/path/c.txt  
/path/d.txt  

When I commit it, I saw the following in the log:

create mode 100644 path/a.txt
create mode 100644 path/b.txt
copy path/{a.txt => b.txt} (100%)
create mode 100644 path/c.txt
copy path/{a.txt => c.txt} (100%)
create mode 100644 path/d.txt
copy path/{a.txt => d.txt} (100%)

all files are completely different content-wise. So what do those curly brackets {=>} mean?

Git version: 1.7.0.4 (don't ask me why I am not using the latest version, it's a client's server where I can not just install the latest version.)

Était-ce utile?

La solution

The curly brackets are just a short-hand so Git doesn't have to print the full path twice.

Thus, copy path/{a.txt => b.txt} is just short for copy path/a.txt => path/b.txt.

The percentage at the end of those lines tells you how similar the respective second file is to the first one (in this case, they are exactly identical, which is why Git thinks you copied them).

Note also that this has no influence on the commit content, it's just a semantic interpretation that's done purely for output. The commit's content is always an exact snapshot of all tracked files, without saving any meta information like moving or copying.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top