bozaro / git-lfs-migrate

Simple project for convert old repository for using git-lfs feature
MIT License
222 stars 29 forks source link

Mapping of old sha1 to new sha1 #48

Open hkrpavan opened 6 years ago

hkrpavan commented 6 years ago

After running git-lfs-migrate how to get mapping of old sha1 to new sha1 of all commits?

Also, what is the file git-lfs-migrate.mapdb? If it has old commit id to new commit id mapping how to dump it to text or csv file?

antaln commented 5 years ago

I think git-lfs-migrate.mapdb is just a cache used during LFS conversion. The map of old to new commits is kept in the ConcurrentHashMap object ('converted'). I just added this in Main.java after the "Recreating refs..." loop block to dump old and new sha1 values:

        log.info("Dumping ObjectId maps...");
        for (Map.Entry<TaskKey, ObjectId> entry : converted.entrySet()) {
          ObjectId oldId = entry.getKey().getObjectId();
          ObjectId newId = entry.getValue();
          log.info(" convert objId: {} -> {}", oldId.getName(), newId.getName());
        } 

Caveats:

I'll see about making a PR for this, but I just hacked this for a migration I was doing.

hkrpavan commented 5 years ago

Thank you!