Skip to content
Browse files

remove git utils i havent used

  • Loading branch information...
1 parent c528588 commit 05a56bd7cf97e71a70da4597a0e78b782c9e7db9 @ddollar committed Aug 31, 2010
Showing with 0 additions and 2,645 deletions.
  1. BIN .DS_Store
  2. +0 −15 git-all-commits
  3. +0 −2 git-apply-feature
  4. +0 −26 git-build
  5. +0 −79 git-changelog
  6. +0 −163 git-checkout-database
  7. +0 −10 git-children-of
  8. +0 −21 git-current
  9. +0 −16 git-diff-directory
  10. +0 −6 git-empty-branch
  11. +0 −2 git-erase-reflog
  12. +0 −3 git-external-ediff
  13. +0 −259 git-find
  14. +0 −13 git-find-blob
  15. +0 −11 git-find-children
  16. +0 −73 git-find-fetch
  17. +0 −17 git-flush
  18. +0 −3 git-full-reset
  19. +0 −5 git-hunt-and-seek
  20. +0 −5 git-maxpack
  21. +0 −54 git-opendiff
  22. +0 −2 git-pack-config
  23. +0 −10 git-publish
  24. +0 −3 git-publish-repo
  25. +0 −2 git-push-all
  26. +0 −2 git-push-branch
  27. +0 −260 git-record
  28. +0 −2 git-remove-empty-commits
  29. +0 −12 git-retrack
  30. +0 −1,481 git-sh
  31. +0 −3 git-signed-tag
  32. +0 −2 git-snapshot
  33. +0 −23 git-switch
  34. +0 −43 git-sync
  35. +0 −3 git-trash
  36. +0 −12 git-unpack
  37. +0 −2 git-unpack-config
View
BIN .DS_Store
Binary file not shown.
View
15 git-all-commits
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-find .git/objects -type f | \
-while read file; do
- if echo $file | egrep -q '\.idx$'; then
- git show-index < $file | awk '{print $2}'
- elif echo $file | egrep -q '[0-9a-f]{38}$'; then
- echo $(basename $(dirname $file))$(basename $file)
- fi
-done | \
-while read hash; do
- if [ "$(git cat-file -t $hash)" = commit ]; then
- echo $hash
- fi
-done
View
2 git-apply-feature
@@ -1,2 +0,0 @@
-#!/bin/sh
-git merge --no-ff $1
View
26 git-build
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-git clean -f -x -d
-git checkout $1
-
-rm -fr /usr/local/stow/git-$1
-
-make prefix=/usr/local/stow/git-$1 -j3 install
-
-git checkout origin/man
-
-rsync -av man1/ /usr/local/stow/git-$1/share/man/man1/
-rsync -av man5/ /usr/local/stow/git-$1/share/man/man5/
-rsync -av man7/ /usr/local/stow/git-$1/share/man/man7/
-
-git clean -f -x -d
-git checkout master
-chown -R johnw .
-
-git reset --hard HEAD
-git merge origin/master
-
-cd /usr/local/stow
-stow -D git-*
-
-stow git-$1
View
79 git-changelog
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-
-# git-changelog
-#
-# version 1.0, by John Wiegley
-#
-# The purpose of this code is to turn "git log" output into a complete
-# ChangeLog, for projects who wish to begin using a ChangeLog, but haven't
-# been.
-
-import datetime
-import string
-import sys
-import re
-
-from subprocess import *
-
-p = Popen("git log --stat %s" % string.join(sys.argv[1:], " "),
- shell = True, stdout = PIPE).stdout
-
-line = p.readline()
-while line:
- match = re.match("commit ([0-9a-f]+)", line)
- assert match
- hash_id = match.group(1)
-
- line = p.readline()
-
- match = re.match("Author: (.+)", line)
- assert match
- author = match.group(1)
- author = re.sub(" <", " <", author)
-
- line = p.readline()
-
- match = re.match("Date: +(.+?) [-+][0-9]{4}", line)
- assert match
- # Tue Sep 30 05:43:49 2003 +0000
- date = datetime.datetime.strptime(match.group(1), '%a %b %d %H:%M:%S %Y')
-
- line = p.readline() # absorb separator
- line = p.readline()
-
- log_text = ""
- while line and line != '\n':
- if not log_text:
- log_text += line[4:]
- else:
- log_text += "\t" + line[4:]
-
- line = p.readline()
-
- line = p.readline()
-
- files = []
- while line and line != '\n':
- match = re.match(" (.+?) +\\|", line)
- if match:
- files.append(match.group(1))
- line = p.readline()
- else:
- break
-
- line = p.readline()
-
- fp = Popen("fmt", shell = True, stdin = PIPE, stdout = PIPE)
-
- fp.stdin.write("\t* %s: %s\n" % (string.join(files, ",\n\t"), log_text))
- fp.stdin.close()
- log_text = fp.stdout.read()
-
- del fp
-
- print "%s %s\n\n%s\t* commit %s\n" % \
- (date.strftime("%Y-%m-%d"), author, log_text, hash_id)
-
- line = p.readline()
-
-# git-changelog ends here
View
163 git-checkout-database
@@ -1,163 +0,0 @@
-#!/usr/bin/env ruby
-
-#
-# usage: git-checkout-database <branch>
-#
-# makes switching branches that have different migrations easier
-#
-# * reverts all migrations unique to the current branch
-# * switches to the branch
-# * applies all migrations unique to the other branch
-#
-
-$debug = false
-
-begin
- require 'rubygems'
- require 'term/ansicolor'
- HAS_COLOR=true
- include Term::ANSIColor
-rescue LoadError
- HAS_COLOR=false
-end
-
-## utility ###################################################################
-
-def die(s)
- $stderr.puts "Error: #{s}"
- exit(-1)
-end
-
-def run_command(command)
- output = IO.popen(command, 'r').read
-
- if $debug
- cputs "-- begin run_command --"
- cputs "executing: #{command}"
- cputs "output:"
- cputs output
- cputs "-- end run_command --"
- end
-
- output
-end
-
-## color #####################################################################
-
-COLOR_ATTRIBUTES = {
- 0 => black,
- 1 => red,
- 2 => green,
- 3 => yellow,
- 4 => blue,
- 5 => magenta,
- 6 => cyan,
- 7 => dark,
- 8 => bold,
- 9 => reset
-} if HAS_COLOR
-
-def cputs(string='')
- if HAS_COLOR
- COLOR_ATTRIBUTES.each { |num, color| string.gsub!("&|#{num}", color) }
- else
- string.gsub!(/&\|\d/, '')
- end
- puts string
-end
-
-## git #######################################################################
-
-def working_root
- path = Dir.pwd
- loop do
- break(path) if File.exists?(File.join(path, '.git'))
- newpath = File.dirname(path)
- raise "Can't find .git directory" if newpath == path
- path = newpath
- end
-end
-
-def git_root
- File.join(working_root, '.git')
-end
-
-def current_branch
- File.read(File.join(git_root, 'HEAD')).chomp.split('/').last
-end
-
-def branches
- run_command('git for-each-ref refs/heads').split("\n").map do |line|
- revision, type, ref = line.split(' ')
- branch = ref.split('/').last
- end
-end
-
-def working_directory_clean?
- run_command('git status').match /nothing to commit \(working directory clean\)/
-end
-
-def ls(treeish, path)
- run_command("git ls-tree #{treeish} #{path}").map do |line|
- mode, type, revision, file = line.split(' ')
- file.gsub(Regexp.new("\\A#{path}"), '')
- end
-end
-
-def checkout(treeish)
- run_command("git checkout #{treeish}")
-end
-
-## main ######################################################################
-
-unless other_branch = ARGV.first
- puts "usage: git-checkout-database <branch>"
- exit 1
-end
-
-die "Invalid branch: #{other_branch}" unless branches.include?(other_branch)
-die "Outstanding changes, please commit to a clean state" unless working_directory_clean?
-
-migrations = {
- :current => ls(current_branch, 'db/migrate/'),
- :other => ls(other_branch, 'db/migrate/')
-}
-
-migration_numbers = migrations.keys.inject({}) do |hash, type|
- hash.update(type => migrations[type].map { |m| m.split('_').first.to_i }.sort)
-end
-
-migrations_by_number = migration_numbers.keys.inject({}) do |hash, type|
- hash.update(type => migrations[type].inject({}) do |hashb, migration|
- hashb.update(migration.split('_').first.to_i => migration)
- end)
-end
-
-unique_migration_numbers = {
- :current => migration_numbers[:current] - migration_numbers[:other],
- :other => migration_numbers[:other] - migration_numbers[:current],
-}
-
-unique_migration_numbers[:current].sort.reverse.each do |number|
- cputs " revert &|1#{migrations_by_number[:current][number]}&|9"
-end
-
-cputs "checkout &|8&|0#{other_branch}&|9"
-
-unique_migration_numbers[:other].sort.each do |number|
- cputs " apply &|2#{migrations_by_number[:other][number]}&|9"
-end
-
-print "Is this OK? (y/N) "
-
-if $stdin.gets.chomp.upcase == 'Y'
- unique_migration_numbers[:current].sort.reverse.each do |number|
- system("rake db:migrate:down VERSION=#{number}") || die("reverting migrations")
- end
-
- run_command "git checkout #{other_branch}"
-
- unique_migration_numbers[:other].sort.each do |number|
- system("rake db:migrate:up VERSION=#{number}") || die("applying migrations")
- end
-end
View
10 git-children-of
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-commit=$1
-branch=$2
-if [[ -z "$branch" ]]; then
- branch=HEAD
-fi
-
-git rev-list --children $branch --not $commit^@ | \
- awk "/^$commit/ { print \$2 }"
View
21 git-current
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-if [[ -z "$1" ]]; then
- ancestor=master
-else
- ancestor=$1
- shift 1
-fi
-current="$ancestor"
-
-ancestor=$(git rev-parse $ancestor)
-
-for head in $(git rev-parse --branches); do
- if [[ $head != $ancestor ]]; then
- if git rev-list -30 $head | grep -q $ancestor; then
- current="$current $(git describe --all --abbrev=0 $head | sed 's/heads\///')"
- fi
- fi
-done
-
-git show-branch $current
View
16 git-diff-directory
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-stat=true
-if [[ "$1" == "-p" ]]; then
- stat=false
- shift 1
-fi
-
-HERE=$(pwd)
-
-(cd "$1" && git --git-dir=$HERE/.git diff ${2:-HEAD}) | \
- if [[ $stat == true ]]; then \
- diffstat | grep -v only$; \
- else \
- cat; \
- fi
View
6 git-empty-branch
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-git stash
-git symbolic-ref HEAD refs/heads/$1
-rm .git/index
-git clean -f -d
View
2 git-erase-reflog
@@ -1,2 +0,0 @@
-#!/bin/sh
-git reflog expire --expire=0 "$@"
View
3 git-external-ediff
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-[ $# -eq 7 ] && emacsclient --eval "(ediff \"$2\" \"$PWD/$5\")"
View
259 git-find
@@ -1,259 +0,0 @@
-#!/usr/bin/env ruby
-
-# git-find, version 1.0
-#
-# by John Wiegley <johnw@newartisans.com>
-#
-# usage: git find <commit or tag>...
-#
-# Performs an exhaustive search of your object database to inform you exactly
-# how the given commit or tag fits in your repository. It tells you all the
-# parents and children of the commit/tag, and every name it can be referenced
-# by. It will tell you if it can be reached only by a reflog entry, or the
-# stash, or if it's descendend from a dangling commit.
-#
-# TODO: Add support for searching for blobs and trees as well.
-#
-# NOTE: This script can be very slow.
-
-class GitObject
- attr_reader :ident
-
- def initialize(ident)
- @ident = ident
- end
-end
-
-class Blob < GitObject
- attr_reader :names
-
- def initialize(ident)
- super ident
- @names = []
- end
-
- def add_name(name)
- @names.push(name)
- end
-end
-
-class Tree < GitObject
- attr_reader :names
-
- def initialize(ident)
- super ident
- @names = []
- end
-
- def add_name(name)
- @names.push(name)
- end
-end
-
-class Commit < GitObject
- attr_reader :names
- attr_reader :parents
- attr_reader :children
-
- def initialize(ident, *parents)
- super ident
- @names = []
- @parents = parents
- @children = []
- end
-
- def add_name(name)
- @names.push(name)
- end
-
- def add_parent(parent)
- unless @parents.include?(parent)
- @parents.push(parent)
- parent.add_child(self)
- end
- end
-
- def add_child(child)
- unless @children.include?(child)
- @children.push(child)
- end
- end
-
- def assign_name(name)
- if @names.include?(name)
- return
- end
- add_name(name)
-
- offset = 0
- @parents.each do |parent|
- if offset == 0
- if name =~ /(.+?)~([0-9]+)$/
- child_name = $1 + "~" + ($2.to_i + 1).to_s
- else
- child_name = name + "~1"
- end
- else
- child_name = name + "^" + (offset + 1).to_s
- end
- parent.assign_name(child_name)
- offset += 1
- end
- end
-end
-
-class Tag < GitObject
- attr_reader :name
- attr_reader :commit
-
- def initialize(ident, name, commit)
- super ident
- @name = name
- @commit = commit
- end
-end
-
-class Ref
- attr_reader :name
- attr_reader :commit
-
- def initialize(name, commit)
- @name = name
- @commit = commit
- end
-end
-
-$objects = {}
-
-# Build up a full commit history for every ref, and each reflog entry for each
-# ref.
-
-def get_ref_history(ref)
- first_obj = true
-
- `git rev-list --parents #{ref}`.split("\n").each do |entry|
- commit, *parents = entry.split(' ')
-
- if $objects.has_key?(commit)
- obj = $objects[commit]
- else
- obj = Commit.new(commit)
- $objects[commit] = obj
- end
-
- if first_obj and ref =~ /\/tags\//
- id = `git rev-parse #{ref}`.chomp
- $objects[id] = Tag.new(id, ref, obj)
- first_obj = false
- end
-
- if obj.parents.size == 0
- parents.each do |parent|
- if $objects.has_key?(parent)
- parent_obj = $objects[parent]
- else
- parent_obj = Commit.new(parent)
- $objects[parent] = parent_obj
- end
- obj.add_parent(parent_obj)
- end
- end
- end
-end
-
-def process_names(ref, name = nil, hash = nil)
- # Assign symbolic names to each commit
- if not hash
- hash = `git rev-parse #{ref}`.chomp
- end
- raise "Cannot locate object #{ref} => #{hash}" if not $objects.has_key?(hash)
- obj = $objects[hash]
- if obj.is_a? Tag
- obj.commit.assign_name(name ? name : ref)
- else
- obj.assign_name(name ? name : ref)
- end
-end
-
-$refs = `git rev-parse --symbolic --all`.split
-$refs.push("HEAD")
-
-puts "Processing refs history ..."
-$refs.each { |ref| get_ref_history(ref) }
-$refs.each { |ref| process_names(ref) }
-
-$hashes = ARGV[0].map { |ref| `git rev-parse #{ref}`.chomp }
-
-$search_reflogs = false
-$hashes.each do |hash|
- unless $objects.has_key?(hash)
- $search_reflogs = true
- end
-end
-
-if $search_reflogs
- puts "Processing reflogs ..."
- $refs.each do |ref|
- unless ref == "refs/stash"
- # Handle each reflog entry
- `git reflog show --abbrev=40 #{ref}`.split("\n").each do |line|
- if line =~ /^([0-9a-f]{40}) ([^@]+@\{[0-9]+\}): /
- hash = $1
- unless $objects.has_key?(hash)
- puts " unreachable reflog #{$2}"
- get_ref_history $2
- process_names $2, nil, hash
- end
- end
- end
- end
- end
-end
-
-$search_dangling = false
-$hashes.each do |hash|
- unless $objects.has_key?(hash)
- $search_dangling = true
- end
-end
-
-if $search_dangling
- puts "Finding unreachable objects ..."
- `git fsck --full --unreachable`.split("\n").each do |item|
- if item =~ /unreachable (blob|tag|commit|tree) ([a-f0-9]{40})/
- puts " " + item
- if $1 == "blob"
- $objects[$2] = Blob.new($2)
- elsif $1 == "tag"
- commit = Commit.new(`git rev-list -1 #{$2}`.chomp)
- $objects[$2] = Tag.new($2, "<dangling>", commit)
- get_ref_history $2
- process_names $2, "dangling-tag-#{$2}"
- elsif $1 == "commit"
- get_ref_history $2
- process_names $2, "dangling-commit-#{$2}"
- elsif $1 == "tree"
- $objects[$2] = Tree.new($2)
- end
- end
- end
-end
-
-ARGV[0].each do |ref|
- hash = `git rev-parse #{ref}`.chomp
-
- object = $objects[hash]
-
- puts ""
- if object.is_a? Tag
- puts "Tag #{ref} => #{hash}"
- object = object.commit
- puts " commit #{object.ident}"
- else
- puts "Commit #{ref} => #{hash}"
- end
-
- object.parents.each { |parent| puts " parent #{parent.ident}" }
- object.children.each { |child| puts " child #{child.ident}" }
- object.names.each { |name| puts " name #{name}" }
-end
View
13 git-find-blob
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-filename=$1
-
-want=$(git-hash-object "$filename")
-
-git-rev-list --since="6 months ago" HEAD | while read commit ; do
- git-ls-tree -r $commit | while read perm type hash filename; do
- if test "$want" = "$hash"; then
- echo matched $filename in commit $commit
- fi
- done
-done
View
11 git-find-children
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-if [[ $# == 0 ]]; then
- echo usage: git find-children REFS...
-fi
-
-for ref in "$@"; do
- for sha1 in $(git rev-list "$@")
- do
- done
-done
View
73 git-find-fetch
@@ -1,73 +0,0 @@
-#!/bin/bash
-
-# usage: git-find-fetch [--mirror] [--repack] DIRS...
-#
-# by John Wiegley <johnw@newartisans.com>
-#
-# The purpose of this script is to walk recursively through a set of
-# directories, fetching updates for any and all Git repositories found
-# therein.
-#
-# The script is smart about using git-svn or gc-utils, if those are needed to
-# get updates. Further, it calls "git remote update" for each repository, to
-# ensure all its remotes are also updated.
-#
-# Lastly, if you have a remote called "mirror" in any repository, all its refs
-# will be "push --mirror"'d to that remote under the assumption that you want
-# the mirror to receive all the updates you just fetch'd.
-#
-# Options:
-#
-# --mirror Only push to your mirrors, do not fetch.
-# --repack Repack and prune repositories after updating them.
-
-mirror_only=false
-if [[ "$1" == --mirror ]]; then
- mirror_only=true
- shift 1
-fi
-
-repack=false
-if [[ "$1" == --repack ]]; then
- repack=true
- shift 1
-fi
-
-find "$@" \( -name .git -o -name '*.git' \) -type d | \
- while read repo_dir
- do
- if [[ -f "$repo_dir"/config ]]
- then
- if [[ $mirror_only == false ]]; then
- # If this is a git-svn repo, use git svn fetch
- if grep -q '^\[svn-remote ' "$repo_dir"/config
- then
- echo git svn fetch: $repo_dir
- GIT_DIR="$repo_dir" git svn fetch
-
- # If this is a gc-utils repo, use gc-utils update
- elif grep -q '^\[gc-utils\]' "$repo_dir"/config
- then
- echo gc-utils update: $repo_dir
- (cd "$repo_dir"; gc-utils update)
-
- fi
-
- GIT_DIR="$repo_dir" git remote update
- fi
-
- for remote in $(GIT_DIR="$repo_dir" git remote)
- do
- if [[ $remote == mirror ]]; then
- echo git push: $repo_dir -- $remote
- GIT_DIR="$repo_dir" git push -f --mirror $remote
- fi
- done
-
- if [[ $repack == true ]]; then
- GIT_DIR="$repo_dir" git fsck --full && \
- GIT_DIR="$repo_dir" git repack -a -d -f --window=200 --depth=50 && \
- GIT_DIR="$repo_dir" git prune
- fi
- fi
- done
View
17 git-flush
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# The job of git-flush is to recompactify your repository to be as small
-# as possible, by dropping all reflogs, stashes, and other cruft that may
-# be bloating your pack files.
-
-rm -fr .git/refs/original
-perl -i -ne 'print unless /refs\/original/;' .git/info/refs .git/packed-refs
-
-git reflog expire --expire=0 --all
-
-if [ "$1" = "-f" ]; then
- git stash clear
-fi
-
-git repack -adf #--window=200 --depth=50
-git prune
View
3 git-full-reset
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-git reset --hard HEAD && git clean -fdx
View
5 git-hunt-and-seek
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-for hash in $(grep ^commit | awk '{print $2}'); do
- git diff-directory $1 $hash
-done
View
5 git-maxpack
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-git gc
-git prune
-git repack -a -d --depth=250 --window=250
View
54 git-opendiff
@@ -1,54 +0,0 @@
-#!/usr/bin/env ruby
-
-########################################################################################################
-# Usage: #
-# gitopendiff [-r<left rev>:<right-rev>] [repository] #
-# #
-# Example: #
-# gitopendiff # == gitopendiff -rHEAD^:HEAD . #
-# gitopendiff -rHEAD^^:HEAD # == gitopendiff -rHEAD^^:HEAD . #
-# gitopendiff -master:origin/master # == gitopendiff -rmaster:origin/master . #
-# gitopendiff /path/to/git/repository # == gitopendiff -rHEAD^:HEAD /path/to/git/repository #
-# gitopendiff -rHEAD^:HEAD /path/to/git/repository # == gitopendiff -rHEAD^:HEAD /path/to/git/repository #
-# #
-# Authored by Simon Menke, with minor optimizations by Jonathan del Strother #
-########################################################################################################
-
-def checkout(origin, rev)
- tmp = "/tmp/git_opendiff_#{rand}.tmp/"
- Dir.mkdir(tmp)
- Dir.chdir(origin) do
- # The clean, porcelainy way would be "git archive --format=tar '#{rev}' | (cd #{tmp} && tar xf -)"
- # I've found the plumbing to be marginally faster :
- system "git read-tree '#{rev}'; git checkout-index --prefix=#{tmp} -a; git read-tree HEAD"
- end
- return tmp
-end
-
-def diff(origin, revs={})
- revs = {:left=>"HEAD^",:right=>"HEAD"}.merge(revs)
- left = checkout origin, revs[:left]
- right = checkout origin, revs[:right]
- system "opendiff '#{left}' '#{right}'"
-end
-
-revs = {}
-git_dir = Dir.pwd
-ARGV.each do |arg|
- if arg[0,2] == "-r"
- rev_strings = arg[2..-1].split(':')
- case rev_strings.size
- when 1
- revs[:left] = rev_strings[0] unless rev_strings[0].empty?
- when 2
- revs[:left] = rev_strings[0] unless rev_strings[0].empty?
- revs[:right] = rev_strings[1] unless rev_strings[1].empty?
- else
- revs = nil
- end
- else
- git_dir = arg unless arg.empty?
- end
-end
-
-diff(git_dir, revs)
View
2 git-pack-config
@@ -1,2 +0,0 @@
-#!/bin/sh
-cp .git/config .gitconfig
View
10 git-publish
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-SERVER=$1
-PATHNAME=$2
-
-ssh $SERVER "mkdir $PATHNAME; GIT_DIR=$PATHNAME git init"
-
-git remote add $3 git+ssh://$SERVER$PATHNAME
-
-git push origin master:refs/heads/master
View
3 git-publish-repo
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-for i in "$@" ; do rsync -av $i/.git jw:/srv/git/$i.git ; done
View
2 git-push-all
@@ -1,2 +0,0 @@
-#!/bin/sh
-for remote in $(git remote); do git push $remote; done
View
2 git-push-branch
@@ -1,2 +0,0 @@
-#!/bin/sh
-git push origin $1:refs/heads/$1
View
260 git-record
@@ -1,260 +0,0 @@
-#!/usr/bin/env python
-# coding: utf-8
-
-# git-darcs-record, emulate "darcs record" interface on top of a git repository
-#
-# Usage:
-# git-darcs-record first asks for any new file (previously
-# untracked) to be added to the index.
-# git-darcs-record then asks for each hunk to be recorded in
-# the next commit. File deletion and binary blobs are supported
-# git-darcs-record finally asks for a small commit message and
-# executes the 'git commit' command with the newly created
-# changeset in the index
-
-
-# Copyright (C) 2007 Raphaël Slinckx <raphael@slinckx.net>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-import re, pprint, sys, os
-
-BINARY = re.compile("GIT binary patch")
-HEADER = re.compile("diff --git a/(.*) b/(.*)")
-class Hunk:
- def __init__(self, lines, binary):
- self.diff = None
- self.lines = lines
- self.keep = False
- self.binary = binary
-
- def format(self):
- output = self.diff.header.modified + "\n"
- if self.diff.header.deleted:
- output = "Removed file: " + output
- if self.binary:
- output = "Binary file changed: " + output
-
- if not self.binary:
- output += "\n".join(self.lines) + "\n"
-
- return output
-
-class Header:
- def __init__(self, lines):
- self.lines = lines
- self.modified = None
- self.deleted = False
-
- # Extract useful info from header from git
- for line in lines:
- if HEADER.match(line):
- match = HEADER.match(line)
- self.modified = match.group(1)
- if line.startswith("deleted "):
- self.deleted = True
-
- # Make sure we know what file we are modifying
- assert self.modified
-
-class Diff:
- def __init__(self, header, hunks):
- self.header = header
- self.hunks = hunks
- # Put a reference to ourselves in the hunks
- for hunk in self.hunks:
- hunk.diff = self
- self.keep = False
-
- def filter(self):
- output = '\n'.join(self.header.lines) + "\n"
- for hunk in self.hunks:
- if not hunk.keep:
- continue
- output += '\n'.join(hunk.lines) + "\n"
- return output
-
- @classmethod
- def filter_diffs(kls, diffs):
- output = ""
- for diff in diffs:
- if not diff.keep:
- continue
- output += diff.filter()
- return output
-
- @classmethod
- def parse(kls, lines):
- in_header = True
- binary = False
- header = []
- hunks = []
- current_hunk = []
- for line in lines:
- if in_header and (line[0] not in (" ", "@", "\\") or line.startswith("+++ ") or line.startswith("--- ")) and not BINARY.match(line):
- header.append(line)
- elif BINARY.match(line):
- in_header = False
- binary = True
- header.append(line)
- elif len(line) >= 1 and line[0] == "@":
- in_header = False
- if current_hunk:
- hunks.append(Hunk(current_hunk, binary))
- current_hunk = []
- current_hunk.append(line)
- else:
- current_hunk.append(line)
- if current_hunk:
- hunks.append(Hunk(current_hunk, binary))
- return Diff(Header(header), hunks)
-
- @classmethod
- def split(kls, lines):
- diffs = []
- current_diff = []
- for line in lines:
- if line.startswith("diff --git "):
- if current_diff:
- diffs.append(current_diff)
- current_diff = []
- current_diff.append(line)
- else:
- current_diff.append(line)
- if current_diff:
- diffs.append(current_diff)
- return [Diff.parse(lines) for lines in diffs]
-
-def read_answer(question, allowed_responses=["Y", "n", "d", "a"]):
- #Make sure there is alway a default selection
- assert [r for r in allowed_responses if r.isupper()]
-
- while True:
- resp = raw_input("%s [%s] : " % (question, "".join(allowed_responses)))
- if resp in [r.lower() for r in allowed_responses]:
- break
- elif resp == "":
- resp = [r for r in allowed_responses if r.isupper()][0].lower()
- break
- print 'Unexpected answer: %r' % resp
- return resp
-
-
-def setup_git_dir():
- global GIT_DIR
- GIT_DIR = os.getcwd()
- while not os.path.exists(os.path.join(GIT_DIR, ".git")):
- GIT_DIR = os.path.dirname(GIT_DIR)
- if GIT_DIR == "/":
- return False
- os.chdir(GIT_DIR)
- return True
-
-def git_get_untracked_files():
- return [f.strip() for f in os.popen("git ls-files --others --exclude-from='%s' --exclude-per-directory=.gitignore" % (os.path.join(GIT_DIR, ".git", "info", "exclude"))).readlines()]
-
-def git_track_file(f):
- os.spawnvp(os.P_WAIT, "git", ["git", "add", f])
-
-def git_diff():
- return os.popen("git diff -u --no-color --binary").readlines()
-
-def git_apply(patch):
- stdin, stdout = os.popen2(["git", "apply", "--cached", "-"])
- stdin.write(patch)
- stdin.close()
- output = stdout.read()
- stdout.close()
- os.wait()
- return output
-
-def git_status():
- os.spawnvp(os.P_WAIT, "git", ["git", "status"])
-
-def git_commit(msg):
- os.spawnvp(os.P_WAIT, "git", ["git", "commit", "-m", patch_name])
-
-# Main loop ------------------------
-if not setup_git_dir():
- print "Must be in a git (sub-)directory! Exiting..."
- sys.exit()
-
-# Ask for new files ----------------
-git_untracked_files = git_get_untracked_files()
-git_track_files = []
-all = False
-done = False
-for i, f in enumerate(git_untracked_files):
- if not all:
- print "Add file: ", f
- resp = read_answer("Shall I add this file? (%d/%d)" % (i+1, len(git_untracked_files)))
- else:
- resp = "y"
-
- if resp == "y":
- git_track_files.append(f)
- elif resp == "a":
- git_track_files.append(f)
- all = True
- elif resp == "d":
- done = True
- break
-
-# Ask for each hunk of the diff
-diffs = Diff.split([line[:-1] for line in git_diff()])
-total_hunks = sum([len(diff.hunks) for diff in diffs])
-
-n_hunk = 1
-for diff in diffs:
- if done:
- break
- for hunk in diff.hunks:
- # Check if we are in override mode
- if not all:
- print
- print hunk.format()
- resp = read_answer('Shall I record this change? (%d/%d)' % (n_hunk, total_hunks))
- # Otherwise say 'y' to all remaining patches
- else:
- resp = "y"
-
- if resp == "y":
- diff.keep = True
- hunk.keep = True
- elif resp == "a":
- diff.keep = True
- hunk.keep = True
- all = True
- elif resp == "d":
- done = True
- break
-
- n_hunk += 1
-
-# Add new files to track
-for f in git_track_files:
- git_track_file(f)
-
-# Generate a new patch to be used with git apply
-new_patch = Diff.filter_diffs(diffs)
-if new_patch:
- print git_apply(new_patch)
-
-if new_patch or git_track_files:
- git_status()
- patch_name = raw_input("What is the patch name? ")
- git_commit(patch_name)
-else:
- print "Ok, if you don't want to record anything, that's fine!"
View
2 git-remove-empty-commits
@@ -1,2 +0,0 @@
-#!/bin/bash
-git filter-branch --commit-filter 'if [ z$1 = z`git rev-parse $3^{tree}` ]; then skip_commit "$@"; else git commit-tree "$@"; fi' "$@"
View
12 git-retrack
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# Based on an alias written by doener on #git.
-
-# usage: git retrack REMOTE URL BRANCH
-
-branch=$(git rev-parse --symbolic-full-name HEAD | sed 's/refs\/heads\///')
-
-git remote add -f $1 "$2" || echo But that\'s perfectly OK.
-
-git config branch.$branch.remote "$1"
-git config branch.$branch.merge "refs/heads/${3:-$branch}"
View
1,481 git-sh
@@ -1,1481 +0,0 @@
-#!/usr/bin/env bash
-#
-# A customized bash environment suitable for git work.
-#
-# Copyright (C) 2008 Ryan Tomayko <http://tomayko.com/>
-# Copyright (C) 2008 Aristotle Pagaltzis <http://plasmasturm.org/>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-# Distributed under the GNU General Public License, version 2.0.
-
-# use to install the sh alias
-[[ $1 = '--configure' && $# = 1 ]] && {
- set -e
- git config --global alias.sh '!git-sh'
- echo "alias 'sh' added to ~/.gitconfig"
- exit 0
-}
-
-# we expect to be sourced into an interactive shell. when executed as a
-# command, kick off a new shell and source us. this is a pretty cool hack;
-# make it better.
-[ "$0" = 'bash' ] ||
-exec /usr/bin/env bash --rcfile "$@" "$0"
-
-# source the user's .bashrc file
-[ -r ~/.bashrc ] && {
- pushd ~ > /dev/null
- . .bashrc
- popd > /dev/null
-}
-
-
-# create aliases and configure bash completion for most porcelain commands
-
-_git_cmd_cfg=(
- 'add alias'
- 'am alias stdcmpl'
- 'annotate alias'
- 'apply alias stdcmpl'
- 'archive alias'
- 'bisect alias stdcmpl'
- 'blame alias'
- 'branch alias stdcmpl'
- 'bundle alias stdcmpl'
- 'cat-file alias'
- 'checkout alias stdcmpl'
- 'cherry alias stdcmpl'
- 'cherry-pick alias stdcmpl'
- 'clean alias'
- 'clone alias'
- 'commit alias stdcmpl'
- 'config alias stdcmpl'
- 'describe alias stdcmpl'
- 'diff alias stdcmpl'
- 'fetch alias stdcmpl'
- 'format-patch alias stdcmpl'
- 'fsck alias'
- 'gc alias stdcmpl'
- 'gui alias'
- 'init alias'
- 'instaweb alias'
- 'log alias logcmpl'
- 'lost-found alias'
- 'ls-files alias'
- 'ls-remote alias stdcmpl'
- 'ls-tree alias stdcmpl'
- 'merge alias stdcmpl'
- 'merge-base stdcmpl'
- 'mergetool alias'
- 'mv alias'
- 'name-rev stdcmpl'
- 'patch-id alias'
- 'peek-remote alias'
- 'prune alias'
- 'pull alias stdcmpl'
- 'push alias stdcmpl'
- 'quiltimport alias'
- 'rebase alias stdcmpl'
- 'remote alias stdcmpl'
- 'repack alias'
- 'repo-config alias'
- 'request-pull alias'
- 'reset alias stdcmpl'
- 'rev-list alias'
- 'rev-parse alias'
- 'revert alias'
- 'rm alias'
- 'send-email alias'
- 'send-pack alias'
- 'shortlog stdcmpl'
- 'show alias stdcmpl'
- 'show-branch logcmpl'
- 'stash alias stdcmpl'
- 'status alias'
- 'stripspace alias'
- 'submodule alias stdcmpl'
- 'svn alias'
- 'symbolic-ref alias'
- 'tag alias stdcmpl'
- 'tar-tree alias'
- 'var alias'
- 'whatchanged alias logcmpl'
-)
-
-for cfg in "${_git_cmd_cfg[@]}" ; do
- read cmd opts <<< $cfg
- for opt in $opts ; do
- case $opt in
- alias) alias $cmd="git $cmd" ;;
- stdcmpl) complete -o default -o nospace -F _git_${cmd//-/_} $cmd ;;
- logcmpl) complete -o default -o nospace -F _git_log $cmd ;;
- esac
- done
-done
-
-
-# PROMPT =======================================================================
-
-# grab colors from git's config.
-#
-# TODO we should probably add our own "color.sh.THING" values to the config and
-# a switch that let's you enable / disable colors entirely.
-COLOR_RESET="\[\033[0;39;49m\]"
-COLOR_BRANCH='\[$(git config --get-color color.branch.current)\]'
-COLOR_WORKDIR='\[$(git config --get-color color.diff.meta)\]'
-
-_git_prompt_setup() {
- br=$(git symbolic-ref HEAD 2>/dev/null)
- br=${br#refs/heads/}
- rel=$(git rev-parse --show-prefix 2>/dev/null)
- rel="${rel%/}"
- loc="${PWD%/$rel}"
-}
-
-_git_prompt_plain() {
- _git_prompt_setup
- PS1="git:$br!${loc/*\/}${rel:+/$rel}> "
-}
-
-_git_prompt_color() {
- _git_prompt_setup
- PS1="${COLOR_BRANCH}${br}${COLOR_RESET}!${COLOR_WORKDIR}${loc/*\/}${rel:+/$rel}${COLOR_RESET}> "
-}
-
-PROMPT_COMMAND=_git_prompt_color
-
-# try to provide a decent help command
-
-_help_display() {
- # show git's inbuilt help, after some tweaking...
- git --help |
- grep -v 'usage: git ' |
- sed "s/See 'git help/See 'help/"
-
- # show aliases from ~/.gitshrc
- [ -r ~/.gitshrc ] && {
- echo ; echo 'Aliases from ~/.gitshrc'
- perl -ne's/alias // or next; s/=/\t\t\t/; print' ~/.gitshrc
- }
-}
-
-help() {
- local _git_pager=$(git config core.pager)
- [ $# = 1 ] &&
- git help $1 ||
- (_help_display | ${_git_pager:-${PAGER:-less}})
-}
-complete -o default -o nospace -F _git help
-
-# vim: tw=80
-#
-# bash completion support for core Git.
-#
-# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
-# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
-# Distributed under the GNU General Public License, version 2.0.
-#
-# The contained completion routines provide support for completing:
-#
-# *) local and remote branch names
-# *) local and remote tag names
-# *) .git/remotes file names
-# *) git 'subcommands'
-# *) tree paths within 'ref:path/to/file' expressions
-# *) common --long-options
-#
-# To use these routines:
-#
-# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
-# 2) Added the following line to your .bashrc:
-# source ~/.git-completion.sh
-#
-# 3) You may want to make sure the git executable is available
-# in your PATH before this script is sourced, as some caching
-# is performed while the script loads. If git isn't found
-# at source time then all lookups will be done on demand,
-# which may be slightly slower.
-#
-# 4) Consider changing your PS1 to also show the current branch:
-# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
-#
-# The argument to __git_ps1 will be displayed only if you
-# are currently in a git repository. The %s token will be
-# the name of the current branch.
-#
-# To submit patches:
-#
-# *) Read Documentation/SubmittingPatches
-# *) Send all patches to the current maintainer:
-#
-# "Shawn O. Pearce" <spearce@spearce.org>
-#
-# *) Always CC the Git mailing list:
-#
-# git@vger.kernel.org
-#
-
-__gitdir ()
-{
- if [ -z "$1" ]; then
- if [ -n "$__git_dir" ]; then
- echo "$__git_dir"
- elif [ -d .git ]; then
- echo .git
- else
- git rev-parse --git-dir 2>/dev/null
- fi
- elif [ -d "$1/.git" ]; then
- echo "$1/.git"
- else
- echo "$1"
- fi
-}
-
-__git_ps1 ()
-{
- local g="$(git rev-parse --git-dir 2>/dev/null)"
- if [ -n "$g" ]; then
- local r
- local b
- if [ -d "$g/../.dotest" ]
- then
- r="|AM/REBASE"
- b="$(git symbolic-ref HEAD 2>/dev/null)"
- elif [ -f "$g/.dotest-merge/interactive" ]
- then
- r="|REBASE-i"
- b="$(cat $g/.dotest-merge/head-name)"
- elif [ -d "$g/.dotest-merge" ]
- then
- r="|REBASE-m"
- b="$(cat $g/.dotest-merge/head-name)"
- elif [ -f "$g/MERGE_HEAD" ]
- then
- r="|MERGING"
- b="$(git symbolic-ref HEAD 2>/dev/null)"
- else
- if [ -f $g/BISECT_LOG ]
- then
- r="|BISECTING"
- fi
- if ! b="$(git symbolic-ref HEAD 2>/dev/null)"
- then
- b="$(cut -c1-7 $g/HEAD)..."
- fi
- fi
-
- if [ -n "$1" ]; then
- printf "$1" "${b##refs/heads/}$r"
- else
- printf " (%s)" "${b##refs/heads/}$r"
- fi
- fi
-}
-
-__gitcomp ()
-{
- local all c s=$'\n' IFS=' '$'\t'$'\n'
- local cur="${COMP_WORDS[COMP_CWORD]}"
- if [ $# -gt 2 ]; then
- cur="$3"
- fi
- for c in $1; do
- case "$c$4" in
- --*=*) all="$all$c$4$s" ;;
- *.) all="$all$c$4$s" ;;
- *) all="$all$c$4 $s" ;;
- esac
- done
- IFS=$s
- COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
- return
-}
-
-__git_heads ()
-{
- local cmd i is_hash=y dir="$(__gitdir "$1")"
- if [ -d "$dir" ]; then
- for i in $(git --git-dir="$dir" \
- for-each-ref --format='%(refname)' \
- refs/heads ); do
- echo "${i#refs/heads/}"
- done
- return
- fi
- for i in $(git-ls-remote "$1" 2>/dev/null); do
- case "$is_hash,$i" in
- y,*) is_hash=n ;;
- n,*^{}) is_hash=y ;;
- n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
- n,*) is_hash=y; echo "$i" ;;
- esac
- done
-}
-
-__git_tags ()
-{
- local cmd i is_hash=y dir="$(__gitdir "$1")"
- if [ -d "$dir" ]; then
- for i in $(git --git-dir="$dir" \
- for-each-ref --format='%(refname)' \
- refs/tags ); do
- echo "${i#refs/tags/}"
- done
- return
- fi
- for i in $(git-ls-remote "$1" 2>/dev/null); do
- case "$is_hash,$i" in
- y,*) is_hash=n ;;
- n,*^{}) is_hash=y ;;
- n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
- n,*) is_hash=y; echo "$i" ;;
- esac
- done
-}
-
-__git_refs ()
-{
- local cmd i is_hash=y dir="$(__gitdir "$1")"
- if [ -d "$dir" ]; then
- if [ -e "$dir/HEAD" ]; then echo HEAD; fi
- for i in $(git --git-dir="$dir" \
- for-each-ref --format='%(refname)' \
- refs/tags refs/heads refs/remotes); do
- case "$i" in
- refs/tags/*) echo "${i#refs/tags/}" ;;
- refs/heads/*) echo "${i#refs/heads/}" ;;
- refs/remotes/*) echo "${i#refs/remotes/}" ;;
- *) echo "$i" ;;
- esac
- done
- return
- fi
- for i in $(git-ls-remote "$dir" 2>/dev/null); do
- case "$is_hash,$i" in
- y,*) is_hash=n ;;
- n,*^{}) is_hash=y ;;
- n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
- n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
- n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
- n,*) is_hash=y; echo "$i" ;;
- esac
- done
-}
-
-__git_refs2 ()
-{
- local i
- for i in $(__git_refs "$1"); do
- echo "$i:$i"
- done
-}
-
-__git_refs_remotes ()
-{
- local cmd i is_hash=y
- for i in $(git-ls-remote "$1" 2>/dev/null); do
- case "$is_hash,$i" in
- n,refs/heads/*)
- is_hash=y
- echo "$i:refs/remotes/$1/${i#refs/heads/}"
- ;;
- y,*) is_hash=n ;;
- n,*^{}) is_hash=y ;;
- n,refs/tags/*) is_hash=y;;
- n,*) is_hash=y; ;;
- esac
- done
-}
-
-__git_remotes ()
-{
- local i ngoff IFS=$'\n' d="$(__gitdir)"
- shopt -q nullglob || ngoff=1
- shopt -s nullglob
- for i in "$d/remotes"/*; do
- echo ${i#$d/remotes/}
- done
- [ "$ngoff" ] && shopt -u nullglob
- for i in $(git --git-dir="$d" config --list); do
- case "$i" in
- remote.*.url=*)
- i="${i#remote.}"
- echo "${i/.url=*/}"
- ;;
- esac
- done
-}
-
-__git_merge_strategies ()
-{
- if [ -n "$__git_merge_strategylist" ]; then
- echo "$__git_merge_strategylist"
- return
- fi
- sed -n "/^all_strategies='/{
- s/^all_strategies='//
- s/'//
- p
- q
- }" "$(git --exec-path)/git-merge"
-}
-__git_merge_strategylist=
-__git_merge_strategylist="$(__git_merge_strategies 2>/dev/null)"
-
-__git_complete_file ()
-{
- local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- ?*:*)
- ref="${cur%%:*}"
- cur="${cur#*:}"
- case "$cur" in
- ?*/*)
- pfx="${cur%/*}"
- cur="${cur##*/}"
- ls="$ref:$pfx"
- pfx="$pfx/"
- ;;
- *)
- ls="$ref"
- ;;
- esac
- COMPREPLY=($(compgen -P "$pfx" \
- -W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
- | sed '/^100... blob /s,^.* ,,
- /^040000 tree /{
- s,^.* ,,
- s,$,/,
- }
- s/^.* //')" \
- -- "$cur"))
- ;;
- *)
- __gitcomp "$(__git_refs)"
- ;;
- esac
-}
-
-__git_complete_revlist ()
-{
- local pfx cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- *...*)
- pfx="${cur%...*}..."
- cur="${cur#*...}"
- __gitcomp "$(__git_refs)" "$pfx" "$cur"
- ;;
- *..*)
- pfx="${cur%..*}.."
- cur="${cur#*..}"
- __gitcomp "$(__git_refs)" "$pfx" "$cur"
- ;;
- *.)
- __gitcomp "$cur."
- ;;
- *)
- __gitcomp "$(__git_refs)"
- ;;
- esac
-}
-
-__git_commands ()
-{
- if [ -n "$__git_commandlist" ]; then
- echo "$__git_commandlist"
- return
- fi
- local i IFS=" "$'\n'
- for i in $(git help -a|egrep '^ ')
- do
- case $i in
- *--*) : helper pattern;;
- applymbox) : ask gittus;;
- applypatch) : ask gittus;;
- archimport) : import;;
- cat-file) : plumbing;;
- check-attr) : plumbing;;
- check-ref-format) : plumbing;;
- commit-tree) : plumbing;;
- cvsexportcommit) : export;;
- cvsimport) : import;;
- cvsserver) : daemon;;
- daemon) : daemon;;
- diff-files) : plumbing;;
- diff-index) : plumbing;;
- diff-tree) : plumbing;;
- fast-import) : import;;
- fsck-objects) : plumbing;;
- fetch-pack) : plumbing;;
- fmt-merge-msg) : plumbing;;
- for-each-ref) : plumbing;;
- hash-object) : plumbing;;
- http-*) : transport;;
- index-pack) : plumbing;;
- init-db) : deprecated;;
- local-fetch) : plumbing;;
- mailinfo) : plumbing;;
- mailsplit) : plumbing;;
- merge-*) : plumbing;;
- mktree) : plumbing;;
- mktag) : plumbing;;
- pack-objects) : plumbing;;
- pack-redundant) : plumbing;;
- pack-refs) : plumbing;;
- parse-remote) : plumbing;;
- patch-id) : plumbing;;
- peek-remote) : plumbing;;
- prune) : plumbing;;
- prune-packed) : plumbing;;
- quiltimport) : import;;
- read-tree) : plumbing;;
- receive-pack) : plumbing;;
- reflog) : plumbing;;
- repo-config) : deprecated;;
- rerere) : plumbing;;
- rev-list) : plumbing;;
- rev-parse) : plumbing;;
- runstatus) : plumbing;;
- sh-setup) : internal;;
- shell) : daemon;;
- send-pack) : plumbing;;
- show-index) : plumbing;;
- ssh-*) : transport;;
- stripspace) : plumbing;;
- svn) : import export;;
- symbolic-ref) : plumbing;;
- tar-tree) : deprecated;;
- unpack-file) : plumbing;;
- unpack-objects) : plumbing;;
- update-index) : plumbing;;
- update-ref) : plumbing;;
- update-server-info) : daemon;;
- upload-archive) : plumbing;;
- upload-pack) : plumbing;;
- write-tree) : plumbing;;
- verify-tag) : plumbing;;
- *) echo $i;;
- esac
- done
-}
-__git_commandlist=
-__git_commandlist="$(__git_commands 2>/dev/null)"
-
-__git_aliases ()
-{
- local i IFS=$'\n'
- for i in $(git --git-dir="$(__gitdir)" config --list); do
- case "$i" in
- alias.*)
- i="${i#alias.}"
- echo "${i/=*/}"
- ;;
- esac
- done
-}
-
-__git_aliased_command ()
-{
- local word cmdline=$(git --git-dir="$(__gitdir)" \
- config --get "alias.$1")
- for word in $cmdline; do
- if [ "${word##-*}" ]; then
- echo $word
- return
- fi
- done
-}
-
-__git_whitespacelist="nowarn warn error error-all strip"
-
-_git_am ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- if [ -d .dotest ]; then
- __gitcomp "--skip --resolved"
- return
- fi
- case "$cur" in
- --whitespace=*)
- __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
- return
- ;;
- --*)
- __gitcomp "
- --signoff --utf8 --binary --3way --interactive
- --whitespace=
- "
- return
- esac
- COMPREPLY=()
-}
-
-_git_apply ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --whitespace=*)
- __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
- return
- ;;
- --*)
- __gitcomp "
- --stat --numstat --summary --check --index
- --cached --index-info --reverse --reject --unidiff-zero
- --apply --no-add --exclude=
- --whitespace= --inaccurate-eof --verbose
- "
- return
- esac
- COMPREPLY=()
-}
-
-_git_add ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __gitcomp "--interactive --refresh"
- return
- esac
- COMPREPLY=()
-}
-
-_git_bisect ()
-{
- local i c=1 command
- while [ $c -lt $COMP_CWORD ]; do
- i="${COMP_WORDS[c]}"
- case "$i" in
- start|bad|good|reset|visualize|replay|log)
- command="$i"
- break
- ;;
- esac
- c=$((++c))
- done
-
- if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
- __gitcomp "start bad good reset visualize replay log"
- return
- fi
-
- case "$command" in
- bad|good|reset)
- __gitcomp "$(__git_refs)"
- ;;
- *)
- COMPREPLY=()
- ;;
- esac
-}
-
-_git_branch ()
-{
- __gitcomp "$(__git_refs)"
-}
-
-_git_bundle ()
-{
- local mycword="$COMP_CWORD"
- case "${COMP_WORDS[0]}" in
- git)
- local cmd="${COMP_WORDS[2]}"
- mycword="$((mycword-1))"
- ;;
- git-bundle*)
- local cmd="${COMP_WORDS[1]}"
- ;;
- esac
- case "$mycword" in
- 1)
- __gitcomp "create list-heads verify unbundle"
- ;;
- 2)
- # looking for a file
- ;;
- *)
- case "$cmd" in
- create)
- __git_complete_revlist
- ;;
- esac
- ;;
- esac
-}
-
-_git_checkout ()
-{
- __gitcomp "$(__git_refs)"
-}
-
-_git_cherry ()
-{
- __gitcomp "$(__git_refs)"
-}
-
-_git_cherry_pick ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __gitcomp "--edit --no-commit"
- ;;
- *)
- __gitcomp "$(__git_refs)"
- ;;
- esac
-}
-
-_git_commit ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __gitcomp "
- --all --author= --signoff --verify --no-verify
- --edit --amend --include --only
- "
- return
- esac
- COMPREPLY=()
-}
-
-_git_describe ()
-{
- __gitcomp "$(__git_refs)"
-}
-
-_git_diff ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __gitcomp "--cached --stat --numstat --shortstat --summary
- --patch-with-stat --name-only --name-status --color
- --no-color --color-words --no-renames --check
- --full-index --binary --abbrev --diff-filter
- --find-copies-harder --pickaxe-all --pickaxe-regex
- --text --ignore-space-at-eol --ignore-space-change
- --ignore-all-space --exit-code --quiet --ext-diff
- --no-ext-diff"
- return
- ;;
- esac
- __git_complete_file
-}
-
-_git_diff_tree ()
-{
- __gitcomp "$(__git_refs)"
-}
-
-_git_fetch ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
-
- case "${COMP_WORDS[0]},$COMP_CWORD" in
- git-fetch*,1)
- __gitcomp "$(__git_remotes)"
- ;;
- git,2)
- __gitcomp "$(__git_remotes)"
- ;;
- *)
- case "$cur" in
- *:*)
- __gitcomp "$(__git_refs)" "" "${cur#*:}"
- ;;
- *)
- local remote
- case "${COMP_WORDS[0]}" in
- git-fetch) remote="${COMP_WORDS[1]}" ;;
- git) remote="${COMP_WORDS[2]}" ;;
- esac
- __gitcomp "$(__git_refs2 "$remote")"
- ;;
- esac
- ;;
- esac
-}
-
-_git_format_patch ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __gitcomp "
- --stdout --attach --thread
- --output-directory
- --numbered --start-number
- --numbered-files
- --keep-subject
- --signoff
- --in-reply-to=
- --full-index --binary
- --not --all
- "
- return
- ;;
- esac
- __git_complete_revlist
-}
-
-_git_gc ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --*)
- __gitcomp "--prune --aggressive"
- return
- ;;
- esac
- COMPREPLY=()
-}
-
-_git_ls_remote ()
-{
- __gitcomp "$(__git_remotes)"
-}
-
-_git_ls_tree ()
-{
- __git_complete_file
-}
-
-_git_log ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "$cur" in
- --pretty=*)
- __gitcomp "
- oneline short medium full fuller email raw
- " "" "${cur##--pretty=}"
- return
- ;;
- --date=*)
- __gitcomp "
- relative iso8601 rfc2822 short local default
- " "" "${cur##--date=}"
- return
- ;;
- --*)
- __gitcomp "
- --max-count= --max-age= --since= --after=
- --min-age= --before= --until=
- --root --topo-order --date-order --reverse
- --no-merges --follow
- --abbrev-commit --abbrev=
- --relative-date --date=
- --author= --committer= --grep=
- --all-match
- --pretty= --name-status --name-only --raw
- --not --all
- --left-right --cherry-pick
- "
- return
- ;;
- esac
- __git_complete_revlist
-}
-
-_git_merge ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- case "${COMP_WORDS[COMP_CWORD-1]}" in
- -s|--strategy)
- __gitcomp "$(__git_merge_strategies)"
- return
- esac
- case "$cur" in
- --strategy=*)
- __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
- return
- ;;
- --*)
- __gitcomp "
- --no-commit --no-summary --squash --strategy
- "
- return
- esac
- __gitcomp "$(__git_refs)"
-}
-
-_git_merge_base ()
-{
- __gitcomp "$(__git_refs)"
-}
-
-_git_name_rev ()
-{
- __gitcomp "--tags --all --stdin"
-}
-
-_git_pull ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
-
- case "${COMP_WORDS[0]},$COMP_CWORD" in
- git-pull*,1)
- __gitcomp "$(__git_remotes)"
- ;;
- git,2)
- __gitcomp "$(__git_remotes)"
- ;;
- *)
- local remote
- case "${COMP_WORDS[0]}" in
- git-pull) remote="${COMP_WORDS[1]}" ;;
- git) remote="${COMP_WORDS[2]}" ;;
- esac
- __gitcomp "$(__git_refs "$remote")"
- ;;
- esac
-}
-
-_git_push ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
-
- case "${COMP_WORDS[0]},$COMP_CWORD" in
- git-push*,1)
- __gitcomp "$(__git_remotes)"
- ;;
- git,2)
- __gitcomp "$(__git_remotes)"
- ;;
- *)
- case "$cur" in
- *:*)
- local remote
- case "${COMP_WORDS[0]}" in
- git-push) remote="${COMP_WORDS[1]}" ;;
- git) remote="${COMP_WORDS[2]}" ;;
- esac
- __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
- ;;
- +*)
- __gitcomp "$(__git_refs)" + "${cur#+}"
- ;;
- *)
- __gitcomp "$(__git_refs)"
- ;;
- esac
- ;;
- esac
-}
-
-_git_rebase ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- if [ -d .dotest ] || [ -d .git/.dotest-merge ]; then
- __gitcomp "--continue --skip --abort"
- return
- fi
- case "${COMP_WORDS[COMP_CWORD-1]}" in
- -s|--strategy)
- __gitcomp "$(__git_merge_strategies)"
- return
- esac
- case "$cur" in
- --strategy=*)
- __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}"
- return
- ;;
- --*)
- __gitcomp "--onto --merge --strategy"
- return
- esac
- __gitcomp "$(__git_refs)"
-}
-
-_git_config ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- local prv="${COMP_WORDS[COMP_CWORD-1]}"
- case "$prv" in
- branch.*.remote)
- __gitcomp "$(__git_remotes)"
- return
- ;;
- branch.*.merge)
- __gitcomp "$(__git_refs)"
- return
- ;;
- remote.*.fetch)
- local remote="${prv#remote.}"
- remote="${remote%.fetch}"
- __gitcomp "$(__git_refs_remotes "$remote")"
- return
- ;;
- remote.*.push)
- local remote="${prv#remote.}"
- remote="${remote%.push}"
- __gitcomp "$(git --git-dir="$(__gitdir)" \
- for-each-ref --format='%(refname):%(refname)' \
- refs/heads)"
- return
- ;;
- pull.twohead|pull.octopus)
- __gitcomp "$(__git_merge_strategies)"
- return
- ;;
- color.branch|color.diff|color.status)
- __gitcomp "always never auto"
- return
- ;;
- color.*.*)
- __gitcomp "
- black red green yellow blue magenta cyan white
- bold dim ul blink reverse
- "
- return
- ;;
- *.*)
- COMPREPLY=()
- return
- ;;
- esac
- case "$cur" in
- --*)
- __gitcomp "
- --global --system --file=
- --list --replace-all
- --get --get-all --get-regexp
- --add --unset --unset-all
- --remove-section --rename-section
- "
- return
- ;;
- branch.*.*)
- local pfx="${cur%.*}."
- cur="${cur##*.}"
- __gitcomp "remote merge" "$pfx" "$cur"
- return
- ;;
- branch.*)
- local pfx="${cur%.*}."
- cur="${cur#*.}"
- __gitcomp "$(__git_heads)" "$pfx" "$cur" "."
- return
- ;;
- remote.*.*)
- local pfx="${cur%.*}."
- cur="${cur##*.}"
- __gitcomp "
- url fetch push skipDefaultUpdate
- receivepack uploadpack tagopt
- " "$pfx" "$cur"
- return
- ;;
- remote.*)
- local pfx="${cur%.*}."
- cur="${cur#*.}"
- __gitcomp "$(__git_remotes)" "$pfx" "$cur" "."
- return
- ;;
- esac
- __gitcomp "
- apply.whitespace
- core.fileMode
- core.gitProxy
- core.ignoreStat
- core.preferSymlinkRefs
- core.logAllRefUpdates
- core.loosecompression
- core.repositoryFormatVersion
- core.sharedRepository
- core.warnAmbiguousRefs
- core.compression
- core.legacyHeaders
- core.packedGitWindowSize
- core.packedGitLimit
- clean.requireForce
- color.branch
- color.branch.current
- color.branch.local
- color.branch.remote
- color.branch.plain
- color.diff
- color.diff.plain
- color.diff.meta
- color.diff.frag
- color.diff.old
- color.diff.new
- color.diff.commit
- color.diff.whitespace
- color.pager
- color.status
- color.status.header
- color.status.added
- color.status.changed
- color.status.untracked
- diff.renameLimit
- diff.renames
- fetch.unpackLimit
- format.headers
- format.subjectprefix
- gitcvs.enabled
- gitcvs.logfile
- gitcvs.allbinary
- gitcvs.dbname gitcvs.dbdriver gitcvs.dbuser gitcvs.dvpass
- gc.packrefs
- gc.reflogexpire
- gc.reflogexpireunreachable
- gc.rerereresolved
- gc.rerereunresolved
- http.sslVerify
- http.sslCert
- http.sslKey
- http.sslCAInfo
- http.sslCAPath
- http.maxRequests
- http.lowSpeedLimit
- http.lowSpeedTime
- http.noEPSV
- i18n.commitEncoding
- i18n.logOutputEncoding
- log.showroot
- merge.tool
- merge.summary
- merge.verbosity
- pack.window
- pack.depth
- pack.windowMemory
- pack.compression
- pack.deltaCacheSize
- pack.deltaCacheLimit
- pull.octopus
- pull.twohead
- repack.useDeltaBaseOffset
- show.difftree
- showbranch.default
- tar.umask
- transfer.unpackLimit
- receive.unpackLimit
- receive.denyNonFastForwards
- user.name
- user.email
- user.signingkey
- whatchanged.difftree
- branch. remote.
- "
-}
-
-_git_remote ()
-{
- local i c=1 command
- while [ $c -lt $COMP_CWORD ]; do
- i="${COMP_WORDS[c]}"
- case "$i" in
- add|rm|show|prune|update) command="$i"; break ;;
- esac