Skip to content

Instantly share code, notes, and snippets.

@StanislawAntol
Created September 1, 2017 22:21
Show Gist options
  • Save StanislawAntol/b992caa88ec6587656680d4f3034e44d to your computer and use it in GitHub Desktop.
Save StanislawAntol/b992caa88ec6587656680d4f3034e44d to your computer and use it in GitHub Desktop.
git-lfs-migrate Directory Issue
git --version
git lfs
GIT_TRACE=1
REPO_DIR=${HOME}/tmp/repo
EXT=bin
start_dir=`pwd`
DIRS=("" dir/)
for DIR in "${DIRS[@]}";
do
FILENAME=${DIR}file.${EXT}
echo "================================ ${FILENAME} ================================"
rm -rf ${REPO_DIR}
mkdir -p ${REPO_DIR}
cd ${REPO_DIR}
git init
# # git LFS works fine if initially tracking
# git lfs track *.${EXT}
mkdir -p ${REPO_DIR}/${DIR}
for size in 1024 2048
do
dd if=/dev/urandom of=${FILENAME} bs=1 count=${size}
git add ${FILENAME}
git commit -m "Size ${size}"
done
# None of the below commands work for the case where the file is in a directory
#git lfs migrate import --include=${FILENAME} --include-ref=master
#git lfs migrate import --include=**/*.${EXT} --include-ref=master
git lfs migrate import --include=*.${EXT} --include-ref=master
echo -e "\n+++++ git lfs ls-files +++++"
git lfs ls-files
echo -e "\n+++++ git lfs status +++++"
git lfs status
done
cd ${start_dir}
15:20:48.896051 git.c:328 trace: built-in: git 'version'
git version 2.14.1
15:20:48.898344 git.c:560 trace: exec: 'git-lfs'
15:20:48.898409 run-command.c:626 trace: run_command: 'git-lfs'
git-lfs/2.2.1 (GitHub; linux amd64; go 1.8.1)
Sorry, no usage text found for "git-lfs"
trace git-lfs: run_command: 'git' config -l
================================ file.bin ================================
15:20:48.917800 git.c:328 trace: built-in: git 'init'
Initialized empty Git repository in /home/s.antol/tmp/repo/.git/
1024+0 records in
1024+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.00380968 s, 269 kB/s
15:20:48.928557 git.c:328 trace: built-in: git 'add' 'file.bin'
15:20:48.931277 git.c:328 trace: built-in: git 'commit' '-m' 'Size 1024'
[master (root-commit) 832104a] Size 1024
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file.bin
2048+0 records in
2048+0 records out
2048 bytes (2.0 kB, 2.0 KiB) copied, 0.00752104 s, 272 kB/s
15:20:48.943832 git.c:328 trace: built-in: git 'add' 'file.bin'
15:20:48.946743 git.c:328 trace: built-in: git 'commit' '-m' 'Size 2048'
[master d4dc403] Size 2048
1 file changed, 0 insertions(+), 0 deletions(-)
rewrite file.bin (100%)
15:20:48.951082 git.c:560 trace: exec: 'git-lfs' 'migrate' 'import' '--include=*.bin' '--include-ref=master'
15:20:48.951132 run-command.c:626 trace: run_command: 'git-lfs' 'migrate' 'import' '--include=*.bin' '--include-ref=master'
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: git cat-file --batch
trace git-lfs: run_command: git rev-list --reverse --topo-order --do-walk master --
migrate: Sorting commits: ...
migrate: Sorting commits: ..., done
migrate: Rewriting commits: 0% (0/2)
migrate: Rewriting commits: 100% (2/2), done
master d4dc40305fb29a61f884213b89e151b3bf6b773d -> f6273c9fc922a5d17770a2e90d7881bb36c31435
migrate: Updating refs: ...
migrate: Updating refs: ..., done
trace git-lfs: run_command: 'git' rev-parse --is-bare-repository
trace git-lfs: run_command: 'git' checkout --force
+++++ git lfs ls-files +++++
15:20:49.030033 git.c:560 trace: exec: 'git-lfs' 'ls-files'
15:20:49.030085 run-command.c:626 trace: run_command: 'git-lfs' 'ls-files'
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' rev-parse HEAD --symbolic-full-name HEAD
trace git-lfs: run_command: git ls-tree -r -l -z --full-tree f6273c9fc922a5d17770a2e90d7881bb36c31435
trace git-lfs: run_command: git cat-file --batch
23e1dc4005 * file.bin
+++++ git lfs status +++++
15:20:49.048344 git.c:560 trace: exec: 'git-lfs' 'status'
15:20:49.048394 run-command.c:626 trace: run_command: 'git-lfs' 'status'
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' rev-parse HEAD --symbolic-full-name HEAD
trace git-lfs: run_command: git cat-file --batch
On branch master
trace git-lfs: run_command: 'git' rev-parse HEAD --symbolic-full-name HEAD
trace git-lfs: run_command: 'git' config branch.master.remote
trace git-lfs: run_command: git diff-index -M HEAD
trace git-lfs: run_command: git diff-index -M --cached HEAD
Git LFS objects to be committed:
Git LFS objects not staged for commit:
================================ dir/file.bin ================================
15:20:49.092403 git.c:328 trace: built-in: git 'init'
Initialized empty Git repository in /home/s.antol/tmp/repo/.git/
1024+0 records in
1024+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 0.00382443 s, 268 kB/s
15:20:49.103035 git.c:328 trace: built-in: git 'add' 'dir/file.bin'
15:20:49.105721 git.c:328 trace: built-in: git 'commit' '-m' 'Size 1024'
[master (root-commit) 2651257] Size 1024
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 dir/file.bin
2048+0 records in
2048+0 records out
2048 bytes (2.0 kB, 2.0 KiB) copied, 0.00704041 s, 291 kB/s
15:20:49.117791 git.c:328 trace: built-in: git 'add' 'dir/file.bin'
15:20:49.120287 git.c:328 trace: built-in: git 'commit' '-m' 'Size 2048'
[master c347578] Size 2048
1 file changed, 0 insertions(+), 0 deletions(-)
rewrite dir/file.bin (100%)
15:20:49.124279 git.c:560 trace: exec: 'git-lfs' 'migrate' 'import' '--include=*.bin' '--include-ref=master'
15:20:49.124326 run-command.c:626 trace: run_command: 'git-lfs' 'migrate' 'import' '--include=*.bin' '--include-ref=master'
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: git cat-file --batch
migrate: Sorting commits: ...
trace git-lfs: run_command: git rev-list --reverse --topo-order --do-walk master --
migrate: Sorting commits: ..., done
migrate: Rewriting commits: 0% (0/2)
migrate: Rewriting commits: 100% (2/2), done
master c347578da5a50d26886f8ea21db1ecc270de4502 -> 879fab290ee613eed926d694cf24a3c958c3271d
migrate: Updating refs: ...
migrate: Updating refs: ..., done
trace git-lfs: run_command: 'git' rev-parse --is-bare-repository
trace git-lfs: run_command: 'git' checkout --force
+++++ git lfs ls-files +++++
15:20:49.196703 git.c:560 trace: exec: 'git-lfs' 'ls-files'
15:20:49.196748 run-command.c:626 trace: run_command: 'git-lfs' 'ls-files'
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' rev-parse HEAD --symbolic-full-name HEAD
trace git-lfs: run_command: git ls-tree -r -l -z --full-tree 879fab290ee613eed926d694cf24a3c958c3271d
trace git-lfs: run_command: git cat-file --batch
+++++ git lfs status +++++
15:20:49.214370 git.c:560 trace: exec: 'git-lfs' 'status'
15:20:49.214421 run-command.c:626 trace: run_command: 'git-lfs' 'status'
trace git-lfs: run_command: 'git' config -l
trace git-lfs: run_command: 'git' rev-parse HEAD --symbolic-full-name HEAD
trace git-lfs: run_command: git cat-file --batch
On branch master
trace git-lfs: run_command: 'git' rev-parse HEAD --symbolic-full-name HEAD
trace git-lfs: run_command: 'git' config branch.master.remote
trace git-lfs: run_command: git diff-index -M HEAD
trace git-lfs: run_command: git diff-index -M --cached HEAD
Git LFS objects to be committed:
Git LFS objects not staged for commit:
dir/file.bin (Git: b56d741 -> File: b56d741)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment