Skip to content

Commit

Permalink
fix: Revert "feat(git): allow to install git-hook functions to local …
Browse files Browse the repository at this point in the history
…repositories" (#19773)
  • Loading branch information
viceice committed Jan 10, 2023
1 parent 107c80b commit 054e157
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
26 changes: 0 additions & 26 deletions lib/util/git/index.spec.ts
Expand Up @@ -1056,30 +1056,4 @@ describe('util/git/index', () => {
expect(sha).toBe(git.getBranchCommit(defaultBranch));
});
});

describe('installHook()', () => {
it('installHook()', async () => {
//git.getCommitMessages() only returns the first line (i.e. subject) of each msg
await git.installHook(
'commit-msg',
'#!/bin/sh\necho "APPENDED FROM COMMIT-MSG HOOK" >> $1;'
);
const files: FileChange[] = [
{
type: 'addition',
path: 'some-new-file',
contents: 'some new-contents',
},
];
setNoVerify(['push']);
await git.commitFiles({
branchName: 'renovate/something',
files,
message: 'Orig-commit-msg',
});

const messages = await git.getCommitMessages();
expect(messages[0]).toBe('Orig-commit-msg APPENDED FROM COMMIT-MSG HOOK');
});
});
});
11 changes: 0 additions & 11 deletions lib/util/git/index.ts
Expand Up @@ -249,17 +249,6 @@ export async function initRepo(args: StorageConfig): Promise<void> {
await fetchBranchCommits();
}

export async function installHook(
name: string,
hookSource: string
): Promise<void> {
await syncGit();
const localDir = GlobalConfig.get('localDir')!;
const gitHooks = upath.join(localDir, '.git/hooks');
await fs.writeFile(`${gitHooks}/${name}`, hookSource);
await fs.chmod(`${gitHooks}/${name}`, 0o500);
}

async function resetToBranch(branchName: string): Promise<void> {
logger.debug(`resetToBranch(${branchName})`);
await git.raw(['reset', '--hard']);
Expand Down

0 comments on commit 054e157

Please sign in to comment.