{"thread":{"id":"10334","subject":"Question on git-filter-branch","startedAt":"2007-10-17T00:57:23Z","lastAt":"2007-10-19T00:06:04Z","messageCount":5,"participants":["Bill Lear","Johannes Schindelin","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"56165","messageId":"18197.24051.863751.436705@lisa.zopyra.com","threadId":"10334","inReplyTo":null,"subject":"Question on git-filter-branch","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-10-17T00:57:23Z","receivedAt":"2007-10-17T00:57:23Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"I'm testing out git-filter-branch, as I would like to use it to remove\nproprietary information from our repository.\n\nI created a test repo with \"sensitive information\" in a file 'A', some\nother \"plain\" information, more sensitive stuff in file 'D', a subdirectory\nof sensitive information (some of this added on a branch 'branch_1',\nsome added on master):\n\n% ls -F sensitive\nA  B  C  D  sensitive_stuff/\n\nI then cloned this repo and tried the filter:\n\n% git clone sensitive sensitive.clone\n% cd sensitive.clone\n% git filter-branch --index-filter 'git update-index --remove A' HEAD\nRewrite 5dd7d5f2d7d3a5f43c242188ac96294628267673 (7/7)\nRef 'refs/heads/master' was rewritten\n\nThese refs were rewritten:\n% ls\nA  B  C  D  sensitive_stuff\n\nOk, so it doesn't list the refs, so I do git status:\n\n% git status\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       new file:   A\n#\n\nSo, it seems to have done something to A, but I don't know what to do\nnext.\n\nThe man page says: \"Now, you will get the rewritten history saved in\nthe branch newbranch (your current branch is left untouched).\"  Well,\nI don't see any new branch created:\n\n% git branch -a\n* master\n  origin/HEAD\n  origin/branch_1\n  origin/master\n\nThen next part of the man page counsels that \"To set a commit ...\",\nbut I'm not sure if that is what I want to do (I think it is).\nHowever, I'm not sure what the 'graft-id' refers to, or if I'm\nsupposed to type in the command as specified, especially since this is\nfollowed by this caution: \"if the parent string is empty - which\nhappens when we are dealing with the initial commit - add graftcommit\nas a parent\".  Here, I'm unsure what graftcommit is, most especially\nsince the use of 'graft' first appears as 'graft-id'...\n\nCould someone help, please?\n\n\nBill\n"},{"id":"56184","messageId":"Pine.LNX.4.64.0710170322000.25221@racer.site","threadId":"10334","inReplyTo":"18197.24051.863751.436705@lisa.zopyra.com","subject":"[PATCH 1/2] fix filter-branch documentation","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-17T02:22:25Z","receivedAt":"2007-10-17T02:22:25Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThe man page for filter-branch still talked about writing the result\nto the branch \"newbranch\".  This is hopefully the last place where the\nold behaviour was described.\n\nNoticed by Bill Lear.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n Documentation/git-filter-branch.txt |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt\nindex c878ed3..ba9b4fb 100644\n--- a/Documentation/git-filter-branch.txt\n+++ b/Documentation/git-filter-branch.txt\n@@ -180,8 +180,7 @@ A significantly faster version:\n git filter-branch --index-filter 'git update-index --remove filename' HEAD\n --------------------------------------------------------------------------\n \n-Now, you will get the rewritten history saved in the branch 'newbranch'\n-(your current branch is left untouched).\n+Now, you will get the rewritten history saved in HEAD.\n \n To set a commit (which typically is at the tip of another\n history) to be the parent of the current initial commit, in\n-- \n1.5.3.4.1223.ga973c\n"},{"id":"56185","messageId":"Pine.LNX.4.64.0710170322400.25221@racer.site","threadId":"10334","inReplyTo":"Pine.LNX.4.64.0710170322000.25221@racer.site","subject":"[PATCH 2/2] filter-branch: update current branch when rewritten","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-17T02:23:10Z","receivedAt":"2007-10-17T02:23:10Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nEarlier, \"git filter-branch --<options> HEAD\" would not update the\nworking tree after rewriting the branch.  This commit fixes it.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tBill, I hope this clarifies some things for you, too...\n\n git-filter-branch.sh     |   15 +++++++++++++++\n t/t7003-filter-branch.sh |    4 +++-\n 2 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex a12f6c2..ffcc408 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -94,6 +94,10 @@ USAGE=\"[--env-filter <command>] [--tree-filter <command>] \\\n \n . git-sh-setup\n \n+git diff-files --quiet &&\n+\tgit diff-index --cached --quiet HEAD ||\n+\tdie \"Cannot rewrite branch(es) with a dirty working directory.\"\n+\n tempdir=.git-rewrite\n filter_env=\n filter_tree=\n@@ -196,6 +200,9 @@ do\n \tesac\n done < \"$tempdir\"/backup-refs\n \n+ORIG_GIT_DIR=\"$GIT_DIR\"\n+ORIG_GIT_WORK_TREE=\"$GIT_WORK_TREE\"\n+ORIG_GIT_INDEX_FILE=\"$GIT_INDEX_FILE\"\n export GIT_DIR GIT_WORK_TREE=.\n \n # These refs should be updated if their heads were rewritten\n@@ -413,4 +420,12 @@ echo\n test $count -gt 0 && echo \"These refs were rewritten:\"\n git show-ref | grep ^\"$orig_namespace\"\n \n+unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE\n+test -z \"$ORIG_GIT_DIR\" || GIT_DIR=\"$ORIG_GIT_DIR\" && export GIT_DIR\n+test -z \"$ORIG_GIT_WORK_TREE\" || GIT_WORK_TREE=\"$ORIG_GIT_WORK_TREE\" &&\n+\texport GIT_WORK_TREE\n+test -z \"$ORIG_GIT_INDEX_FILE\" || GIT_INDEX_FILE=\"$ORIG_GIT_INDEX_FILE\" &&\n+\texport GIT_INDEX_FILE\n+git read-tree -u -m HEAD\n+\n exit $ret\ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex e935b20..2089351 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -41,7 +41,9 @@ test_expect_success 'rewrite, renaming a specific file' '\n '\n \n test_expect_success 'test that the file was renamed' '\n-\ttest d = $(git show HEAD:doh)\n+\ttest d = $(git show HEAD:doh) &&\n+\ttest -f doh &&\n+\ttest d = $(cat doh)\n '\n \n git tag oldD HEAD~4\n-- \n1.5.3.4.1223.ga973c\n"},{"id":"56393","messageId":"18199.21729.535096.397497@lisa.zopyra.com","threadId":"10334","inReplyTo":"Pine.LNX.4.64.0710170322400.25221@racer.site","subject":"Re: [PATCH 2/2] filter-branch: update current branch when rewritten","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-10-18T12:43:13Z","receivedAt":"2007-10-18T12:43:13Z","isPatch":true,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, October 17, 2007 at 03:23:10 (+0100) Johannes Schindelin writes:\n>\n>Earlier, \"git filter-branch --<options> HEAD\" would not update the\n>working tree after rewriting the branch.  This commit fixes it.\n>\n>Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n>---\n>\n>\tBill, I hope this clarifies some things for you, too...\n\nThanks very much.  I hope so, too.  I'll pull this in to my tree\nwhen it gets into the git repository (how do I know when that happens,\nor do I just need to pull and inspect?).\n\n\nBill\n"},{"id":"56447","messageId":"20071019000604.GM14735@spearce.org","threadId":"10334","inReplyTo":"18199.21729.535096.397497@lisa.zopyra.com","subject":"Re: [PATCH 2/2] filter-branch: update current branch when rewritten","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-19T00:06:04Z","receivedAt":"2007-10-19T00:06:04Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Bill Lear <rael@zopyra.com> wrote:\n> On Wednesday, October 17, 2007 at 03:23:10 (+0100) Johannes Schindelin writes:\n> >\n> >Earlier, \"git filter-branch --<options> HEAD\" would not update the\n> >working tree after rewriting the branch.  This commit fixes it.\n> >\n> >Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> >---\n> >\n> >\tBill, I hope this clarifies some things for you, too...\n> \n> Thanks very much.  I hope so, too.  I'll pull this in to my tree\n> when it gets into the git repository (how do I know when that happens,\n> or do I just need to pull and inspect?).\n\nThis is actually already in my maint branch:\n\n  git://repo.or.cz/git/spearce.git\n  http://repo.or.cz/r/git/spearce.git\n\nThe best way to know if a given patch has been applied is to just\nfetch every so often and look.  But you are also subscribed to\nthe mailing list and there's usually a weekly \"What's in git.git\"\nand a \"What's cooking in git.git\" messages sent describing the\nrecent changes.  Monitoring these can also tell you when it may be\na good time for you to pull in a more recent version.\n\nMy last What's in/What's cooking messages were sent out on Monday.\nI've got a lot of stuff from folks since then going into my tree\n(the above is one of them) so I'll probably wrap up this week with\nanother set of messages tomorrow.\n\nOf course the maintainer could send an email for every patch that\nhe/she applies, but the mailing list volume is already quite high.\nJunio (and myself) both prefer to not bother responding to accepted\npatches when they come from regular contributors, as we know the\nregular contributor will be pulling in the near future anyway.\n\n-- \nShawn.\n"}]}