Thread (25 messages) flat view 25 messages, 5 authors, 2016-06-15

Re: [RFH] filter-branch: ancestor detection weirdness

From: Thomas Rast <hidden>
Date: 2016-06-15 22:45:07
Subsystem: the rest · Maintainer: Linus Torvalds

Johannes Schindelin wrote:
But hey, if other people agree with you, and this kind of thinking ends 
up in Git proper, I can still resort to other DVCSes.
BTW, the following is fairly ironic.  (It was later rewritten in
813b473 to the current one-shot 'rev-list --parents' form.)

commit 685ef546b62d063c72b401cd38b83a879301aac4
Author: Johannes Schindelin [off-list ref]
Date:   Fri Jun 8 01:30:35 2007 +0100

    Teach filter-branch about subdirectory filtering
    
    With git-filter-branch --subdirectory-filter <subdirectory> you can
    get at the history, as seen by a certain subdirectory. The history
    of the rewritten branch will only contain commits that touched that
    subdirectory, and the subdirectory will be rewritten to be the new
    project root.
    
    Signed-off-by: Johannes Schindelin [off-list ref]
    Signed-off-by: Junio C Hamano [off-list ref]
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
[...snip...]
@@ -224,7 +228,13 @@ set_ident () {
 
 # list all parent's object names for a given commit
 get_parents () {
-	git-rev-list -1 --parents "$1" | sed "s/^[0-9a-f]*//"
+	case "$filter_subdir" in
+	"")
+		git-rev-list -1 --parents "$1"
+		;;
+	*)
+		git-rev-list -1 --parents "$1" -- "$filter_subdir"
+	esac | sed "s/^[0-9a-f]*//"
 }
 
 tempdir=.git-rewrite
[...snip...]

-- 
Thomas Rast
trast@student.ethz.ch

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help