0

I'm running git lfs migrate on a clean --mirror clone of my git repo, using the following command:

git lfs migrate import --include=/path/to/[dir_to_convert_to_lfs]/** --everything

The output from this is:

$ git lfs migrate import --include=/path/to/[dir_to_convert_to_lfs]/** --everything
migrate: Sorting commits: ..., done.
migrate: Rewriting commits: 100% (22129/22129), done.
[branch abc -> xyz]
...
could not update refs: exit status 129

After which, it seems like it has corrupted my repo - for example, if I then call:

git rev-list --all --count

It shows that I now have 42251 commits - whereas my expectation was that git lfs migrate import would update the existing commits to point to the files in LFS.

At the moment, I'm struggling to find any information as to what this error message and/or status code is indicating. Also, there are no git lfs logs - i.e. if I call git lfs logs last, it reports:

$ git lfs logs last
No logs to show

I'm using git version 2.27.0 and git lfs version 2.11.0.

Am I doing something wrong with Git LFS Migrate? Are there any ways to debug this?

Update: I've also added, and closed, an issue on the git lfs repo on github for this problem.

amaidment
  • 6,942
  • 5
  • 52
  • 88

1 Answers1

0

Error Code - Exit Status 129:

I was a bit puzzled by this, and couldn't find a list of git lfs error codes. However, the OP of this git-lfs issue it's stated that "a 129 indicates a usage error". I confess that left me none the wiser.

Solution:

I found that this was quite similar to this git-lfs issue, or at least related to some of the issues described in the comments. For example, it seems to be similar to the issue described in this comment, or this comment.

Although the first of those comments provides a more detailed solution for updating the refs, I found that the script offered in the solution of comment was able to work. With full credit to the original author, I repeat that here:

When you run the git lfs migrate import, run with the --object-map

git lfs migrate import --include=/path/to/[dir_to_convert_to_lfs]/** --everything --object-map=../mapping_file.txt

Then the following script can be executed within the git repository:

MAP_FILE=../mapping_file.txt
git for-each-ref | grep tags | while read -r oid type tag; do
        while IFS=, read -r old_oid new_oid; do
                if [[ "$oid" == "$old_oid" ]]; then
                        echo TAG $tag still pointing to old_oid $old_oid instead of $new_oid
                        git tag -f $(basename $tag) $new_oid
                fi
        done < $MAP_FILE
done
Community
  • 1
  • 1
amaidment
  • 6,942
  • 5
  • 52
  • 88