commands/migrate: attach stdout logger to 'info' subcommand
This commit is contained in:
parent
62de678b51
commit
ef576f0fa6
@ -1,6 +1,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
@ -202,7 +203,8 @@ func getHistoryRewriter(cmd *cobra.Command, db *odb.ObjectDatabase) *githistory.
|
||||
include, exclude := getIncludeExcludeArgs(cmd)
|
||||
filter := buildFilepathFilter(cfg, include, exclude)
|
||||
|
||||
return githistory.NewRewriter(db, githistory.WithFilter(filter))
|
||||
return githistory.NewRewriter(db,
|
||||
githistory.WithFilter(filter), githistory.WithLogger(os.Stderr))
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -11,7 +11,7 @@ begin_test "migrate info (default branch)"
|
||||
|
||||
original_head="$(git rev-parse HEAD)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=0b 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=0b 2>&1 | tail -n 2) <(cat <<-EOF
|
||||
*.md 140 B 1/1 files(s) 100%
|
||||
*.txt 120 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
@ -31,7 +31,7 @@ begin_test "migrate info (given branch)"
|
||||
original_master="$(git rev-parse refs/heads/master)"
|
||||
original_feature="$(git rev-parse refs/heads/my-feature)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=0b my-feature 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=0b my-feature 2>&1 | tail -n 2) <(cat <<-EOF
|
||||
*.md 170 B 2/2 files(s) 100%
|
||||
*.txt 120 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
@ -52,7 +52,7 @@ begin_test "migrate info (default branch with filter)"
|
||||
|
||||
original_head="$(git rev-parse HEAD)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=0b --include "*.md" 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=0b --include "*.md" 2>&1 | tail -n 1) <(cat <<-EOF
|
||||
*.md 140 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
|
||||
@ -71,7 +71,7 @@ begin_test "migrate info (given branch with filter)"
|
||||
original_master="$(git rev-parse refs/heads/master)"
|
||||
original_feature="$(git rev-parse refs/heads/my-feature)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=0b --include "*.md" my-feature 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=0b --include "*.md" my-feature 2>&1 | tail -n 1) <(cat <<-EOF
|
||||
*.md 170 B 2/2 files(s) 100%
|
||||
EOF)
|
||||
|
||||
@ -94,7 +94,7 @@ begin_test "migrate info (default branch, exclude remote refs)"
|
||||
original_remote="$(git rev-parse refs/remotes/origin/master)"
|
||||
original_master="$(git rev-parse refs/heads/master)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=0b 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=0b 2>&1 | tail -n 2) <(cat <<-EOF
|
||||
*.md 50 B 1/1 files(s) 100%
|
||||
*.txt 30 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
@ -117,7 +117,7 @@ begin_test "migrate info (given branch, exclude remote refs)"
|
||||
original_master="$(git rev-parse refs/heads/master)"
|
||||
original_feature="$(git rev-parse refs/heads/my-feature)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=0b my-feature 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=0b my-feature 2>&1 | tail -n 2) <(cat <<-EOF
|
||||
*.md 52 B 2/2 files(s) 100%
|
||||
*.txt 50 B 2/2 files(s) 100%
|
||||
EOF)
|
||||
@ -144,7 +144,7 @@ begin_test "migrate info (include/exclude ref)"
|
||||
diff -u <(git lfs migrate info \
|
||||
--above=0b \
|
||||
--include-ref=refs/heads/my-feature \
|
||||
--exclude-ref=refs/heads/master 2>&1) <(cat <<-EOF
|
||||
--exclude-ref=refs/heads/master 2>&1 | tail -n 2) <(cat <<-EOF
|
||||
*.md 31 B 1/1 files(s) 100%
|
||||
*.txt 30 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
@ -170,7 +170,7 @@ begin_test "migrate info (include/exclude ref with filter)"
|
||||
--above=0b \
|
||||
--include="*.txt" \
|
||||
--include-ref=refs/heads/my-feature \
|
||||
--exclude-ref=refs/heads/master 2>&1) <(cat <<-EOF
|
||||
--exclude-ref=refs/heads/master 2>&1 | tail -n 1) <(cat <<-EOF
|
||||
*.txt 30 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
|
||||
@ -190,7 +190,7 @@ begin_test "migrate info (above threshold)"
|
||||
|
||||
original_head="$(git rev-parse HEAD)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=130B 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=130B 2>&1 | tail -n 2) <(cat <<-EOF
|
||||
*.md 140 B 1/1 files(s) 100%
|
||||
*.txt 0 B 0/1 files(s) 0%
|
||||
EOF)
|
||||
@ -209,7 +209,7 @@ begin_test "migrate info (above threshold, top)"
|
||||
|
||||
original_head="$(git rev-parse HEAD)"
|
||||
|
||||
diff -u <(git lfs migrate info --above=130B --top=1 2>&1) <(cat <<-EOF
|
||||
diff -u <(git lfs migrate info --above=130B --top=1 2>&1 | tail -n 1) <(cat <<-EOF
|
||||
*.md 140 B 1/1 files(s) 100%
|
||||
EOF)
|
||||
|
||||
@ -218,4 +218,3 @@ begin_test "migrate info (above threshold, top)"
|
||||
assert_ref_unmoved "HEAD" "$original_head" "$migrated_head"
|
||||
)
|
||||
end_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user