git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] filter-branch: assume HEAD if no revision supplied
@ 2008-01-30 19:33 Brandon Casey
  2008-01-30 20:35 ` Johannes Schindelin
  0 siblings, 1 reply; 21+ messages in thread
From: Brandon Casey @ 2008-01-30 19:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List, Johannes Schindelin

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

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-01-31 21:54 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 19:33 [PATCH] filter-branch: assume HEAD if no revision supplied Brandon Casey
2008-01-30 20:35 ` Johannes Schindelin
2008-01-30 21:03   ` Junio C Hamano
2008-01-30 23:35     ` Brandon Casey
2008-01-31  0:13       ` [PATCH 1/2] filter-branch: only print usage information when no arguments supplied Brandon Casey
2008-01-31  1:34         ` Junio C Hamano
2008-01-31  2:05           ` Brandon Casey
2008-01-31  2:44             ` Junio C Hamano
     [not found]       ` <1201738186-28132-1-git-send-email-casey@nrlssc.navy.mil>
2008-01-31  0:15         ` [PATCH 2/2] git-filter-branch.sh: don't use --default when calling rev-list Brandon Casey
2008-01-31  0:49           ` Johannes Schindelin
2008-01-31  1:35             ` Brandon Casey
2008-01-31  9:17               ` Andreas Ericsson
2008-01-31  9:27                 ` Junio C Hamano
2008-01-31 11:07                   ` Johannes Schindelin
2008-01-31  0:16       ` [PATCH] filter-branch: assume HEAD if no revision supplied Johannes Schindelin
2008-01-31  0:20         ` Brandon Casey
2008-01-31  0:41       ` [PATCH] filter-branch docs: remove brackets so not to imply revision arg is optional Brandon Casey
2008-01-31  1:22         ` Junio C Hamano
2008-01-31  1:53           ` Johannes Schindelin
2008-01-31 16:29           ` Brandon Casey
2008-01-31 21:53             ` Junio C Hamano

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).