Shopsys: Monorepo Tools have issue with folders containing spaces

Created on 29 Aug 2018  路  4Comments  路  Source: shopsys/shopsys

What is happening

Have a repository with files placed within a path that contain a "space" character (i.e. placed in a folder with a space character). Splitting script will start printing errors when rewriting the history.

 ~/workspace/monorepo-tools/monorepo_split.sh pythia-tools:cmd 
Wiping the original history back-up
HEAD is now at 6730a50 Adding user caching, splitting conversions by probability
Splitting repository for the remote 'pythia-tools'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Rewriting history from a subdirectory 'cmd'
Rewrite 1bf170d01fdd5c4a261087d979d08afd4b435b77 (1/226) (0 seconds passed, remaining 0 predicted)    fatal: pathspec 'Experiments/Data' did not match any files
Rewrite 8dc4a6f214bf4b8c48068a1c8f7d2d1c159cd8b6 (2/226) (0 seconds passed, remaining 0 predicted)    fatal: pathspec 'Experiments/Data' did not match any files
Rewrite d1ce917c93db010461cf59627a94243f4feb9038 (3/226) (0 seconds passed, remaining 0 predicted)    fatal: pathspec 'Experiments/Data' did not match any files
Rewrite c0eec59e09a963803c3034834936cd794393450e (4/226) (0 seconds passed, remaining 0 predicted)    fatal: pathspec 'Experiments/Data' did not match any files
Rewrite 385cda08cad8bd24ce5da5461a1ac78b7d05cd1e (5/226) (0 seconds passed, remaining 0 predicted)    fatal: pathspec 'Experiments/Data' did not match any files
Rewrite d48ad8cf7dda8dd8132b9626a2186436dd3bf1de (6/226) (0 seconds passed, remaining 0 predicted)    fatal: pathspec 'Experiments/Data' did not match any files
...

Here, it fails because it didn't properly read my Experiments/Data Exploration files. This was the output of git ls-files used within the splitting script:

 git ls-files -s | sed -r "s-(\t\"*)cmd/-\1-"
100644 a5bb6c0ee2bf338e9709bdd5d7b8fbf9f88805a4 0   .gitattributes
100644 f2d59c54b5d9034db08edc488dedcdeb472b6480 0   .gitignore
100644 ac79ea4cc2a224bb7e8aba87a3857198cbc0cd46 0   Experiments/Data Exploration/.ipynb_checkpoints/rg-data-exploration-intro-checkpoint.ipynb
100644 d3e56d1360fb7223df0c761cab56c4225f9bfb9d 0   Experiments/Data Exploration/readership-levels-all-pvs.csv
100644 0197c3e880fc1a78f4cdef4db7d752cb76c2cdb4 0   Experiments/Data Exploration/readership-levels-articles.csv
100644 f4cb32012b96fbcfa36a1ec4fda0ff381842988c 0   Experiments/Data Exploration/rg-data-exploration-intro.html
100644 3dc3466a3ccf5185d8a66b2f03877eda80484c5e 0   Experiments/Data Exploration/rg-data-exploration-intro.ipynb
100644 fd99195b1b9d5b272cc0cbeceeec3f0fc054506f 0   Experiments/Data Exploration/rg-data-exploration-intro.py
...

I've tried to play with a rewrite_history_from.sh script and got it working with following change:

git -c core.quotepath=false ls-files | grep -vE "^\"*$SUBDIRECTORY/" | tr "\n" "\0" | xargs -0 $XARGS_OPTS git rm -q --cached

So basically I've replaced all new lines with \0 character and told xargs to use that -0 instead. I can't tell whether this doesn't affect something of yours, so I didn't make a PR from this. Please, validate whether it's working within your conditions too and if possible, commit the change.

Expected result

  • The splitting should be handled without error even when the path contains a space
  • If there's an error, it should probably fail. Not failing caused files I didn't wanted to have public yet to be pushed into the module repository.

Thanks for handling!

Most helpful comment

Hi, I created a PR for this 3 hours ago - https://github.com/shopsys/shopsys/pull/433

All 4 comments

Hi, I created a PR for this 3 hours ago - https://github.com/shopsys/shopsys/pull/433

Hi @rootpd, thanks for reporting and thanks @dominikkaluza for creating the pull request. We will address the issue in the next week so I will let you know then :+1:

@vitek-rostislav Same issue here. Can you do something with this please?

Hi, we reviewed, tested and merged the PR #433, thank you guys :+1:

Was this page helpful?
0 / 5 - 0 ratings