{"thread":{"id":"4001","subject":"[PATCH] cg-admin-rewritehist: Seed the commit map with the parents specified with -r.","startedAt":"2006-04-29T21:45:38Z","lastAt":"2006-04-29T21:45:38Z","messageCount":1,"participants":["Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"19268","messageId":"20060429214538.4E2D54A54D@dx.sixt.local","threadId":"4001","inReplyTo":null,"subject":"[PATCH] cg-admin-rewritehist: Seed the commit map with the parents specified with -r.","fromName":"Johannes Sixt","fromEmail":"johannes.sixt@telecom.at","sentAt":"2006-04-29T21:45:38Z","receivedAt":"2006-04-29T21:45:38Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"When the first commit is manufactured, its parents are looked up in the\ncommit map. However, without this patch the map is always empty at that time.\nIf the entire history is rewritten, this is no problem because the first\ncommit does not have any parents anyway. However, if -r is used to constrain\nrewriting to only part of the history, this first commit is manufactured\nincorrectly without parents because 'cat' fails.\n\nSigned-off-by: Johannes Sixt <johannes.sixt@telecom.at>\n\n---\n\n cg-admin-rewritehist |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\n977fc81815877a1e72040355b221fe8d62593eb7\ndiff --git a/cg-admin-rewritehist b/cg-admin-rewritehist\nindex 9fa4c2a..7dd83cf 100755\n--- a/cg-admin-rewritehist\n+++ b/cg-admin-rewritehist\n@@ -141,6 +141,7 @@ _git_requires_root=1\n \n tempdir=.git-rewrite\n startrev=\n+startrevparents=\n filter_env=\n filter_tree=\n filter_index=\n@@ -152,6 +153,7 @@ while optparse; do\n \t\ttempdir=\"$OPTARG\"\n \telif optparse -r=; then\n \t\tstartrev=\"^$OPTARG^ $OPTARG $startrev\"\n+\t\tstartrevparents=\"$OPTARG^ $startrevparents\"\n \telif optparse --env-filter=; then\n \t\tfilter_env=\"$OPTARG\"\n \telif optparse --tree-filter=; then\n@@ -186,6 +188,12 @@ ret=0\n \n mkdir ../map # map old->new commit ids for rewriting parents\n \n+# seed with identity mappings for the parents where we start off\n+for commit in $startrevparents; do\n+\tcommit=\"$(git-rev-parse $commit)\"\n+\techo $commit > ../map/$commit\n+done\n+\n git-rev-list --topo-order HEAD $startrev | tac >../revs\n commits=$(cat ../revs | wc -l)\n \n-- \n1.3.1.gaa6b\n"}]}