From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Johannes Sixt <J.Sixt@eudaptics.com>
Cc: gitster@pobox.com, git@vger.kernel.org
Subject: [PATCH] filter-branch: when dwim'ing a ref, only allow heads and tags
Date: Tue, 24 Jul 2007 12:27:59 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707241227140.14781@racer.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0707241218270.14781@racer.site>
Previously, we matched all refs that had /$ref in them. And tried to
verify the result as a ref. If more than one match was found, the result
was not a ref, though.
So only allow tags and heads to be dwim'ed. If both a tag and a head with
that name exist, it will be ignored again.
Caught by Johannes Sixt.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
Heh. I just realised that I managed to fsck up a one-line patch.
D'oh! Thanks for fixing it, Hannes.
git-filter-branch.sh | 2 +-
t/t7003-filter-branch.sh | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 0ff3475..4fb3abe 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -193,7 +193,7 @@ do
;;
*)
ref="$(git for-each-ref --format='%(refname)' |
- grep /"$ref")"
+ grep -e "^refs/heads/$ref$" -e "^refs/tags/$ref$")"
esac
git check-ref-format "$ref" && echo "$ref"
diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh
index bc6e2dd..c9a820d 100755
--- a/t/t7003-filter-branch.sh
+++ b/t/t7003-filter-branch.sh
@@ -159,4 +159,9 @@ test_expect_success 'barf on invalid name' '
! git filter-branch -f HEAD^
'
+test_expect_success 'only dwim refs/heads/$ref or refs/tags/$ref' '
+ git update-ref refs/remotes/origin/master HEAD &&
+ git filter-branch -f master
+'
+
test_done
--
1.5.3.rc2.32.g35c5b-dirty
next prev parent reply other threads:[~2007-07-24 11:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-23 17:34 [PATCH] filter-branch: Big syntax change; support rewriting multiple refs Johannes Schindelin
2007-07-24 5:35 ` Junio C Hamano
2007-07-24 9:10 ` Johannes Schindelin
2007-07-24 9:27 ` [PATCH] filter-branch: Big syntax change; support rewriting multiplerefs Johannes Sixt
2007-07-24 10:36 ` [PATCH] filter-branch: when dwim'ing a ref, only allow heads and tags Johannes Schindelin
2007-07-24 11:04 ` [PATCH] filter-branch: when dwim'ing a ref, only allow heads andtags Johannes Sixt
2007-07-24 11:20 ` Johannes Schindelin
2007-07-24 11:27 ` Johannes Schindelin [this message]
2007-07-24 11:06 ` [PATCH] filter-branch: rewrite only refs which were not excluded by the options Johannes Schindelin
2007-07-24 11:23 ` [PATCH] filter-branch: rewrite only refs which were not excluded bythe options Johannes Sixt
2007-07-24 11:33 ` Johannes Schindelin
2007-07-24 13:32 ` [PATCH] filter-branch: rewrite only refs which were not excludedbythe options Johannes Sixt
2007-07-24 13:41 ` Johannes Schindelin
2007-07-24 14:08 ` Johannes Sixt
2007-07-24 14:21 ` Johannes Schindelin
2007-07-24 15:03 ` Johannes Sixt
2007-07-24 19:52 ` Johannes Schindelin
2007-07-24 13:42 ` [REVISED PATCH] filter-branch: rewrite only unexcluded refs Johannes Schindelin
2007-07-24 13:33 ` [PATCH] filter-branch: rewrite only refs which were not excludedbythe options Johannes Sixt
2007-07-24 13:46 ` 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=Pine.LNX.4.64.0707241227140.14781@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=J.Sixt@eudaptics.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).