EzDevInfo.com

Hook.js

Pull to refresh. For the web.

Putting git hooks into repository

Is it considered to be a bad practice - to put .git/hooks into the projects repository (using symlinks, for example). If yes, what is the best way to deliver same hooks to different git users?


Source: (StackOverflow)

Is there any git hook for pull?

I need to perform some actions (prepare gettext *.mo message files) on my project everytime I run git pull. Is there any suitable git hook, which I could use for this purpose please?


Source: (StackOverflow)

Advertisements

In Git, how can I write the current commit hash to a file in the same commit

I'm trying to do a fancy stuff here with Git hooks, but I don't really know how to do it (or if it's possible).

What I need to do is: in every commit I want to take its hash and then update a file in the commit with this hash.

Any ideas?


Source: (StackOverflow)

How can I prevent Subversion commits without comments?

Does anybody know how to prevent commits to a Subversion code repository when there is no commit comment entered?


Source: (StackOverflow)

Writing a git post-receive hook to deal with a specific branch

Here's my current hook in a bare repo that lives in the company's server: git push origin master This hooks pushes to Assembla. What i need is to push only one branch (master, ideally) when someone pushes changes to that branch on our server, and ignore pushes to other branches. Is it possible to select the branch from a bare repo and push only that branch to Assembla?


Source: (StackOverflow)

How do I make Subversion (SVN) send email on checkins?

I've always found checkin (commit) mails to be very useful for keeping track of what work other people are doing in the codebase / repository. How do I set up SVN to email a distribution list on each commit?

Edit: I'm running clients on Windows and the Apache Subversion server on Linux. The answers below for various platforms will likely be useful to other people though.


Source: (StackOverflow)

How to get the word under the cursor in Windows?

I want to create a application which gets the word under the cursor (not only for text fields), but I can't find how to do that. Using OCR is pretty hard. The only thing I've seen working is the Deskperience components. They support a 'native' way, but I they cost a lot. Now I'm trying to figure out what is this 'native' way (maybe somehow of hooking). Any help will be appreciated.

EDIT: I found a way, but it gets only the whole text of the control. Any idea how to get only the word under the cursor from the whole text?


Source: (StackOverflow)

Share common / useful SVN pre-commit hooks

What are some common and/or useful pre-commit hooks for SVN?


Source: (StackOverflow)

Adding console.log to every function automatically

Is there a way to make any function output a console.log statement when it's called by registering a global hook somewhere (that is, without modifying the actual function itself) or via some other means?


Source: (StackOverflow)

Best way to allow plugins for a PHP application

I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one go about writing 'hooks' into their code so that plugins can attach to specific events?


Source: (StackOverflow)

Git commit hooks - global settings

I've written a Git post-commit hook and it works correctly. However, I want to add this hook to apply to all current (and future) git repositories I am working on. I tried adding the hook to my ~/.git/hooks/ instead of in the hooks directory in the project directory, however, this did not seem to work.

Is there any way to create global Git hooks that will apply to all repositories on my system (without having to copy them into each project directory)? If not, what would be the best solution going forward -- perhaps a git-init template?


Source: (StackOverflow)

How to configure Git post commit hook

I am new to Jenkins. How to trigger a build remotely from Jenkins?
Can anybody tell how to configure Git post commit hook?

My requirement is whenever changes are made in the Git repository for a particular project it will automatically start Jenkins build for that project.

In Jenkins trigger build section I selected trigger build remotely.
In .git directory, hooks directory is there in that we have to configure post commit file.
I am confusing how to trigger a build from there (I know some part we should use curl command).


curl cmbuild.aln.com/jenkins/view/project name/job/myproject/buildwithparameters?Branch=feat-con

I have placed this command in my git server hooks directory (post commit hook).
Whenever the changes happen in repository it is running automate build.

I want to check in changeset whether in at least one java file is there the build should start.
Suppose the developers changed only xml files or property files the build should not start.
Along with xml, suppose the .java files is there the build should start.


Source: (StackOverflow)

CLR profiler: issue in using DefineAssemblyRef

I want to write a CLR profiler to hook our application function with GetILFunctionBody/SetILFunctionBody.

I want to use DefineAssemblyRef to import our c# dll (for use in IL code) in this code DefineAssemblyRef always return True? Does my dll have to be signed? Does it need to be installed in the Global Assembly Cache (GAC)?

     HRESULT CProfilerCallback::JITCompilationStarted
        (
        UINT functionId,
        BOOL fIsSafeToBlock
        )
    {
        ClassID classID;
        ModuleID moduleID;
        mdToken token;
        wchar_t wszClass[512];
        wchar_t wszMethod[512];
        HRESULT result = S_OK;
        ClassID classId = 0;
        ModuleID moduleId = 0;
        mdToken tkMethod = 0;

        // Get the moduleID and tkMethod    
        m_pICorProfilerInfo->GetFunctionInfo(functionId, &classId, &moduleId, &tkMethod);

        if(!GetMethodNameFromFunctionId(functionId,wszClass,wszMethod))
        {return S_FALSE;}


        if(wcscmp(wszMethod,L"FunctionName") == 0)
        {
            // Get the metadata import
            IMetaDataImport* pMetaDataImport = NULL;
            DebugBreak();
            result = m_pICorProfilerInfo->GetModuleMetaData
                (
                moduleId,
                ofRead, 
                IID_IMetaDataImport,
                (IUnknown** )&pMetaDataImport
                );


            if (FAILED(result))
            { return S_FALSE;}  
        //
        // Metadata modification
        //
        IMetaDataEmit* pMetaDataEmit = NULL;    
        IMetaDataAssemblyEmit* pMetaDataAssemblyEmit = NULL;  
        mdAssemblyRef tkLoggerLib;  
        HRESULT res;
        res = m_pICorProfilerInfo->GetModuleMetaData
            (
            moduleId,         /// The ID of the module to which the interface instance will be mapped
            ofRead | ofWrite,
            IID_IMetaDataEmit,
            (IUnknown** )&pMetaDataEmit
            );

        if (FAILED(res)) {DebugBreak();  return S_FALSE;}  /// DebugBreak for debug 

        res = pMetaDataEmit->QueryInterface
            (
            IID_IMetaDataAssemblyEmit,
            (void**)&pMetaDataAssemblyEmit
            );

        if (FAILED(res)) { return S_FALSE;}

        // Get the token for the Logger class and its Log method
        mdTypeDef tkLogger = 0;
        mdMethodDef tkLog = 0;

        // Create a token for the Log.dll assembly
        ASSEMBLYMETADATA amd;
        ZeroMemory(&amd, sizeof(amd));
        amd.usMajorVersion = 0;
        amd.usMinorVersion = 0;
        amd.usBuildNumber = 0;
        amd.usRevisionNumber = 0;

        res= pMetaDataAssemblyEmit->DefineAssemblyRef
            (
            NULL, 0, // No public key token
            L"Dllname",    ///dll name
            &amd, NULL, 0, 0,
            &tkLoggerLib
            );

        if (FAILED(res))  {return S_FALSE;  }

                ......

Source: (StackOverflow)

Linux X11 - Global Keyboard Hook

Is it possible (or how) to create a mechanism (in Linux X11, C++) that works like a global hook in windows (SetWindowsHookEx())?

I would like to be able to catch the key event but with the possibility of further propagation. I'm trying to use a XGrabKey solution (like in xbindkeys) but when I set capturing the key event, this event is "consumed".

Requirements for this mechanism are the following:

  1. Global / system-wide - catching events regardless of the window that has focus
  2. The possibility of "catch-hold" and "catch-pass through"
  3. It must be quite fast

Sample code looks like this:

bool myFlagIsSet = false;
XEvent event;
while (true) {
    while (XPending(display) > 0) {
        usleep(SLEEP_TIME);
    }

    XNextEvent(display, &event);
    switch (e.type) {
        case KeyPress:
            if (myFlagIsSet) {
                //do not propagate
            }
            // propagate
            break;
        case KeyRelease:
            if (myFlagIsSet) {
                //do not propagate
            }
            // propagate
            break;
    }
}

On Windows I simply wrote:

if(event.isConsumed()) {
    return LRESULT(1);
}
//...
return CallNextHookEx(hookHandle, nCode, wParam, lParam);

I've also tried using XUngrabKey and XSendEvent:

switch (event.type) {
    case KeyPress:
        if (myFlagIsSet) {
            //do not propagate
        }
        // propagate
        XUngrabKey(...);
        XSendEvent(..., &event);
        XGrabKey(...);
        break;
    case KeyRelease:
        ...
    }

Unfortunately XSendEvent for unknown reasons to me - do not send this event even if XGrabKey line is commented.

Is it possible to successfully complete this approach?

Please suggest some other approach if I am condemned to failure

EDIT

I would like to implement this on Ubuntu Gnome using Compiz Window Manager


Source: (StackOverflow)

What user runs the git hook?

I have a post-update hook on my server, such that when I

git push

it does a pull on the live web directory. However, while the push always succeeds, the post-update hook sometimes fails.

The hook is pretty simple:

#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
cd /var/www
env -i git pull

I'm pushing updates from a variety of places, but sometimes I have to login as root on the server and manuall do a

env -i git pull

I only have to do it 20% of the time though. Any ideas why it would fail randomly? Also, how would I get it to log error messages, since it might be running as someone who can't write to the file system?


Source: (StackOverflow)