Skip to content

Conversation

@jawshooah
Copy link
Collaborator

Don't clear the working tree or apply the last stash if only submodule changes are staged.

Fixes #148

@lencioni
Copy link
Collaborator

This looks good to me, but @sds has more context and might have better thoughts.

Can you write a test to go along with this?

@lencioni
Copy link
Collaborator

Oh, also thanks for the speedy pull request!

Ensure that when only a submodule change is staged, the change
is not affected by #setup_environment and #cleanup_environment.

Change-Id: Idbfd394c156369d9f86355e808097f2548f4e8a8
Change-Id: I5fd7db9a291aa87fcdf3fed860b18e7a9ac6a450
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to check that the submodule change was committed, rather than checking that the diff was empty? It's possible that we simply lost all changes, in which case the diff would still be empty.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But setup_environment and cleanup_environment run before the commit. Are you suggesting something like this?

`git commit -m "Submodule update"`
`git show`.should match(/-Subproject commit[\s\S]*\+Subproject commit/)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, poor terminology on my part. We should check that git diff --cached has the submodule change in it (i.e. that the changes are still staged). Make sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, I'll make the change.

@sds sds added the bug label Mar 26, 2015
Change-Id: Ibe489e9d606761f4001c6749a199522a6a591803
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sds How's this?

@sds
Copy link
Owner

sds commented Mar 26, 2015

Thanks! Merged in 9172dd3.

@sds sds closed this Mar 26, 2015
@jawshooah jawshooah deleted the bugfix/submodule-only branch April 3, 2015 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to commit only submodule updates

3 participants