简体   繁体   中英

Import a CVS repository into GIT results in some misleading behaviors related to timestamps

I have used git cvsimport to import my CVS repository into a brand new GIT one.

Unfortunately, in some cases some commits have been reported in a wrong order.

Eg I had two CVS revisions of a file, rev1.1 at 11.39am and rev1.2 at 11.42am; in GIT, I can see a commit at 11.42am (with content equal to rev1.2) and a subsequent one at 11.45am (with content equal to rev1.1).

I'm aware of the known issue stated in the cvsimport man page

If timestamps of commits in the cvs repository are not stable enough to be used for ordering commits changes may show up in the wrong order.

but I cannot understand what does stable enough mean.

Moreover, it would be great if anyone could provide me a workaround for this problem.

Thank you very much

cghersi

Is very easy to cheat git into timestamp, as it checks only the local time, so probably the cvs checked the time into the order the tags was set.

But a workaround to this is use cherry-pick . This commands is almost a copy-paste from commits, so you can simple give a checkout to a commit from rev1.1 and there use the cherry-pick into the commit lost after the rev1.2. Than after use a rebase -i just to erase/squash the duplicated commit after the rev1.2. As using rebase/cherry-pick, the commit's tree will request a sad push -f into the branch to fix everything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM