-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Merge analysis support for bare repos #5022
Merge analysis support for bare repos #5022
Conversation
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.
Hello @rcoup, thanks for the PR ! Your fix is fine with me, but I'm not fond of the duplicate tests, hence some remarks :
- A "this has been duplicated as" comment at the top of both files would be a 👍, just so changes can be propagated.
- It might be possible to bare-clone from the other repo when initializing the testcase, but I'm not sure about runtime speed.
- Test case duplication : this has been bothering me as well (surprisingly, on the topic of bare repositories), but I don't think it can be done cleanly without changes to clar (something like RSpec's
behaves
). The only alternative I can think of is preprocessor tomfoolery (having a "shared"analysis.template
, and include this from both.c
files, switching the prefixes from the template, but meh).
I'm OK with merging it as is, I just want to fly those clar questions through maintainers 😉.
Yeah, I wasn't too excited about it either.
Can do this easily.
Any examples in the test suite for doing this? I guess it's just
backs away slowly 🐉🐍 Alternatively as a simple starting point before clar supports parameterisation I could probably move all the analysis test bodies into |
#define ANALYZED_REPO "merge-analysis-bare.git"
/* cl_sandbox setup, pretty standard, using the non-bare version */
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
opts.bare = 1;
git_clone(ANALYZED_REPO, &opts);
git_futils_rmdir_r(ANALYZED_REPO); Code mildly brain-compiled. Helpful "low-level" utilities can be found in futils.c/h, path.c/h, good-ol' buffer.c/h, as well as the clar headers.
Yeah, I'd much prefer having a clean implementation if that's something we ever want. For now, a documentation comment is sufficient in my eyes. Again, thanks for doing this ! |
You could just use |
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.
Some nits with regards to style, but otherwise I'm fine with this PR. Thanks for amending!
I addressed all those. I can't quite spot my error which is triggering valgrind though. Any obvious insight? |
tests/merge/analysis.c
Outdated
git_merge_analysis_t merge_analysis; | ||
git_merge_preference_t merge_pref; | ||
|
||
git_repository_config(&config, repo); |
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.
You're not free
ing this...
Not sure offhand. But something is probably incrementing the refcount on the repository, so your call to My guess is that it's that |
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.
I can't quite spot my error which is triggering valgrind though. Any obvious insight?
Not sure offhand. But something is probably incrementing the refcount on the repository, so your call to repository_free isn't actually disposing it (just reducing the refcount).
My guess is that it's that git_repository_config but I'm not 100%.
It is. All leaks point to the repository configuration snapshots, which are leaked in merge::analysis::no_fastforward_with_config_ffonly
and merge::analysis::fastforward_with_config_noff
. Sorry for not spotting these in my previous review.
Aha, it had passed CI before my test refactoring which had confused me, I assumed it was related to the init/reorg. <looking in the wrong place> Thanks 😄 OT: Valgrind on OSX (3.14.0/Homebrew) reports a pile of leaks, even when using |
dupe of workdir/analysis.c against a bare repo.
- move duplication between merge/trees/ and merge/workdir/ into merge/analysis{.c,.h} - remove merge-resolve.git resource, open the existing merge-resolve as a bare repo instead.
- whitespace -> tabs - comment style - improve repo naming in merge/trees/analysis tests.
Wrap some missed setup api calls in asserts.
e406132
to
438c995
Compare
Rebased onto newer master |
Although we checked in We use
|
/rebuild |
Okay, @rcoup, I started to rebuild this pull request as build #2028. |
@ethomson aha, victory! that works (I've never used |
Whoa, that would be great. 🙇 |
@pks-t you happy for this to be merged now? |
Looks good to me now, thanks for your work @rcoup! I'll do a follow-up to make use of our new test variants so that we can avoid the duplication, but seeing as that only got merged a few days ago I don't want to shift that burden on you. |
Fix for #5017
For testing, I copiedtests/merge/workdir/analysis.c
intotests/merge/trees/
, and (manually) convertedtests/resources/merge-resolve/
repo into a baretests/resources/merge-resolve.git/
repo.For testing, I refactored
tests/merge/workdir/analysis.c
into two matching test suites with a common implementation, one for working dirs and one for bare trees.