rugged icon indicating copy to clipboard operation
rugged copied to clipboard

Tree#diff: unexpected behavior of option :ignore_submodules

Open alexey-igrychev opened this issue 8 years ago • 3 comments

Doc

:ignore_submodules if true, submodules will be excluded from the diff completely.

Problem

repo 	= Rugged::Repository.new('.')
commit 	= repo.head.target_id
diff    = Rugged::Tree.diff(repo, nil, commit, ignore_submodules: true)

I expect excluding all submodules files but have following:

diff.patches.map { |p| p.delta.new_file[:path] }
=> [".gitmodules", "submodule_repo"]

What is wrong with it?

alexey-igrychev avatar Dec 29 '17 11:12 alexey-igrychev

diff will not recursively open submodules and display their changes, it will only show you that a submodule has changed. If you want to see the changes in the submodule you will need to open it and run the diff in that repository as well.

ethomson avatar Dec 29 '17 12:12 ethomson

Thanks, @ethomson. I understand that I can work with submodules like independent repositories but want to ignore ones in base repository diff. Could you explain me how do it and what is :ignore_submodules option for?

alexey-igrychev avatar Dec 29 '17 12:12 alexey-igrychev

Thanks for clarifying @alexey-igrychev, I misread your question. Indeed I do not know why that's behaving that way at the moment. Will have to investigate.

ethomson avatar Dec 29 '17 12:12 ethomson