From: Pierre Habouzit <madcoder@debian.org>
To: git@vger.kernel.org
Cc: pasky@suse.cz, srabbelier@gmail.com,
Pierre Habouzit <madcoder@debian.org>
Subject: [PATCH] make git-filter-branch use parse-options.
Date: Thu, 30 Oct 2008 17:18:57 +0100 [thread overview]
Message-ID: <1225383538-23666-2-git-send-email-madcoder@debian.org> (raw)
In-Reply-To: <1225383538-23666-1-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
git-filter-branch.sh | 93 +++++++++++++++++++++-----------------------------
1 files changed, 39 insertions(+), 54 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 81392ad..8af3126 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -87,14 +87,26 @@ set_ident () {
echo "case \"\$GIT_${uid}_NAME\" in \"\") GIT_${uid}_NAME=\"\${GIT_${uid}_EMAIL%%@*}\" && export GIT_${uid}_NAME;; esac"
}
-USAGE="[--env-filter <command>] [--tree-filter <command>] \
-[--index-filter <command>] [--parent-filter <command>] \
-[--msg-filter <command>] [--commit-filter <command>] \
-[--tag-name-filter <command>] [--subdirectory-filter <directory>] \
-[--original <namespace>] [-d <directory>] [-f | --force] \
-[<rev-list options>...]"
-
-OPTIONS_SPEC=
+OPTIONS_KEEPDASHDASH=
+OPTIONS_SPEC="\
+git filter-branch [options] [<rev-list options>...]
+--
+d= temporary path to use for rewriting
+f,force force filter-branch to run
+subdirectory-filter= only look at the history touching that specific subdirectory
+original= namespace where the original commits will be stored (default: refs/original)
+
+ Filters that you can run:
+
+env-filter= environment filter to run
+tree-filter= tree rewriting filter to run
+index-filter= index rewriting filter to run
+parent-filter= parent rewriting filter to run
+msg-filter= commit message rewriting filter to run
+commit-filter= commit rewriting filter to run
+tag-name-filter= tag name rewriting filter to run
+"
+
. git-sh-setup
if [ "$(is_bare_repository)" = false ]; then
@@ -117,63 +129,36 @@ force=
while :
do
case "$1" in
- --)
- shift
- break
- ;;
--force|-f)
- shift
- force=t
- continue
- ;;
- -*)
- ;;
- *)
- break;
- esac
-
- # all switches take one argument
- ARG="$1"
- case "$#" in 1) usage ;; esac
- shift
- OPTARG="$1"
- shift
-
- case "$ARG" in
+ force=t;;
-d)
- tempdir="$OPTARG"
- ;;
+ tempdir="$2"; shift;;
+ --subdirectory-filter)
+ filter_subdir="$2"; shift;;
+ --original)
+ orig_namespace=$(expr "$2/" : '\(.*[^/]\)/*$')/
+ shift;;
+
--env-filter)
- filter_env="$OPTARG"
- ;;
+ filter_env="$2"; shift;;
--tree-filter)
- filter_tree="$OPTARG"
- ;;
+ filter_tree="$2"; shift;;
--index-filter)
- filter_index="$OPTARG"
- ;;
+ filter_index="$2"; shift;;
--parent-filter)
- filter_parent="$OPTARG"
- ;;
+ filter_parent="$2"; shift;;
--msg-filter)
- filter_msg="$OPTARG"
- ;;
+ filter_msg="$2"; shift;;
--commit-filter)
- filter_commit="$functions; $OPTARG"
- ;;
+ filter_commit="$functions; $2"; shift;;
--tag-name-filter)
- filter_tag_name="$OPTARG"
- ;;
- --subdirectory-filter)
- filter_subdir="$OPTARG"
- ;;
- --original)
- orig_namespace=$(expr "$OPTARG/" : '\(.*[^/]\)/*$')/
- ;;
+ filter_tag_name="$2"; shift;;
+ --)
+ shift; break;;
*)
- usage
- ;;
+ usage;;
esac
+ shift
done
case "$force" in
--
1.6.0.3.758.gc29b0
next prev parent reply other threads:[~2008-10-30 16:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-30 0:33 [PATCH] git-filter-branch: Add an example on how to remove empty commits Petr Baudis
2008-10-30 0:39 ` Sam Vilain
2008-10-30 0:56 ` Johannes Schindelin
2008-10-30 13:26 ` Pierre Habouzit
2008-10-30 15:06 ` Deskin Miller
2008-10-30 15:10 ` Pierre Habouzit
2008-10-30 16:18 ` filter-branch enhancements Pierre Habouzit
2008-10-30 16:18 ` Pierre Habouzit [this message]
2008-10-30 16:18 ` [Proof of concept PATCH] implement --prune-empty switch for filter-branch Pierre Habouzit
2008-10-31 8:22 ` [PATCH] make git-filter-branch use parse-options Pierre Habouzit
2008-10-31 9:26 ` [PATCH] filter-branch: add git_commit_non_empty_tree and --prune-empty Pierre Habouzit
2008-10-31 22:36 ` Johannes Schindelin
2008-10-31 22:42 ` Pierre Habouzit
2008-11-03 4:58 ` Junio C Hamano
2008-11-03 9:27 ` Pierre Habouzit
2008-11-03 15:18 ` Pierre Habouzit
2009-01-09 19:29 ` Jay Soffian
2009-01-11 11:18 ` Pierre Habouzit
2009-01-11 13:35 ` Johannes Schindelin
2009-01-11 14:27 ` Pierre Habouzit
2009-01-11 14:40 ` Sverre Rabbelier
2009-01-11 14:55 ` Pierre Habouzit
2009-01-11 15:08 ` Sverre Rabbelier
2009-01-11 20:52 ` Junio C Hamano
2009-01-11 20:55 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225383538-23666-2-git-send-email-madcoder@debian.org \
--to=madcoder@debian.org \
--cc=git@vger.kernel.org \
--cc=pasky@suse.cz \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).