diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-10-27 20:37:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-10-27 23:54:47 -0400 |
commit | 4881600256b34b4ba3cefee2b708f6c224c13805 (patch) | |
tree | 644d967f31201683a04726bcc9c9668eed41ba01 /bin/git | |
parent | c7388cfd8e0f3a00b7c6b72c26bd8292ef8811fa (diff) | |
download | conf-4881600256b34b4ba3cefee2b708f6c224c13805.tar.gz conf-4881600256b34b4ba3cefee2b708f6c224c13805.zip |
remove git subcommands i never use
Diffstat (limited to 'bin/git')
-rwxr-xr-x | bin/git/git-author-stat | 8 | ||||
-rwxr-xr-x | bin/git/git-svn-abandon-cleanup | 16 | ||||
-rwxr-xr-x | bin/git/git-svn-abandon-fix-refs | 63 | ||||
-rwxr-xr-x | bin/git/git-svn-abandon-msg-filter | 52 | ||||
-rw-r--r-- | bin/git/git-test-sequence | 95 | ||||
-rwxr-xr-x | bin/git/git-unmerged | 30 | ||||
-rwxr-xr-x | bin/git/git-vee | 78 |
7 files changed, 0 insertions, 342 deletions
diff --git a/bin/git/git-author-stat b/bin/git/git-author-stat deleted file mode 100755 index 4747fce..0000000 --- a/bin/git/git-author-stat +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -git log "$@" | \ -git shortlog | \ -perl -ne 'print if/^\S+/' | \ -perl -pe 's/(.*)\((\d+)\).*/$2: $1/' | \ -sort -gr | \ -less -MSi; diff --git a/bin/git/git-svn-abandon-cleanup b/bin/git/git-svn-abandon-cleanup deleted file mode 100755 index 2e2a547..0000000 --- a/bin/git/git-svn-abandon-cleanup +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# strip svk and git-svn noise, retaining tags -git filter-branch --tag-name-filter cat --msg-filter "git svn-abandon-msg-filter" -- --all - -# remove the backup refs -git for-each-ref --format='%(refname)' refs/original/ refs/remotes/svn/ | while read ref; do - git update-ref -d "$ref" -done - -# ditch all pre-conversion objects forcefully -git reflog expire --all --expire=now -git gc --aggressive - -git prune -git fsck --full diff --git a/bin/git/git-svn-abandon-fix-refs b/bin/git/git-svn-abandon-fix-refs deleted file mode 100755 index c47405d..0000000 --- a/bin/git/git-svn-abandon-fix-refs +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -# clean up working dir - -git update-ref -d master - -# create annotated tags out of svn tags -git for-each-ref --format='%(refname)' refs/remotes/svn/tags/* | while read tag_ref; do - tag=${tag_ref#refs/remotes/svn/tags/} - tree=$( git rev-parse "$tag_ref": ) - - # find the oldest ancestor for which the tree is the same - parent_ref="$tag_ref"; - while [ $( git rev-parse --quiet --verify "$parent_ref"^: ) = "$tree" ]; do - parent_ref="$parent_ref"^ - done - parent=$( git rev-parse "$parent_ref" ); - - # if this ancestor is in trunk then we can just tag it - # otherwise the tag has diverged from trunk and it's actually more like a - # branch than a tag - merge=$( git merge-base "refs/remotes/svn/trunk" $parent ); - if [ "$merge" = "$parent" ]; then - target_ref=$parent - else - echo "tag has diverged: $tag" - target_ref="$tag_ref" - fi - - # create an annotated tag based on the last commit in the tag, and delete the "branchy" ref for the tag - git show -s --pretty='format:%s%n%n%b' "$tag_ref" | \ - perl -ne 'next if /^git-svn-id:/; $s++, next if /^\s*r\d+\@.*:.*\|/; s/^ // if $s; print' | \ - env GIT_COMMITTER_NAME="$( git show -s --pretty='format:%an' "$tag_ref" )" \ - GIT_COMMITTER_EMAIL="$( git show -s --pretty='format:%ae' "$tag_ref" )" \ - GIT_COMMITTER_DATE="$( git show -s --pretty='format:%ad' "$tag_ref" )" \ - git tag -a -F - "$tag" "$target_ref" - - git update-ref -d "$tag_ref" -done - -# create local branches out of svn branches -git for-each-ref --format='%(refname)' refs/remotes/svn/ | while read branch_ref; do - branch=${branch_ref#refs/remotes/svn/} - git branch "$branch" "$branch_ref" - git update-ref -d "$branch_ref" -done - -# rename 'trunk' to 'master' -git checkout trunk -git branch -M trunk master - -# remove merged branches -git for-each-ref --format='%(refname)' refs/heads | while read branch; do - git rev-parse --quiet --verify "$branch" || continue # make sure it still exists - git symbolic-ref HEAD "$branch" - git branch -d $( git branch --merged | grep -v '^\*' ) -done - -git checkout master - -# list possible merge commits to help create a grafts file -git log --pretty=one --all -E --grep='[mM]erge|\(orig r' - diff --git a/bin/git/git-svn-abandon-msg-filter b/bin/git/git-svn-abandon-msg-filter deleted file mode 100755 index 540b4c8..0000000 --- a/bin/git/git-svn-abandon-msg-filter +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -my $svn_id; -my $msg = ''; - -while (<>) { - if ( /^git-svn-id: (.*)/ ) { - $svn_id = $1; - } else { - $msg .= $_; - } -} - -# if this is a merge commit, rewrite the message to have a better "subject" -if ( $msg =~ /^\s*r\d+\@.*\(orig r\d+\):/ ) { - # print the original message - $msg =~ s/^ //mg; - - my ( $to, @from ) = ( split /\s+/, `git show -s --pretty='format:%P' $ENV{GIT_COMMIT}` ); - - print "Merge ", - join(", ", map { format_branch($_) } @from), - " into ", - format_branch($to), - "\n\n", - $msg; -} else { - if ( $msg =~ s/^\s*r\d+\@.*:.*$//m ) { - $msg =~ s/^ //mg; - } - - print $msg; -} - -sub format_branch { - my $commit = shift; - - my $body = `git show -s --pretty='format:%b' $commit`; - - if ( $body =~ m{git-svn-id: .*/branches/(.*?)\@} ) { - return "'$1'"; - } elsif ( $body =~ m{git-svn-id: .*/trunk\@} ) { - return "'trunk'"; - } elsif ( $body =~ /\@r(\d+)/ ) { - return $1; - } else { - die "unknown rev for $commit"; - } -} diff --git a/bin/git/git-test-sequence b/bin/git/git-test-sequence deleted file mode 100644 index 5aa4d27..0000000 --- a/bin/git/git-test-sequence +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh -# Run a command over a sequence of commits. -# Example: -# git test-sequence origin/master.. 'make clean && make test' - -. git-sh-setup -require_work_tree - -t= -run_once= -ref_name=pass - -# The tree must be really really clean. -if ! git update-index --ignore-submodules --refresh > /dev/null; then - echo >&2 "cannot rebase: you have unstaged changes" - git diff-files --name-status -r --ignore-submodules -- >&2 - exit 1 -fi -diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --) -case "$diff" in - ?*) echo >&2 "cannot rebase: your index contains uncommitted changes" - echo >&2 "$diff" - exit 1 - ;; -esac - -start_branch=`git rev-parse --symbolic-full-name HEAD | sed s,refs/heads/,,` -git checkout `git rev-parse HEAD` > /dev/null 2>/dev/null - -cleanup() { - git checkout $start_branch > /dev/null 2>/dev/null -} - -already_passed() { - obdata=${ref_name}-$t-$1 - obhash=`echo $obdata | git hash-object --stdin` - git cat-file blob $obhash > /dev/null 2>/dev/null \ - && echo "Already ${ref_name} $1" -} - -passed_on() { - obdata=${ref_name}-$t-$1 - echo $obdata | git hash-object -w --stdin > /dev/null - echo "Passed: $1." -} - -broke_on() { - echo "Broke on $1" - cleanup - exit 1 -} - -new_test() { - echo "Testing $2" - git reset --hard $v && eval "$2" && passed_on $1 || broke_on $v - status=$? - if test -n "$run_once"; then - cleanup - exit $status - fi -} - - -while test $# != 0 -do - case "$1" in - --once) - run_once=yes - ;; - --ref-name) - ref_name=$2 - shift - ;; - *) - break; - ;; - esac - shift -done - -t=`echo "$2" | git hash-object --stdin` - -for v in `git rev-list --reverse $1` -do - tree_ver=`git rev-parse "$v^{tree}"` - already_passed $tree_ver || new_test $tree_ver "$2" -done -cleanup - -if test -n "$run_once"; then - echo "All commits already passed for --once argument. Quiting." - exit 127 -fi - -echo "All's well." diff --git a/bin/git/git-unmerged b/bin/git/git-unmerged deleted file mode 100755 index 4e16caf..0000000 --- a/bin/git/git-unmerged +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -sub git { - if (wantarray) { - chomp(my @ret = qx{git $_[0]}); - return @ret; - } - else { - chomp(my $ret = qx{git $_[0]}); - return $ret; - } -} - -my $branch = git 'symbolic-ref HEAD'; -$branch ||= 'master'; -$branch =~ s:^refs/heads/::; - -my @remotes = git 'remote show'; -my %remotes = map { $_, "$_/$branch" } @remotes; - -for my $remote (keys %remotes) { - my $remote_branch = $remotes{$remote}; - my $tip = git "show-ref -s --abbrev $remote_branch"; - my $merge_base = git "merge-base HEAD $remote_branch"; - $merge_base = substr $merge_base, 0, 7; - next if $merge_base eq $tip; - print "$remote: $merge_base..$tip\n"; -} diff --git a/bin/git/git-vee b/bin/git/git-vee deleted file mode 100755 index d42dce3..0000000 --- a/bin/git/git-vee +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# -# This prepares a brief summary of how your current branch has diverged -# from a corresponding remote branch. A typical use is: -# git vee origin -# -# if the currently-checked-out branch is master, this will compare -# master and origin/master. -# -# It uses git log --cherry-mark, so you need at least git 1.4.7.1. -# If --cherry-mark doesn't work, delete that option from this script. -# -# Usage: -# git vee # compare current head branch and its remote tracking branch -# git vee remote # compare current head branch and its analog on the remote -# git vee remote branch # compare branch and remote/branch -# git vee branch # compare HEAD and branch -# git vee branch1 branch2 # compare branch1 and branch2 -# - -DIE=false; - -equal_commits () { - [ $(git rev-parse $A) = $(git rev-parse $B) ] -} - -valid_ref () { - git rev-parse -q --verify $1 >/dev/null -} - -is_remote () { - git remote | grep -q "^$1"'$' -} - -die_later () { - echo $* 1>&2; - DIE=true -} - -die_now () { - $DIE && exit 1 -} - -usage () { - echo "Usage: $0 [remote] [branch]" 1>&2 - echo " $0 branch-a [branch-b]" 1>&2 - exit 2 -} - -case $# in - 0) Y=$(git get current-branch-name); - X=$(git get branch-remote $Y); - ;; - 1) X=$1 Y=HEAD;; - 2) X=$1 Y=$2;; - *) usage ;; -esac - -if is_remote $X; then - if [ $Y = HEAD ]; then - Y=$(git get current-branch-name) - fi - A=$Y B="$X/$Y" -else - A=$X; B=$Y; -fi - -valid_ref $A || die_later "$A: unknown commit" -valid_ref $B || die_later "$B: unknown commit" -die_now - -if equal_commits $A $B ; then - echo "$A and $B are identical" - exit 0; -fi - -git log --decorate --cherry-mark --oneline --graph --boundary $A"..."$B - |