[PATCH] filter-branch: assume HEAD if no revision supplied

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Brandon Casey
Date: Wednesday, January 30, 2008 - 12:33 pm

filter-branch previously took the first non-option argument as the name for
a new branch. Since dfd05e38, it now takes a revision or a revision range
and modifies the current branch. Update to operate on HEAD by default to
conform with standard git interface practice.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---


You may think that filter-branch _should_ require the user to specify the
revision. If so, then '--default HEAD' should probably be removed from the
other two places, and the usage and documentation should be updated to
remove the brackets around <rev-list options> so not to imply that it is
optional. The test for at least one non-option argument can still be
removed since it can currently be circumvented by placing -- as the
last argument and because it would allow format-patch to fail with
a much nicer message: "Which ref do you want to rewrite?".

fwiw the behavior this patch implements is what I expected.

-brandon


 git-filter-branch.sh |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ebf05ca..cd1eeee 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -114,7 +114,6 @@ orig_namespace=refs/original/
 force=
 while :
 do
-	test $# = 0 && usage
 	case "$1" in
 	--)
 		shift
@@ -210,7 +209,7 @@ GIT_WORK_TREE=.
 export GIT_DIR GIT_WORK_TREE
 
 # The refs should be updated if their heads were rewritten
-git rev-parse --no-flags --revs-only --symbolic-full-name "$@" |
+git rev-parse --no-flags --revs-only --symbolic-full-name --default HEAD "$@" |
 sed -e '/^^/d' >"$tempdir"/heads
 
 test -s "$tempdir"/heads ||
-- 
1.5.4.rc5.14.gaa8fc

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] filter-branch: assume HEAD if no revision supplied, Brandon Casey, (Wed Jan 30, 12:33 pm)
Re: [PATCH] filter-branch: assume HEAD if no revision supplied, Johannes Schindelin, (Wed Jan 30, 1:35 pm)
Re: [PATCH] filter-branch: assume HEAD if no revision supplied, Johannes Schindelin, (Wed Jan 30, 5:16 pm)
Re: [PATCH] filter-branch docs: remove brackets so not to ..., Johannes Schindelin, (Wed Jan 30, 6:53 pm)