From f727998817f5473acaa9d6806319bf7e812dc2e1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 14 Jan 2017 20:00:45 -0500 Subject: Rename scripts --- commit-remove-pointless-commit | 52 ++++++++++++++++++++++++++++++++++++++++++ git-filter-branch-magic.txt | 11 --------- msg-record-original-commit | 4 ++++ record-original-commit.sh | 4 ---- remove-pointless-commit.rb | 52 ------------------------------------------ 5 files changed, 56 insertions(+), 67 deletions(-) create mode 100755 commit-remove-pointless-commit delete mode 100644 git-filter-branch-magic.txt create mode 100755 msg-record-original-commit delete mode 100755 record-original-commit.sh delete mode 100755 remove-pointless-commit.rb diff --git a/commit-remove-pointless-commit b/commit-remove-pointless-commit new file mode 100755 index 0000000..ba33522 --- /dev/null +++ b/commit-remove-pointless-commit @@ -0,0 +1,52 @@ +#!/usr/bin/ruby +# Executed like the following to trim off pointless commits (including merge commits) +# that doesn't change the tree +# git filter-branch -f --commit-filter '~/ws/jenkins/split2/helper.rb "$@"' HEAD +# +# parameters are " [ -p ]*" and is the same as git commit-tree + +# system "echo executing #{ARGV.join(' ')} >> /tmp/log" + +# extract parents +parents=[] +i=2 +while i> /tmp/log" + exec "git commit-tree #{args.join(' ')}" +else + # system "echo skipping >> /tmp/log" + # otherwise don't create this as a commit + puts parents +end + + diff --git a/git-filter-branch-magic.txt b/git-filter-branch-magic.txt deleted file mode 100644 index 8fbd83f..0000000 --- a/git-filter-branch-magic.txt +++ /dev/null @@ -1,11 +0,0 @@ -find . -name .git -prune -o -type d -o -print | grep -v Ant | grep -v ant | xargs rm -f - -# TODO: need to generalize the filtering logic -# git update-index generates no index file if stdin is empty -# this also reduces empty commits as much as possible -# "ant\|Ant" -git filter-branch -f --prune-empty --msg-filter ~/ws/git-filter-branch-tools/record-original-commit.sh --index-filter 'git ls-files -s | grep "Javadoc\|javadoc" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && ((test -f $GIT_INDEX_FILE.new && mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE) || rm -f $GIT_INDEX_FILE)' HEAD - -# remove all the other pointless merges -git filter-branch -f --commit-filter "~/ws/git-filter-branch-tools/remove-pointless-commit.rb \"\$@\"" HEAD - diff --git a/msg-record-original-commit b/msg-record-original-commit new file mode 100755 index 0000000..cbb96e1 --- /dev/null +++ b/msg-record-original-commit @@ -0,0 +1,4 @@ +#!/bin/sh +# commit message filter used with git-filter-branch to record the original commit ID +cat +echo "\nOriginally-Committed-As: $GIT_COMMIT" diff --git a/record-original-commit.sh b/record-original-commit.sh deleted file mode 100755 index cbb96e1..0000000 --- a/record-original-commit.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# commit message filter used with git-filter-branch to record the original commit ID -cat -echo "\nOriginally-Committed-As: $GIT_COMMIT" diff --git a/remove-pointless-commit.rb b/remove-pointless-commit.rb deleted file mode 100755 index ba33522..0000000 --- a/remove-pointless-commit.rb +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/ruby -# Executed like the following to trim off pointless commits (including merge commits) -# that doesn't change the tree -# git filter-branch -f --commit-filter '~/ws/jenkins/split2/helper.rb "$@"' HEAD -# -# parameters are " [ -p ]*" and is the same as git commit-tree - -# system "echo executing #{ARGV.join(' ')} >> /tmp/log" - -# extract parents -parents=[] -i=2 -while i> /tmp/log" - exec "git commit-tree #{args.join(' ')}" -else - # system "echo skipping >> /tmp/log" - # otherwise don't create this as a commit - puts parents -end - - -- cgit v1.2.3-54-g00ecf