Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor shared hooks settings #125

Merged
merged 38 commits into from
Oct 1, 2020

Conversation

gabyx
Copy link
Contributor

@gabyx gabyx commented Sep 14, 2020

Based on discussion in #122. Based on #119.

- local urls do not get cloned nor updated
- due to security reasons and also since local urls for local shared hooks do not make sense
@coveralls
Copy link

coveralls commented Sep 14, 2020

Pull Request Test Coverage Report for Build 806

  • 388 of 537 (72.25%) changed or added relevant lines in 4 files are covered.
  • 6 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-2.08%) to 80.671%

Changes Missing Coverage Covered Lines Changed/Added Lines %
base-template.sh 113 120 94.17%
cli.sh 205 243 84.36%
install.sh 66 170 38.82%
Files with Coverage Reduction New Missed Lines %
uninstall.sh 1 86.75%
install.sh 2 68.32%
cli.sh 3 84.6%
Totals Coverage Status
Change from base Build 751: -2.08%
Covered Lines: 2358
Relevant Lines: 2923

💛 - Coveralls

This was referenced Sep 14, 2020
@gabyx
Copy link
Contributor Author

gabyx commented Sep 15, 2020

@rycus86
Its kind of difficult and to much work I have time for right now to rebase this changes onto master, and then again resolve all merge conflicts again...
Can we make a dev branch. and merge the revised #119 (improve legacy transform as discussed, also its not yet tested) into the dev first. And then we merge, #125 . And afterwards I will test and improve again. on the dev branch. Until we merge both changes back.
Is that a plan?

gabyx and others added 7 commits September 15, 2020 15:34
Fix opensuse by updating git ⚡
- Another `GIT_DIR` in `is_bare_repo` bug with old versions
`githooks.testingTreatFileProtocolAsRemote` to bypass rejection
- Make install legacy transform to change local paths in .shared file
- `--shared` -> `.githooks/.shared` file
- `--local` -> local Git config `githooks.shared`
- `--global` -> global Git config `githooks.shared`
@gabyx gabyx force-pushed the feature/refactor-shared-hooks-settings branch from 515788c to d815089 Compare September 15, 2020 18:22
@rycus86
Copy link
Owner

rycus86 commented Sep 15, 2020

@rycus86
Its kind of difficult and to much work I have time for right now to rebase this changes onto master, and then again resolve all merge conflicts again...
Can we make a dev branch. and merge the revised #119 (improve legacy transform as discussed, also its not yet tested) into the dev first. And then we merge, #125 . And afterwards I will test and improve again. on the dev branch. Until we merge both changes back.
Is that a plan?

Yeah, if it's too hard to pull out those changes, let's merge them, it's just going to be a bit harder to review. Can you merge all you changes into #125 (or #119) instead of creating a new branch on this side?

@gabyx
Copy link
Contributor Author

gabyx commented Sep 15, 2020

Jeah I can do that! thanks! I merge into #125

@gabyx
Copy link
Contributor Author

gabyx commented Sep 15, 2020

Lets first dicuss all these changes, then we can discuss the legacy transform, it maybe needs a test (more work ;-))

@gabyx
Copy link
Contributor Author

gabyx commented Sep 16, 2020

@rycus86 : All tests pass. Thanks for the review.

@gabyx
Copy link
Contributor Author

gabyx commented Sep 17, 2020

@rycus86 If you find some time reviewing this on the weekend would be great, so I can improve it next week. I wont have time on the weekend, :-)

@rycus86
Copy link
Owner

rycus86 commented Sep 18, 2020

#125 (comment)

Sure, let me try to make sure it's reviewed for you by the end of this week. Thanks a lot!

base-template.sh Outdated Show resolved Hide resolved
base-template.sh Outdated Show resolved Hide resolved
base-template.sh Outdated Show resolved Hide resolved
base-template.sh Outdated Show resolved Hide resolved
base-template.sh Outdated Show resolved Hide resolved
tests/step-117.sh Outdated Show resolved Hide resolved
gabyx and others added 2 commits September 25, 2020 13:25
Co-authored-by: Viktor Adam <rycus86@gmail.com>
@gabyx
Copy link
Contributor Author

gabyx commented Sep 25, 2020

@rycus86 Please see my latest commits. Also for useCoreHooksPath the variable failOnNonExistingHooks comes here very handy :-)

@gabyx gabyx force-pushed the feature/refactor-shared-hooks-settings branch from d6ad697 to d857551 Compare September 27, 2020 17:47
install.sh Outdated Show resolved Hide resolved
echo >&2
echo "! Info: Because the hash algorithm changed from" >&2
echo " $(md5sum) to $(git hash-object)," >&2
echo " you unfortunately need to retrust all hooks again." >&2
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
echo " you unfortunately need to retrust all hooks again." >&2
echo " you will need to accept and trust all hooks again" >&2
echo " if this is not a trusted repository." >&2

Copy link
Owner

Choose a reason for hiding this comment

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

Does this code run only once by the way, or once for every repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: This is about: legacy_transform_split_global_shared_entries which runs globally once when detected by legacy_transform_is_ancestor

Copy link
Owner

Choose a reason for hiding this comment

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

Hm, looks like you resolved this without actually changing the text.
It might be good to fix it up afterwards, please.

install.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
install.sh Show resolved Hide resolved
tests/step-119.sh Outdated Show resolved Hide resolved
gabyx and others added 5 commits September 29, 2020 09:12
Co-authored-by: Viktor Adam <rycus86@gmail.com>
- test 119 not working yet, because we need
  `git worktree list --porcelain` in the update call
In earlier version git `git worktree list` returns a .git
directory which we strip off.
@gabyx
Copy link
Contributor Author

gabyx commented Sep 30, 2020

Coverage went down significantly due to test119, which I dont know how to cover yet.
@rycus86 : Would that PR be ready to merge, if no major resistance?

@rycus86
Copy link
Owner

rycus86 commented Sep 30, 2020

Coverage went down significantly due to test119, which I dont know how to cover yet.
@rycus86 : Would that PR be ready to merge, if no major resistance?

I'm still not convinced about the whole commit tracking thing for upgrades, but it doesn't sound like I can talk you out of it.
I'll try to have a look later and if there's nothing else standing out, I'll merge this in.

@gabyx
Copy link
Contributor Author

gabyx commented Sep 30, 2020

We could keep the local paths transform out from local commit tracking, and just warn and let it fail after the users try to use them.
But as I just found out: I also split everything into seperate lines with this legacy transform, because we only allow seperate lines in .shared files from this PR on. Urls/Paths can have commas. So that makes the "local path transform" also dependend on the fact "you only want to do that once" -> meaning we need this tracking as in the case of the "global config splitting".

@gabyx
Copy link
Contributor Author

gabyx commented Sep 30, 2020

Thanks for looking it through again! Maybe you spot some more errors, I hope now all bad ones should be gone.
Thanks @matthijskooijman for the reviews.

install.sh Show resolved Hide resolved
install.sh Show resolved Hide resolved
@rycus86 rycus86 merged commit ab43142 into rycus86:master Oct 1, 2020
@gabyx gabyx deleted the feature/refactor-shared-hooks-settings branch October 1, 2020 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants