[PATCH 2/2] git-filter-branch.sh: don't use --default when calling rev-list

Subsystems: the rest

DORMANTno replies

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH 2/2] git-filter-branch.sh: don't use --default when calling rev-list

From: Brandon Casey <hidden>
Date: 2016-06-15 22:44:09

This command requires a revision to be specified on the command line,
so remove '--default HEAD' from the arguments to git rev-list. They
are unnecessary.

Signed-off-by: Brandon Casey <redacted>
---
 git-filter-branch.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 5e3fe70..25f18f8 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -228,11 +228,10 @@ mkdir ../map || die "Could not create map/ directory"
 
 case "$filter_subdir" in
 "")
-	git rev-list --reverse --topo-order --default HEAD \
-		--parents "$@"
+	git rev-list --reverse --topo-order --parents "$@"
 	;;
 *)
-	git rev-list --reverse --topo-order --default HEAD \
+	git rev-list --reverse --topo-order \
 		--parents --full-history "$@" -- "$filter_subdir"
 esac > ../revs || die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
-- 
1.5.4.rc5.14.gaa8fc

Re: [PATCH 2/2] git-filter-branch.sh: don't use --default when calling rev-list

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:44:09

Hi,

On Wed, 30 Jan 2008, Brandon Casey wrote:
This command requires a revision to be specified on the command line, so 
remove '--default HEAD' from the arguments to git rev-list. They are 
unnecessary.
But I thought that you wanted "git filter-branch --msg-filter=rot13" to 
work on HEAD by default?

Ciao,
Dscho

Re: [PATCH 2/2] git-filter-branch.sh: don't use --default when calling rev-list

From: Brandon Casey <hidden>
Date: 2016-06-15 22:44:09

Johannes Schindelin wrote:
Hi,

On Wed, 30 Jan 2008, Brandon Casey wrote:
quoted
This command requires a revision to be specified on the command line, so 
remove '--default HEAD' from the arguments to git rev-list. They are 
unnecessary.
But I thought that you wanted "git filter-branch --msg-filter=rot13" to 
work on HEAD by default?
I do. But isn't that inconsistent with "git filter-branch" does _not_ work
on HEAD by default and instead prints out usage information?

If I do:

	git filter-branch -d /tmp/git_temp

and it is successful, I think I would also expect this to succeed:

	git filter-branch

So, I think the "operates on HEAD" by default is consistent with what other
git tools do, but I think it is not consistent for filter-branch to sometimes
operate on HEAD by default and sometimes error with usage information.

Disclaimer: I have only used filter-branch for two tasks.

-brandon

Re: [PATCH 2/2] git-filter-branch.sh: don't use --default when calling rev-list

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:44:09

Brandon Casey wrote:
Johannes Schindelin wrote:
quoted
Hi,

On Wed, 30 Jan 2008, Brandon Casey wrote:
quoted
This command requires a revision to be specified on the command line, so 
remove '--default HEAD' from the arguments to git rev-list. They are 
unnecessary.
But I thought that you wanted "git filter-branch --msg-filter=rot13" to 
work on HEAD by default?
I do. But isn't that inconsistent with "git filter-branch" does _not_ work
on HEAD by default and instead prints out usage information?

If I do:

	git filter-branch -d /tmp/git_temp

and it is successful, I think I would also expect this to succeed:

	git filter-branch

So, I think the "operates on HEAD" by default is consistent with what other
git tools do, but I think it is not consistent for filter-branch to sometimes
operate on HEAD by default and sometimes error with usage information.
Well, if there's no filter specified it has nothing to do, so erroring out
in the no-arguments-at-all case would be sensible.

OTOH, it would be better to error out for the no-filter case explicitly,
which would also cause the no-arguments case to error out.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help