-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Migrate verbose option #2610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Migrate verbose option #2610
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
May 26, 2023
In commit e90d54d of PR git-lfs#2329 the "git/githistory/log" package was added, including the PercentageTask structure and associated methods. Then in commit 122b765 of PR git-lfs#2610 the Entry() method was added to provide support for verbose logging in the "git lfs migrate impot" command. However, the name of the receiver argument for the Entry() method differs from that of the other methods for the PercentageTask structure, so we update it to match now, as well as fixing a typo which remains from the original commit in PR git-lfs#2329. Note that the "git/githistory/log" package was later renamed to the "tasklog" package in commits b9ab79e and 45c580e of PR git-lfs#2747.
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
When the --verbose option is supplied to the "git lfs migrate export" or "git lfs migrate import" command, additional output messages are generated listing the file paths of all migrated files and the original commit SHAs which introduced those files. This option was first introduced for the "git lfs migrate import" command in PR git-lfs#2610. The rewriteBlob() method of the Rewriter structure in the "githistory" package outputs the pairs of original commits SHAs and file paths on individual lines by adding entries to a PercentageTask structure from the "tasklog" package. Each line is formatted without any leading whitespace. During a subsequent step in the commands' progress, the updateOneRef() method of the refUpdater structure in the "githistory" package outputs pairs of Git reference names and the original and rewritten commit SHAs associated with them. Unlike the list of commits and file paths, these lines are formatted with an indentation of two space characters, which sets them apart visually from the main progress messages output by the command. To help clarify the principal steps of the migration process and make the output of the "git lfs migrate" subcommands more readable, we add indentation to the lines with the pairs of commit SHAs and file paths, matching that of the lines with the Git references and old and new commit SHAs. We then update the "migrate export (--verbose)" test in our t/t-migrate-export.sh test script to validate the format of the lines with commit SHAs output by the "git lfs migrate export" command. Similarly, we update two tests in our t/t-migrate-import.sh test script to do the same for the "git lfs migrate import" command. Note that in all of these tests we use the tee(1) command to capture the output of the "git lfs migrate" command under test into a log file, and then use a grep(1) command to check for the formatted lines in the log file. We avoid piping the output of the "git lfs migrate" command directly into the grep(1) command because we prefer to use that command's -q option, which causes it to exit as soon as it reads a matching line. This in turn would cause the "git lfs migrate" command to exit immediately when it receives a SIGPIPE signal trying to write to the pipe, which would leave the migration incomplete. Further, we need to pass the --yes option to the "git lfs migrate" command in these tests because it will now otherwise pause and wait for confirmation to proceed when it detects the untracked "migrate.log" file being written into the current Git working tree. Finally, we also update the final progress message output by the "git lfs migrate export" and "git lfs migrate import" subcommands to begin with an uppercase letter. It now reads "Checkout" rather than "checkout", which better aligns with the format of all the preceding messages such as "Sorting commits" and "Rewriting commits".
chrisd8088
added a commit
to chrisd8088/git-lfs
that referenced
this pull request
Feb 25, 2025
When the --verbose option is supplied to the "git lfs migrate export" or "git lfs migrate import" command, additional output messages are generated listing the file paths of all migrated files and the original commit SHAs which introduced those files. This option was first introduced for the "git lfs migrate import" command in PR git-lfs#2610. The rewriteBlob() method of the Rewriter structure in the "githistory" package outputs the pairs of original commits SHAs and file paths on individual lines by adding entries to a PercentageTask structure from the "tasklog" package. Each line is formatted without any leading whitespace. During a subsequent step in the commands' progress, the updateOneRef() method of the refUpdater structure in the "githistory" package outputs pairs of Git reference names and the original and rewritten commit SHAs associated with them. Unlike the list of commits and file paths, these lines are formatted with an indentation of two space characters, which sets them apart visually from the main progress messages output by the command. To help clarify the principal steps of the migration process and make the output of the "git lfs migrate" subcommands more readable, we add indentation to the lines with the pairs of commit SHAs and file paths, matching that of the lines with the Git references and old and new commit SHAs. We then update the "migrate export (--verbose)" test in our t/t-migrate-export.sh test script to validate the format of the lines with commit SHAs output by the "git lfs migrate export" command. Similarly, we update two tests in our t/t-migrate-import.sh test script to do the same for the "git lfs migrate import" command. Note that in all of these tests we use the tee(1) command to capture the output of the "git lfs migrate" command under test into a log file, and then use a grep(1) command to check for the formatted lines in the log file. We avoid piping the output of the "git lfs migrate" command directly into the grep(1) command because we prefer to use that command's -q option, which causes it to exit as soon as it reads a matching line. This in turn would cause the "git lfs migrate" command to exit immediately when it receives a SIGPIPE signal trying to write to the pipe, which would leave the migration incomplete. Further, we need to pass the --yes option to the "git lfs migrate" command in these tests because it will now otherwise pause and wait for confirmation to proceed when it detects the untracked "migrate.log" file being written into the current Git working tree. Finally, we also update the final progress message output by the "git lfs migrate export" and "git lfs migrate import" subcommands to begin with an uppercase letter. It now reads "Checkout" rather than "checkout", which better aligns with the format of all the preceding messages such as "Sorting commits" and "Rewriting commits".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds an option to print the commit oid and path of every migrated file. I'm not sure if this should be default or not, so I'm playing it safe for v2.3.1.