{"thread":{"id":"6231","subject":"[PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>","startedAt":"2007-01-05T09:46:02Z","lastAt":"2007-01-05T16:17:49Z","messageCount":4,"participants":["Junio C Hamano","Johannes Schindelin","Juergen Ruehle"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"30869","messageId":"7vmz4xiz6t.fsf@assigned-by-dhcp.cox.net","threadId":"6231","inReplyTo":null,"subject":"[PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-05T09:46:02Z","receivedAt":"2007-01-05T09:46:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When <path> exists in the index (either merged or unmerged), and\n<tree> does not have it, git-reset should be usable to restore\nthe absense of it from the tree.  This implements it.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n \n * By the way, I noticed that \"git log --diff-filter=A --\n   t/t5401-update-hooks.sh\" does not find the commit that\n   introduced the path.  v1.4.1.1 seems to work but v1.4.2.4\n   does not.  I haven't bisected it yet...\n\n git-reset.sh |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-reset.sh b/git-reset.sh\nindex a969370..76c8a81 100755\n--- a/git-reset.sh\n+++ b/git-reset.sh\n@@ -44,8 +44,10 @@ if test $# != 0\n then\n \ttest \"$reset_type\" == \"--mixed\" ||\n \t\tdie \"Cannot do partial $reset_type reset.\"\n-\tgit ls-tree -r --full-name $rev -- \"$@\" |\n-\tgit update-index --add --index-info || exit\n+\n+\tgit-diff-index --cached $rev -- \"$@\" |\n+\tsed -e 's/^:\\([0-7][0-7]*\\) [0-7][0-7]* \\([0-9a-f][0-9a-f]*\\) [0-9a-f][0-9a-f]* [A-Z]\t\\(.*\\)$/\\1 \\2\t\\3/' |\n+\tgit update-index --add --remove --index-info || exit\n \tgit update-index --refresh\n \texit\n fi\n-- \n1.5.0.rc0.ge0f6\n"},{"id":"30871","messageId":"Pine.LNX.4.63.0701051128120.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6231","inReplyTo":"7vmz4xiz6t.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-01-05T10:29:24Z","receivedAt":"2007-01-05T10:29:24Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 5 Jan 2007, Junio C Hamano wrote:\n\n>  * By the way, I noticed that \"git log --diff-filter=A --\n>    t/t5401-update-hooks.sh\" does not find the commit that\n>    introduced the path.  v1.4.1.1 seems to work but v1.4.2.4\n>    does not.  I haven't bisected it yet...\n\nIt is this commit:\n\n1798562: \"log --raw: Don't descend into subdirectories by default\"\n\nAnd sure enough,\n\n$ git log next -r --diff-filter=A -- t/t5401-update-hooks.sh\n\nworks.\n\nCiao,\nDscho\n"},{"id":"30876","messageId":"7v3b6phgrj.fsf@assigned-by-dhcp.cox.net","threadId":"6231","inReplyTo":"Pine.LNX.4.63.0701051128120.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-05T11:09:20Z","receivedAt":"2007-01-05T11:09:20Z","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> Hi,\n>\n> On Fri, 5 Jan 2007, Junio C Hamano wrote:\n>\n>>  * By the way, I noticed that \"git log --diff-filter=A --\n>>    t/t5401-update-hooks.sh\" does not find the commit that\n>>    introduced the path.  v1.4.1.1 seems to work but v1.4.2.4\n>>    does not.  I haven't bisected it yet...\n>\n> It is this commit:\n>\n> 1798562: \"log --raw: Don't descend into subdirectories by default\"\n>\n> And sure enough,\n>\n> $ git log next -r --diff-filter=A -- t/t5401-update-hooks.sh\n>\n> works.\n\nSoon after I accepted the patch, I had this exact reaction and\nthen after some digging I realized the workaround you showed\nabove.  And I forgot all of them X-<.  Silly me.\n"},{"id":"30887","messageId":"17822.31277.52000.636821@lapjr.intranet.kiel.bmiag.de","threadId":"6231","inReplyTo":"7vmz4xiz6t.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>","fromName":"Juergen Ruehle","fromEmail":"j.ruehle@bmiag.de","sentAt":"2007-01-05T16:17:49Z","receivedAt":"2007-01-05T16:17:49Z","isPatch":true,"sender":{"key":"j.ruehle@bmiag.de","avatar":null},"body":"Junio C Hamano writes:\n > When <path> exists in the index (either merged or unmerged), and\n > <tree> does not have it, git-reset should be usable to restore\n > the absense of it from the tree.  This implements it.\n\nGreat! It took some time, but I think I understand now why the first\npart was even necessary:-)\n\n > diff --git a/git-reset.sh b/git-reset.sh\n > index a969370..76c8a81 100755\n > --- a/git-reset.sh\n > +++ b/git-reset.sh\n > @@ -44,8 +44,10 @@ if test $# != 0\n >  then\n >  \ttest \"$reset_type\" == \"--mixed\" ||\n >  \t\tdie \"Cannot do partial $reset_type reset.\"\n > -\tgit ls-tree -r --full-name $rev -- \"$@\" |\n > -\tgit update-index --add --index-info || exit\n > +\n > +\tgit-diff-index --cached $rev -- \"$@\" |\n > +\tsed -e 's/^:\\([0-7][0-7]*\\) [0-7][0-7]* \\([0-9a-f][0-9a-f]*\\) [0-9a-f][0-9a-f]* [A-Z]\t\\(.*\\)$/\\1 \\2\t\\3/' |\n > +\tgit update-index --add --remove --index-info || exit\n\nAll other scripts calling update-index --index-info don't mention\nadd/remove (which are ignored anyway). Might be useful as a reminder\nthough.\n\n >  \tgit update-index --refresh\n >  \texit\n >  fi\n"}]}