# git repository modified after migration

6 messages from 2015-12-25 to 2016-01-12. Participants: Yang Yu, Michael J Gruber, Junio C Hamano.
Thread: https://gitlist.dev/t/41075

## Yang Yu, 2015-12-25 20:49

Subject: git repository modified after migration
Message-ID: <CAFwKRnQ_EZ73DBfrb0HNks3dt3=YJbLRoHvB0mfsD9FA-ey6hA@mail.gmail.com>
URL: https://gitlist.dev/e/CAFwKRnQ_EZ73DBfrb0HNks3dt3%3DYJbLRoHvB0mfsD9FA-ey6hA%40mail.gmail.com

```
I migrated a 11G git repository converted from svn on a host with
Debian 8.2, reiserfs, git 2.1.4 to a host with Ubuntu 12.04.5 LTS,
xfs, git 2.6.4. After the migration, `git status` showing a good
amount of files modified.

I did the transfer with
1) `rsync -azP`, after noticing the modified files I ran `rsync -avH
--delete` but it did not correct the problem
2) tar zcf, then on the destination download the tar.gz (served by
nginx) with wget

Both had the same result. But the original repository was still clean.

I did some comparison between "modified" and original files
a) same hash (md5sum, shasum)
b) same permission (-rw-r--r-- 1 )
c) same encoding and line termination (UTF-8 Unicode (with BOM) text,
with CRLF line terminators)
d) no git attributes for either


On the destination host, I ran `git checkout` on each of those
modified files. After one pass I got less modified files. Repeating
`git checkout` on remaining files for a few more times, finally I got
a clean repository on the destination host.

What could have caused git to consider those files as modified? And
why multiple `git checkout` again the same file was necessary?

Thanks.


Yang

```

## Michael J Gruber, 2016-01-11 15:04

Subject: Re: git repository modified after migration
Message-ID: <5693C48A.7060801@drmicha.warpmail.net>
URL: https://gitlist.dev/e/5693C48A.7060801%40drmicha.warpmail.net
In-Reply-To: <CAFwKRnQ_EZ73DBfrb0HNks3dt3=YJbLRoHvB0mfsD9FA-ey6hA@mail.gmail.com>

```
Yang Yu venit, vidit, dixit 25.12.2015 21:49:
> I migrated a 11G git repository converted from svn on a host with
> Debian 8.2, reiserfs, git 2.1.4 to a host with Ubuntu 12.04.5 LTS,
> xfs, git 2.6.4. After the migration, `git status` showing a good
> amount of files modified.
> 
> I did the transfer with
> 1) `rsync -azP`, after noticing the modified files I ran `rsync -avH
> --delete` but it did not correct the problem
> 2) tar zcf, then on the destination download the tar.gz (served by
> nginx) with wget
> 
> Both had the same result. But the original repository was still clean.
> 
> I did some comparison between "modified" and original files
> a) same hash (md5sum, shasum)
> b) same permission (-rw-r--r-- 1 )
> c) same encoding and line termination (UTF-8 Unicode (with BOM) text,
> with CRLF line terminators)
> d) no git attributes for either
> 
> 
> On the destination host, I ran `git checkout` on each of those
> modified files. After one pass I got less modified files. Repeating
> `git checkout` on remaining files for a few more times, finally I got
> a clean repository on the destination host.
> 
> What could have caused git to consider those files as modified? And
> why multiple `git checkout` again the same file was necessary?
> 
> Thanks.
> 
> 
> Yang

This happens whenever the "stat" information changes, e.g. due to
changed device numbering and such. "git reset --hard" would have been
the quickiest way to reset the stat cache/index - after git diff, of
course ;)

Michael

```

## Yang Yu, 2016-01-11 17:48

Subject: Re: git repository modified after migration
Message-ID: <CAFwKRnRV7dx49+dku13b--W2g9t=OJiyuT2O_dv4ZZ3PdD1v3g@mail.gmail.com>
URL: https://gitlist.dev/e/CAFwKRnRV7dx49%2Bdku13b--W2g9t%3DOJiyuT2O_dv4ZZ3PdD1v3g%40mail.gmail.com
In-Reply-To: <5693C48A.7060801@drmicha.warpmail.net>

```
On Mon, Jan 11, 2016 at 9:04 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> This happens whenever the "stat" information changes, e.g. due to
> changed device numbering and such. "git reset --hard" would have been
> the quickiest way to reset the stat cache/index - after git diff, of
> course ;)
>


Can you go into a bit more details about this? Why does it only affect
certain files (always these filed modified) on every host I tried?
Thanks.

```

## Junio C Hamano, 2016-01-11 18:19

Subject: Re: git repository modified after migration
Message-ID: <xmqq4mekx9ld.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq4mekx9ld.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <5693C48A.7060801@drmicha.warpmail.net>

```
Michael J Gruber <git@drmicha.warpmail.net> writes:

> This happens whenever the "stat" information changes, e.g. due to
> changed device numbering and such. "git reset --hard" would have been
> the quickiest way to reset the stat cache/index - after git diff, of
> course ;)

That does not quite explain why 'git status' reported modified files
in the first place.  It would have refreshed the cached stat info in
the index as the first thing to do.  "git status" I think is the
recommended way these days ("update-index --refresh" for us old
timers) to nondestructively correct the cached stat information
discrepancy caused by "cp -R".

If you need to resort to "reset --hard", then there is something
else going on.

```

## Michael J Gruber, 2016-01-12 07:01

Subject: Re: git repository modified after migration
Message-ID: <5694A4E6.6020508@drmicha.warpmail.net>
URL: https://gitlist.dev/e/5694A4E6.6020508%40drmicha.warpmail.net
In-Reply-To: <xmqq4mekx9ld.fsf@gitster.mtv.corp.google.com>

```
Junio C Hamano venit, vidit, dixit 11.01.2016 19:19:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> This happens whenever the "stat" information changes, e.g. due to
>> changed device numbering and such. "git reset --hard" would have been
>> the quickiest way to reset the stat cache/index - after git diff, of
>> course ;)
> 
> That does not quite explain why 'git status' reported modified files
> in the first place.  It would have refreshed the cached stat info in
> the index as the first thing to do.  "git status" I think is the
> recommended way these days ("update-index --refresh" for us old
> timers) to nondestructively correct the cached stat information
> discrepancy caused by "cp -R".
> 
> If you need to resort to "reset --hard", then there is something
> else going on.

Back than when I had the same problem with git repos on removable file
systems (if I remember correctly) git status did not correct that
information. It may be different now.

Michael

```

## Junio C Hamano, 2016-01-12 18:07

Subject: Re: git repository modified after migration
Message-ID: <xmqq8u3uvfha.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq8u3uvfha.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <5694A4E6.6020508@drmicha.warpmail.net>

```
Michael J Gruber <git@drmicha.warpmail.net> writes:

> Junio C Hamano venit, vidit, dixit 11.01.2016 19:19:
>> Michael J Gruber <git@drmicha.warpmail.net> writes:
>> 
>>> This happens whenever the "stat" information changes, e.g. due to
>>> changed device numbering and such. "git reset --hard" would have been
>>> the quickiest way to reset the stat cache/index - after git diff, of
>>> course ;)
>> 
>> That does not quite explain why 'git status' reported modified files
>> in the first place.  It would have refreshed the cached stat info in
>> the index as the first thing to do.  "git status" I think is the
>> recommended way these days ("update-index --refresh" for us old
>> timers) to nondestructively correct the cached stat information
>> discrepancy caused by "cp -R".
>> 
>> If you need to resort to "reset --hard", then there is something
>> else going on.
>
> Back than when I had the same problem with git repos on removable file
> systems (if I remember correctly) git status did not correct that
> information. It may be different now.

I do not recall we did anything specific to help removable devices,
so if the report is coming from a filesystem on a removable device
we may be seeing the same symptom.

I somehow doubt that is the case, though.

A not-entirely-inplausible theory is that the index in the original
repository somehow marks modified entries as clean, fooling "status"
that is run in the original repository into reporting that nothing
changed.  Because "cp -R" into a different location forces the
content-level checking, "status" run in the copy notices that they
are indeed different and tells the true story.  If that is the case,
it would be interesting to see how the index got into that state.

```
