Permalink
Browse files

merge in git-scripts

  • Loading branch information...
1 parent aa4350b commit a3bf339ce5016c9cd7edc8bb77a832f142b4ae06 @ddollar committed Dec 22, 2008
Showing with 2,737 additions and 3 deletions.
  1. +4 −0 git-addremove
  2. +15 −0 git-all-commits
  3. +26 −0 git-build
  4. +79 −0 git-changelog
  5. +10 −0 git-children-of
  6. +21 −0 git-current
  7. +16 −0 git-diff-directory
  8. +6 −0 git-empty-branch
  9. +2 −0 git-erase-reflog
  10. +3 −0 git-external-ediff
  11. +259 −0 git-find
  12. +13 −0 git-find-blob
  13. +11 −0 git-find-children
  14. +73 −0 git-find-fetch
  15. +17 −0 git-flush
  16. +3 −0 git-full-reset
  17. +5 −0 git-hunt-and-seek
  18. +5 −0 git-maxpack
  19. +54 −0 git-opendiff
  20. +10 −0 git-publish
  21. +3 −0 git-publish-repo
  22. +1 −3 git-push-all
  23. +2 −0 git-push-branch
  24. +57 −0 git-rank-contributors
  25. +260 −0 git-record
  26. +2 −0 git-remove-empty-commits
  27. +12 −0 git-retrack
  28. +62 −0 git-rm-conflicts
  29. +1,481 −0 git-sh
  30. +3 −0 git-signed-tag
  31. +2 −0 git-snapshot
  32. +43 −0 git-sync
  33. +3 −0 git-trash
  34. +12 −0 git-unpack
  35. +162 −0 git-wtf
View
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+git add -A
+git ls-files --deleted -z | xargs -0 git rm
View
@@ -0,0 +1,15 @@
+#!/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
@@ -0,0 +1,26 @@
+#!/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
@@ -0,0 +1,79 @@
+#!/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
@@ -0,0 +1,10 @@
+#!/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
@@ -0,0 +1,21 @@
+#!/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
@@ -0,0 +1,16 @@
+#!/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
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+git stash
+git symbolic-ref HEAD refs/heads/$1
+rm .git/index
+git clean -f -d
View
@@ -0,0 +1,2 @@
+#!/bin/sh
+git reflog expire --expire=0 "$@"
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+[ $# -eq 7 ] && emacsclient --eval "(ediff \"$2\" \"$PWD/$5\")"
Oops, something went wrong.

0 comments on commit a3bf339

Please sign in to comment.