t89 / matryoshka

Managing Git submodules is monotonous and — more importantly — interruptive work. Managing your dependencies shouldn't keep you from being productive. This script will automate the part of updating your submodules for you.
MIT License
11 stars 2 forks source link

Submodule in subdir #1

Closed mbenz89 closed 5 years ago

mbenz89 commented 5 years ago

Hi.

Great script! Hope it will save me some headache in the future :).

In my configuration, the submodules are located in a dir submodules:

I'm witnessing the following error message for all of the submodules:


Betrete 'submodules/submodule1'
sh: ../update_submodules_helper.sh: No such file or directory

It's obvious that the update_submodules_helper.sh cannot be found since it is located one level further upwards the directory hierarchy.

However, changing the path to ../../update_submodules_helper.sh in update_submodules.sh does not solve the problem:

Betrete 'submodules/submodule1'
sh: ../../update_submodules_helper.sh: No such file or directory

Any idea?

t89 commented 5 years ago

Thank you! The file name update_submodules_helper.sh originates from an older version of the script. I added these lines to handle the absolute paths more reliably. Could you use the new version and try if this error still persists?

https://github.com/t89/matryoshka/blob/fce1581717a02621b16e303eed743380cbe7dc44/matryoshka.sh#L59-L64

mbenz89 commented 5 years ago

Oh, I did not see I'm working with an older version. Works like a charm now!

Thanks for the quick reaction!

mbenz89 commented 5 years ago

On a side note, wouldn't this line commit all submodules (or even all changes) in the current directory? It might make sense to use git add <dir-before-cd..>

t89 commented 5 years ago

I don't like the git add . there, too. ;) It was a temporary solution that stayed because I didn't plan to publish the script initially. It's definetely the first thing to change, though. Thanks for reminding me!

If this script sees frequent use in production I will most likely rewrite it in Python for the sake of robustness and my sanity.

t89 commented 5 years ago

It currently does not hurt too badly, because we are stashing everything beforehand. So even untracked files are stored away. And we are iterating the submodules on a single thread, so the changes ~won't~ shouldn't overlap.

mbenz89 commented 5 years ago

I see. Thanks for clarifying!

t89 commented 5 years ago

It's fixed btw. It worked on my test cases, let me know if you experience any trouble with the change.