{"thread":{"id":"8510","subject":"[PATCH 1/2] filter-branch: Simplify parent computation.","startedAt":"2007-06-08T21:28:39Z","lastAt":"2007-06-10T07:14:32Z","messageCount":4,"participants":["Johannes Sixt","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"44377","messageId":"200706082328.39758.johannes.sixt@telecom.at","threadId":"8510","inReplyTo":null,"subject":"[PATCH 1/2] filter-branch: Simplify parent computation.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2007-06-08T21:28:39Z","receivedAt":"2007-06-08T21:28:39Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"We can use git rev-list --parents when we list the commits to rewrite.\nIt is not necessary to run git rev-list --parents for each commit in the\nloop.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n---\n git-filter-branch.sh |   24 +++++++-----------------\n 1 files changed, 7 insertions(+), 17 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex 4990729..4ef4570 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -229,17 +229,6 @@ set_ident () {\n \techo \"[ -n \\\"\\$GIT_${uid}_NAME\\\" ] || export \nGIT_${uid}_NAME=\\\"\\${GIT_${uid}_EMAIL%%@*}\\\"\"\n }\n \n-# list all parent's object names for a given commit\n-get_parents () {\n-\tcase \"$filter_subdir\" in\n-\t\"\")\n-\t\tgit-rev-list -1 --parents \"$1\"\n-\t\t;;\n-\t*)\n-\t\tgit-rev-list -1 --parents \"$1\" -- \"$filter_subdir\"\n-\tesac | sed \"s/^[0-9a-f]*//\"\n-}\n-\n tempdir=.git-rewrite\n filter_env=\n filter_tree=\n@@ -332,18 +321,19 @@ mkdir ../map # map old->new commit ids for rewriting \nparents\n \n case \"$filter_subdir\" in\n \"\")\n-\tgit-rev-list --reverse --topo-order --default HEAD \"$@\"\n+\tgit-rev-list --reverse --topo-order --default HEAD \\\n+\t\t--parents \"$@\"\n \t;;\n *)\n-\tgit-rev-list --reverse --topo-order --default HEAD \"$@\" \\\n-\t\t-- \"$filter_subdir\"\n+\tgit-rev-list --reverse --topo-order --default HEAD \\\n+\t\t--parents \"$@\" -- \"$filter_subdir\"\n esac > ../revs\n commits=$(cat ../revs | wc -l | tr -d \" \")\n \n test $commits -eq 0 && die \"Found nothing to rewrite\"\n \n i=0\n-while read commit; do\n+while read commit parents; do\n \ti=$(($i+1))\n \tprintf \"\\rRewriting commits... ($i/$commits)\"\n \n@@ -377,7 +367,7 @@ while read commit; do\n \teval \"$filter_index\" < /dev/null\n \n \tparentstr=\n-\tfor parent in $(get_parents $commit); do\n+\tfor parent in $parents; do\n \t\tfor reparent in $(map \"$parent\"); do\n \t\t\tparentstr=\"$parentstr -p $reparent\"\n \t\tdone\n@@ -398,7 +388,7 @@ while read commit; do\n \t\tdone > ../map/$commit\n done <../revs\n \n-src_head=$(tail -n 1 ../revs)\n+src_head=$(tail -n 1 ../revs | sed -e 's/ .*//')\n target_head=$(head -n 1 ../map/$src_head)\n case \"$target_head\" in\n '')\n-- \n1.5.2\n"},{"id":"44380","messageId":"Pine.LNX.4.64.0706082228450.4059@racer.site","threadId":"8510","inReplyTo":"200706082328.39758.johannes.sixt@telecom.at","subject":"Re: [PATCH 1/2] filter-branch: Simplify parent computation.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-08T21:29:17Z","receivedAt":"2007-06-08T21:29:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nAcked-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nfor both patches. They look obviously correct to me.\n\nCiao,\nDscho\n"},{"id":"44487","messageId":"7vmyz8eu3y.fsf@assigned-by-dhcp.cox.net","threadId":"8510","inReplyTo":"200706082328.39758.johannes.sixt@telecom.at","subject":"Re: [PATCH 1/2] filter-branch: Simplify parent computation.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-09T20:44:01Z","receivedAt":"2007-06-09T20:44:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <johannes.sixt@telecom.at> writes:\n\n> @@ -332,18 +321,19 @@ mkdir ../map # map old->new commit ids for rewriting \n> parents\n>  \n\nCrap.  Why is this patch line-wrapped X-<.\n\n> ... \n>  i=0\n> -while read commit; do\n> +while read commit parents; do\n>  \ti=$(($i+1))\n>  \tprintf \"\\rRewriting commits... ($i/$commits)\"\n>  \n\nCrap.  Where did that \"\\rRewriting commits...\" come from?\nThe other Johannes had the same in his patch.\n\n> @@ -398,7 +388,7 @@ while read commit; do\n>  \t\tdone > ../map/$commit\n>  done <../revs\n>  \n> -src_head=$(tail -n 1 ../revs)\n> +src_head=$(tail -n 1 ../revs | sed -e 's/ .*//')\n>  target_head=$(head -n 1 ../map/$src_head)\n>  case \"$target_head\" in\n>  '')\n\nCrap.  I seem to have \"tee\" there that stores them to ../map/$commit.\n\nAnyway, I've manually fixed up the offending three patches (two\nfrom you and one from the other Johannes) and pushed the results\nout on 'next'.\n"},{"id":"44532","messageId":"Pine.LNX.4.64.0706100813400.4059@racer.site","threadId":"8510","inReplyTo":"7vmyz8eu3y.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/2] filter-branch: Simplify parent computation.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-10T07:14:32Z","receivedAt":"2007-06-10T07:14:32Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 9 Jun 2007, Junio C Hamano wrote:\n\n> Anyway, I've manually fixed up the offending three patches (two from you \n> and one from the other Johannes) and pushed the results out on 'next'.\n\nSorry. I guess we were just beaming patches back and forth, applying them \nin our local repos, and working from there.\n\nI promise to try better.\n\nCiao,\nDscho\n"}]}