{"thread":{"id":"17590","subject":"[PATCH] filter-branch: do not consider diverging submodules a 'dirty worktree'","startedAt":"2009-02-05T17:37:59Z","lastAt":"2009-02-05T18:19:33Z","messageCount":3,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"103358","messageId":"26931410834b5297493543e2a1cb75c3b6bf008a.1233855372u.git.johannes.schindelin@gmx.de","threadId":"17590","inReplyTo":"cover.1233855372u.git.johannes.schindelin@gmx.de","subject":"[PATCH] filter-branch: do not consider diverging submodules a 'dirty worktree'","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-05T17:37:59Z","receivedAt":"2009-02-05T17:37:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"At the end of filter-branch in a non-bare repository, the work tree is\nupdated with \"read-tree -m -u HEAD\", to carry the change forward in case\nthe current branch was rewritten.  In order to avoid losing any local\nchange during this step, filter-branch refuses to work when there are\nlocal changes in the work tree.\n\nThis \"read-tree -m -u HEAD\" operation does not affect what commit is\nchecked out in a submodule (iow, it does not touch .git/HEAD in a\nsubmodule checkout), and checking if there is any local change to the\nsubmodule is not useful.\n\nStaged submodules _are_ considered to be 'dirty', however,  as the\n\"read-tree -m -u HEAD\" could result in loss of staged information\notherwise.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-filter-branch.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex b75d0ba..9ffa655 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -108,8 +108,8 @@ OPTIONS_SPEC=\n . git-sh-setup\n \n if [ \"$(is_bare_repository)\" = false ]; then\n-\tgit diff-files --quiet &&\n-\tgit diff-index --cached --quiet HEAD -- ||\n+\tgit diff-files --ignore-submodules --quiet &&\n+\tgit diff-index --ignore-submodules --cached --quiet HEAD -- ||\n \tdie \"Cannot rewrite branch(es) with a dirty working directory.\"\n fi\n \n-- \n1.6.1.1.598.g140d5\n"},{"id":"103361","messageId":"7vskmseq4t.fsf@gitster.siamese.dyndns.org","threadId":"17590","inReplyTo":"26931410834b5297493543e2a1cb75c3b6bf008a.1233855372u.git.johannes.schindelin@gmx.de","subject":"Re: [PATCH] filter-branch: do not consider diverging submodules a 'dirty worktree'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-05T17:43:14Z","receivedAt":"2009-02-05T17:43:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <johannes.schindelin@gmx.de> writes:\n\n> At the end of filter-branch in a non-bare repository, the work tree is\n> updated with \"read-tree -m -u HEAD\", to carry the change forward in case\n> the current branch was rewritten.  In order to avoid losing any local\n> change during this step, filter-branch refuses to work when there are\n> local changes in the work tree.\n>\n> This \"read-tree -m -u HEAD\" operation does not affect what commit is\n> checked out in a submodule (iow, it does not touch .git/HEAD in a\n> submodule checkout), and checking if there is any local change to the\n> submodule is not useful.\n>\n> Staged submodules _are_ considered to be 'dirty', however,  as the\n> \"read-tree -m -u HEAD\" could result in loss of staged information\n> otherwise.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThanks.  I still have one question.\n\nBy the last paragraph, do you mean \"diff-index --cached\" should be run\nwithout --ignore-submodules?  That does not seem to match the text of the\npatch.\n\n> ---\n>  git-filter-branch.sh |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-filter-branch.sh b/git-filter-branch.sh\n> index b75d0ba..9ffa655 100755\n> --- a/git-filter-branch.sh\n> +++ b/git-filter-branch.sh\n> @@ -108,8 +108,8 @@ OPTIONS_SPEC=\n>  . git-sh-setup\n>  \n>  if [ \"$(is_bare_repository)\" = false ]; then\n> -\tgit diff-files --quiet &&\n> -\tgit diff-index --cached --quiet HEAD -- ||\n> +\tgit diff-files --ignore-submodules --quiet &&\n> +\tgit diff-index --ignore-submodules --cached --quiet HEAD -- ||\n>  \tdie \"Cannot rewrite branch(es) with a dirty working directory.\"\n>  fi\n>  \n> -- \n> 1.6.1.1.598.g140d5\n"},{"id":"103365","messageId":"66fcb5966bce35110c880b417e160a6442256593.1233857872u.git.johannes.schindelin@gmx.de","threadId":"17590","inReplyTo":"cover.1233857872u.git.johannes.schindelin@gmx.de","subject":"[PATCH v3] filter-branch: do not consider diverging submodules a 'dirty worktree'","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-05T18:19:33Z","receivedAt":"2009-02-05T18:19:33Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"At the end of filter-branch in a non-bare repository, the work tree is\nupdated with \"read-tree -m -u HEAD\", to carry the change forward in case\nthe current branch was rewritten.  In order to avoid losing any local\nchange during this step, filter-branch refuses to work when there are\nlocal changes in the work tree.\n\nThis \"read-tree -m -u HEAD\" operation does not affect what commit is\nchecked out in a submodule (iow, it does not touch .git/HEAD in a\nsubmodule checkout), and checking if there is any local change to the\nsubmodule is not useful.\n\nStaged submodules _are_ considered to be 'dirty', however,  as the\n\"read-tree -m -u HEAD\" could result in loss of staged information\notherwise.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOf course I forgot the file name when I --amended the commit \n\tmessage, so I forgot that change...\n\n git-filter-branch.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex b75d0ba..86eef56 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -108,7 +108,7 @@ OPTIONS_SPEC=\n . git-sh-setup\n \n if [ \"$(is_bare_repository)\" = false ]; then\n-\tgit diff-files --quiet &&\n+\tgit diff-files --ignore-submodules --quiet &&\n \tgit diff-index --cached --quiet HEAD -- ||\n \tdie \"Cannot rewrite branch(es) with a dirty working directory.\"\n fi\n-- \n1.6.1.1.598.g140d5\n"}]}