{"thread":{"id":"43322","subject":"Re: [PATCH] git-checkout: allow pathspec to recover lost working tree directory","startedAt":"2006-11-15T19:07:19Z","lastAt":"2006-11-17T15:44:59Z","messageCount":4,"participants":["Junio C Hamano","Petr Baudis","Anand Kumria"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"294954","messageId":"7vbqn8msuw.fsf@assigned-by-dhcp.cox.net","threadId":"43322","inReplyTo":null,"subject":"[PATCH] git-checkout: allow pathspec to recover lost working tree directory","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-15T19:07:19Z","receivedAt":"2006-11-15T19:07:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"It is often wanted on the #git channel that this were to work to\nrecover removed directory:\n\n\trm -fr Documentation\n\tgit checkout -- Documentation\n\tgit checkout HEAD -- Documentation ;# alternatively\n\nNow it does.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n * Back to fixing usability issues one at a time instead of\n   throwing everything away with bathwater.\n\n git-checkout.sh |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex eb28b29..737abd0 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -112,7 +112,11 @@ Did you intend to checkout '$@' which ca\n \t\tgit-ls-tree --full-name -r \"$new\" \"$@\" |\n \t\tgit-update-index --index-info || exit $?\n \tfi\n-\tgit-checkout-index -f -u -- \"$@\"\n+\n+\t# Make sure the request is about existing paths.\n+\tgit-ls-files --error-unmatch -- \"$@\" >/dev/null || exit\n+\tgit-ls-files -- \"$@\" |\n+\tgit-checkout-index -f -u --stdin\n \texit $?\n else\n \t# Make sure we did not fall back on $arg^{tree} codepath\n-- \n1.4.4\n\n"},{"id":"295097","messageId":"ejge6q$bm7$1@sea.gmane.org","threadId":"43322","inReplyTo":"7vbqn8msuw.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-checkout: allow pathspec to recover lost working tree directory","fromName":"Anand Kumria","fromEmail":"wildfire@progsoc.org","sentAt":"2006-11-16T01:17:15Z","receivedAt":"2006-11-16T01:17:15Z","isPatch":true,"sender":{"key":"wildfire@progsoc.org","avatar":null},"body":"On Wed, 15 Nov 2006 11:07:19 -0800, Junio C Hamano wrote:\n\n> It is often wanted on the #git channel that this were to work to\n> recover removed directory:\n> \n> \trm -fr Documentation\n> \tgit checkout -- Documentation\n> \tgit checkout HEAD -- Documentation ;# alternatively\n> \n> Now it does.\n\nOne thing I often seem to do is make some changes, test them out and\nremove the file if it wa a dead end and get my original back with\n'cg-restore <file>'. Does this mean that the git equivalent will be 'git\ncheckout -- <file>' as well?\n\nThanks,\nAnand\n"},{"id":"294358","messageId":"7vlkmcgngc.fsf@assigned-by-dhcp.cox.net","threadId":"43322","inReplyTo":"ejge6q$bm7$1@sea.gmane.org","subject":"Re: [PATCH] git-checkout: allow pathspec to recover lost working tree directory","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-16T02:00:35Z","receivedAt":"2006-11-16T02:00:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Anand Kumria\" <wildfire@progsoc.org> writes:\n\n> On Wed, 15 Nov 2006 11:07:19 -0800, Junio C Hamano wrote:\n>\n>> It is often wanted on the #git channel that this were to work to\n>> recover removed directory:\n>> \n>> \trm -fr Documentation\n>> \tgit checkout -- Documentation\n>> \tgit checkout HEAD -- Documentation ;# alternatively\n>> \n>> Now it does.\n>\n> One thing I often seem to do is make some changes, test them out and\n> remove the file if it wa a dead end and get my original back with\n> 'cg-restore <file>'. Does this mean that the git equivalent will be 'git\n> checkout -- <file>' as well?\n\nNaming individual files has been supported for a long time.\nWhat this patch adds is an ability to name a whole directory to\nrestore to the index state or a named commit state).\n"},{"id":"294872","messageId":"20061117154459.GF7201@pasky.or.cz","threadId":"43322","inReplyTo":"7vbqn8msuw.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-checkout: allow pathspec to recover lost working tree directory","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-17T15:44:59Z","receivedAt":"2006-11-17T15:44:59Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Wed, Nov 15, 2006 at 08:07:19PM CET, Junio C Hamano wrote:\n> diff --git a/git-checkout.sh b/git-checkout.sh\n> index eb28b29..737abd0 100755\n> --- a/git-checkout.sh\n> +++ b/git-checkout.sh\n> @@ -112,7 +112,11 @@ Did you intend to checkout '$@' which ca\n>  \t\tgit-ls-tree --full-name -r \"$new\" \"$@\" |\n>  \t\tgit-update-index --index-info || exit $?\n>  \tfi\n> -\tgit-checkout-index -f -u -- \"$@\"\n> +\n> +\t# Make sure the request is about existing paths.\n> +\tgit-ls-files --error-unmatch -- \"$@\" >/dev/null || exit\n> +\tgit-ls-files -- \"$@\" |\n> +\tgit-checkout-index -f -u --stdin\n>  \texit $?\n>  else\n>  \t# Make sure we did not fall back on $arg^{tree} codepath\n\nWouldn't it be better to fix git-checkout-index to checkout a whole\ndirectory if specified?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n"}]}