# HG changeset patch # User Meredith Howard # Date 1590942821 18000 # Node ID be7ff50ed819d250783898eed147d6cdc489b898 # Parent dc834fea1a3f2f16c8f3313009147d762fa16908 keep these in git-helpers diff --git a/bin/git-ctags b/bin/git-ctags deleted file mode 100755 --- a/bin/git-ctags +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env ruby -exit if ENV['CTAGS_SKIP'] -running_hook = ENV['CTAGS_HOOK'] || false -ctags_cmd = ENV['CTAGS_CMD'] || 'ctags' - -case ARGV[0] -when 'help' - exec 'perldoc', '-T', $0 -when 'hook' - running_hook = true -end - -if (dir = `git rev-parse --show-toplevel 2>/dev/null`.chomp) != '' - list_cmd = 'git ls-files' - conf = "#{dir}/.git/ctags.conf" -elsif (dir = `hg root 2>/dev/null`.chomp) != '' - list_cmd = 'hg stat -Aqn' - conf = "#{dir}/.hg/ctags.conf" -else - abort 'not an hg or git repository' -end - -target = "#{dir}/.tags" -tmp = "#{dir}/.tags.#{$$}~" -opts = File.exists?(conf) ? "--options=#{conf}" : '' - -if running_hook - fork and exit - [STDIN, STDOUT, STDERR].each {|p| p.reopen '/dev/null'} - sleep 5 -end - -open(target, File::RDONLY|File::CREAT, 0644) do |f| - if running_hook - exit unless f.flock(File::LOCK_EX|File::LOCK_NB) - exit unless f.size == 0 || (Time.now - f.mtime) > 60 - end - - system(<<-CMD) or exit $?.exitstatus - #{list_cmd} \ - | #{ctags_cmd} --tag-relative -L - -f"#{tmp}" #{opts} \ - && mv #{tmp} #{target} - CMD -end - -exit 0 - -__END__ -=head1 NAME - -git-ctags - run ctags on git tracked files - -=head1 SYNOPSIS - - git ctags - - echo 'git ctags hook 2>/dev/null' >> .git/hooks/post-checkout && - chmod +x $_ - - git checkout some/branch - CTAGS_SKIP=1 git checkout some/branch - -=head1 DESCRIPTION - -Create a .tags file (target) using git's list of tracked files. If -C<.git/ctags.conf> exists in the repo it is passed to the ctags invocation. - -When run with the C argument or C set, additional behavior is -enabled to avoid excess re-runs during multiple VCS operations, and the work is -moved to background as well. - -=head2 Mercurial - -Mercurial repositories are supported too, with git taking priority when finding -a repo root. To add a hook, in the repository C<.hg/hgrc>, add: - - [hooks] - update = git ctags hook - -In a Mercurial repo, additional options can be put in C<.hg/ctags.conf>. - -=head1 ENVIRONMENT - -=head2 CTAGS_SKIP - -If defined, exit immediately. - -=head2 CTAGS_HOOK - -If defined, run as a VCS hook. This causes git-ctags to fork and exit, wait five -seconds, then try to lock and update the tags file if it hasn't been updated in -the last minute. - -=head2 CTAGS_CMD - -If defined, use this to invoke ctags rather than assuming C can be found in -path. - -=cut diff --git a/bin/git-histedit b/bin/git-histedit deleted file mode 100755 --- a/bin/git-histedit +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -set -eu - -case ${1:-} in *help|-h) - exec perldoc -T $0;; -esac - -BRANCH="$(git symbolic-ref --short -q HEAD)" -BASE=$(git merge-base "@{u}" "$BRANCH") - -exec git rebase --interactive --autosquash "$@" "$BASE" "$BRANCH" - -:<<=cut -=head1 NAME - -git histedit - -=head1 SYNOPSIS - - $ git histedit - -=head1 DESCRIPTION - -C lets you edit the current branch using interactive rebase, but -without actually I the fork point of your branch, avoiding the -complications of fixing up your history and dealing with merge conflicts at the -same time. - -See also: C - -=cut