-
Notifications
You must be signed in to change notification settings - Fork 17.3k
git-diff: Fix subfolder git detection #21631
Conversation
|
TODO: Add tests. |
|
@utkarshgupta137 Thanks for the contribution. It would really help If you could add tests on this. |
|
@sadick254 Done. I've also updated the corresponding PR in tabs package: atom/tabs#560. I'm not sure the 1 test failing for this PR is related to this PR at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you modifying an existing Unit Test? This invalidates the purpose of the test you're modifying, and to make matters worse, the test you've turned it into couldn't be a conclusive test because the sample environment you're using is a direct copy of the initial container.
What should be done is as follows:
- Make a new copy of the existing test suite
- Do as you've done here within that new copy of test suites and add the child working directory.
- Grab a hook in each of the new tests pointing to the child repository so you can track that the child is being modified after every insertion and deletion, so on and so forth.
As an alternative you could have done steps 2 and 3 in every existing Unit Test, but that would have invalidated the Unit Test scheme. You should have a test for every feature. Since you're making a modification that coppies an existing set of features to a new target, you need to do the same to prevent regression.
| path.join(projectPath, 'sample.txt'), | ||
| path.join(projectPath, 'working-dir', 'sample.txt'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damnit I highlighted more lines than that! Where's the container Unit Test in question Github!?
|
Also sorry for being so awkward with the review, I'm really new to submitting reviews so the UI's a bit foreign at the moment. |
|
@patricecoulon
I personally have a zero tolerance policy so I'll be watching your profile for a while. If you thought someone's review or contribution needs improvement, please do everyone a favor and actually say something useful. For example, I don't like @aminya's review format personally, but they've contributed to some really cool projects and are an otherwise really cool person. What you just said was uncalled for. |
|
@M3TIOR I've modified the existing test case to see if git-diff works when the repository is inside another folder. If the git-diff is working on a repository inside a project folder, then it will surely work for any other repository in any other folder structure. I do understand that I've converted the test condition from necessary to sufficient for this case. If you want me to, I can separate the two tests cases/suites. |
|
I think that would be in the best interest of the project. The following are some good principals to follow when writing unit tests IMO, but I deffer to the Atom maintainers since they have the final say anyhow:
Trying really hard to think of a way to word that last part that doesn't make me sound like a jerk. It's understandable how it could go over your head if English isn't your first language. But I can't really assume that it isn't your first language because most English speakers where I'm from don't really use it formally where I read it. And I have Aspergers so trying to parse informal English is a bit rough. What I'm trying to say, is that Islamophobic jerk who showed up here earlier, has made it impossible for me to feel as though I'm communicating in a way that's not insensitive. 😩 I don't want to assume you're ignorant, and I also don't want to assume you're not from America, because I don't know you at all. Not that being from a different country is bad. I'm just worried because most Americans I know would take offense to having their nationality or language fluency brought into question. |
|
@M3TIOR I've duplicated the test suite with changes required for testing subfolder detection & have kept the original test suite as is. |
M3TIOR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far, it doesn't look like there's any way to test what we need to in any reasonable manner. Unfortunately it will have to be hacked together. As much as I don't like that. Since the test suite needed is very complicated to administer, this will be good enough for now once you have modified the names of the tests to appropriately convey their unique purposes.
If you're willing to go the extra mile and make the test 100% regression-proof, I'm sure the Atom maintainers would appreciate it though.
|
Hey @utkarshgupta137. Apologies for not looking into this on time. I know this PR has been here for a long time, during that time Atom has seen a number of changes. Due to the changes, this PR has now become outdated. Is it possible for you to resolve the conflicts? |
|
@sadick254 Done. |
|
@utkarshgupta137 Thank you for resolving the conflicts. This looks good, however, there are some comments from @M3TIOR that have not been resolved. Can we get those resolved? |
joMarot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not all green.
|
I rebased my spec for this commit. A brief note: I don''t know what happened between the last Atom version I worked on and the current development version though I could look through the commit history and trudge through to find a solution, but I really don't have the energy, please forgive my laziness at this juncture. For some reason all my async Jasmine specs are breaking. Specifically timing out repeatedly, and I can't get Jasmine to give me a longer timeout to see if there are any real bugs in my specs. With that said, I hope this helps. |
|
@sadick254 It looks like the tests are failing at an unrelated stage: https://github.visualstudio.com/Atom/_build/results?buildId=116370&view=logs&j=e4115def-01ab-568c-a31a-bc15166ffabd&t=c4607463-cf32-4eef-9650-44237e8b1b61&l=542. Otherwise, it is good to go. |
|
As much as I'd like to write off the errors within the module as a consequence of core modifications; why is it that only core tests are being run @sadick254 ? Shouldn't Jasmine be running the full sub-module tests? Maybe this comes down to a resource availability problem, or a test suite limitation, but if a submodule was edited in the last commit it should be tested as well as the core. Otherwise you may be introducing regressions. I could potentially start working on a patch for the test suite to detect what the git repositories last modifications were, and automate the test suite to run their specs during merges or commits for those. If you think that's a good idea anyway. |
@utkarshgupta137 I re-ran the tests on the pipeline and it looks like the changes from this PR is definitely causing the failure, would you mind taking a look? |
|
So, this may come down to something I did. Either when I rebased I did so over the wrong base; ie from a dev branch. Whatever the reason, I double-checked my original modifications on the release branches and they work. I'll work on rebasing this again with a stable branch like v1.59.0-dev or v1.58.0 some time in the near future. |
|
This PR has been superseded by #23446 |
Identify the Bug
Fixes #21630.
Fixes atom/github#1149.
Fixes atom/github#1835.
Linked PRs:
tree-view: atom/tree-view#1367
tabs: atom/tabs#560
status-bar: aminya/status-bar#4
minimap-git-diff: atom-minimap/minimap-git-diff#31
file-icons: file-icons/atom-fs#9
linter: steelbrain/linter#1715
Description of the Change
By using atom.project.repositoryForPath function instead of matching the path with added directories, subfolders will get identified.
Made necessary changes to referenced places to handle the async nature of the atom.project.repositoryForPath.
Alternate Designs
None.
Possible Drawbacks
Since atom.project.repositoryForPath is an async function, there maybe a little lag when loading file which already has changes.
Verification Process
TODO
Release Notes