Skip to content

Conversation

@technoweenie
Copy link
Contributor

@technoweenie technoweenie commented Sep 22, 2017

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.

$ git lfs migrate import --include="*.gem" --include-ref=master --verbose
migrate: Sorting commits: ..., done
migrate: commit 4be47bd500d595ad735e077ea7b2b1b0ff399de4: vendor/cache/yajl-ruby-0.8.0.gem
migrate: Rewriting commits:   5% (21335/454650)

@technoweenie technoweenie merged commit 1d5c9d3 into master Sep 26, 2017
@technoweenie technoweenie deleted the migrate-verbose branch September 26, 2017 17:01
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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants