question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

post-merge doesn't seem to find files to check

See original GitHub issue

search tried in the issue tracker

yes. a lot.

describe your issue

I want to trigger a custom commit hook on post merge, ideally with a list of of incoming file changes.

Custom hook config:

-   id: run-pbi-tools-post-merge
    name: pbi-tools compile (post merge)
    description: invoke pbi-tools to compile powerbi proj-folders into reports
    entry: run-pbi-tools-post-merge
    language: python
    files: ''                   # all files
    require_serial: true        # no parallel invocation
    verbose: true
    stages: [post-merge]

Client-side repo config:

repos:
- [...]
-   repo: https://github.com/myorg/precommit_hooks
    rev: 0.1.3
    hooks:
    -   id: run-pbi-tools-post-merge

I’ve installed pre-commit for post-merge (pre-commit install -t post-merge), however pre-commit isn’t invoking the hook:

git pull
Updating 87c6d50..f51cb2a
Fast-forward
 trigger.txt | Bin 0 -> 82 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 trigger.txt
pbi-tools compile (post merge).......................(no files to check)Skipped
- hook id: run-pbi-tools-post-merge

I would expect the hook to be invoked for trigger.txt.

I’m getting similar output when manually invoking the hook for trigger.txt:

pre-commit run --verbose --hook-stage post-merge --files trigger.txt
pbi-tools compile (post merge).......................(no files to check)Skipped
- hook id: run-pbi-tools-post-merge

… or for all files:

pre-commit run --verbose --all-files --hook-stage post-merge
pbi-tools compile (post merge).......................(no files to check)Skipped
- hook id: run-pbi-tools-post-merge

Is this a misconception on my end? My use case is running a script on pull to restore meta-data that was split up on commit. Maybe someone could point me towards an example that does something similar? So far I haven’t been able to find any.

pre-commit --version

2.20.0 (running on Windows)

.pre-commit-config.yaml

repos:
- [...]
-   repo: https://github.com/myorg/precommit_hooks
    rev: 0.1.3
    hooks:
    -   id: run-pbi-tools-post-merge

~/.cache/pre-commit/pre-commit.log (if present)

./.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jangrothcommented, Jul 18, 2022

Update for future readers that might search for issues with post_merge:

This hook can be invoked without file names being submitted by configuring always_run: true in .pre-commit-config.yaml

git pull
Updating 25d7641..629438c
Fast-forward
 trigger.txt | Bin 0 -> 82 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 trigger.txt
pbi-tools compile (post merge)...........................................Passed
- hook id: run-pbi-tools-post-merge
- duration: 0.62s

2022-07-19 09:20:43,820 run_pbi_tools DEBUG Invoking post_merge_handler with Namespace(filenames=[])
0reactions
jangrothcommented, Jul 19, 2022

Hi @asottile - thanks for getting back to me.

Let me make myself clear: I think pre-commit is great and I very much appreciate your work. Also, I understand that you are running this in your own time and I have zero expectation for you to sacrifice your time beyond what you are willing to spend on this project.

Maybe in turn you can understand where I was coming from: I had already spent days working with & learning the framework. Only last week I moved to the post-merge bit of my work and yes, I misunderstood the relevance of the paragraph you pointed me to and also did not make the connection between post_checkout (always_run documented) and post_merge (always_run not mentioned). However, not only is this really difficult stuff, I also made an honest effort to solve the problem without having to post an issue here, including spending considerable time here and on SoF. So yes, ‘RTFM’ wasn’t the answer I was hoping for. There might also be a little bit of cultural differences in the mix, what you consider ‘brevity’ in English is a solid 8/10 ‘rudeness’ in German 😃

However, all good from my end, and as I said, I really appreciate your work here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Merge - Incomplete, Missing files and Folders
But when I checked this newly merged working tree is missing a lot of folders and files from dev. git status // Shows...
Read more >
Skip or Merge files option missing after installing updates on ...
Try copying the files with same names and see if you get the Skip or replace option window. Method 2: Uncheck the Folder...
Read more >
The Ultimate Guide to Post Merger (M&A) Integration Process
Post -Merger Integration (PMI) or M&A Integration: a process of rearranging business with the merger and acquisition of one company by another.
Read more >
10 Common Mail Merge Problems in Microsoft Word
Problems can arise when mail merging in Microsoft Word. Here are some common problems found when mail merging in Word and how to...
Read more >
git: fetch and merge, don't pull | Mark's Blog
When merging with git merge, you only specify the branch you want to merge ... (a) “Local branches”: what you see when you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found