{"thread":{"id":"1312","subject":"[PATCH] git-clone-script: store where we cloned from in .git/branches/origin","startedAt":"2005-07-23T02:11:22Z","lastAt":"2005-07-23T02:11:22Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6364","messageId":"7v64v26zlh.fsf@assigned-by-dhcp.cox.net","threadId":"1312","inReplyTo":null,"subject":"[PATCH] git-clone-script: store where we cloned from in .git/branches/origin","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-23T02:11:22Z","receivedAt":"2005-07-23T02:11:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"A bit more usability enhancement, while retaining Cogito\ncompatibility.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n*** Just after sending I noticed that the first hunk is a pure\n*** bugfix.  Hope you do not mind...\n\n git-clone-script |   41 +++++++++++++++++++++++------------------\n 1 files changed, 23 insertions(+), 18 deletions(-)\n\n170214e3ccecc995e4f5c2567f9542a8de8cfc65\ndiff --git a/git-clone-script b/git-clone-script\n--- a/git-clone-script\n+++ b/git-clone-script\n@@ -20,12 +20,12 @@ upload_pack=\n while\n \tcase \"$#,$1\" in\n \t0,*) break ;;\n-        *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;\n+\t*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;\n \t*,-q|*,--quiet) quiet=-q ;;\n-\t1,-u|*,--upload-pack) usage ;;\n+\t1,-u|1,--upload-pack) usage ;;\n \t*,-u|*,--upload-pack)\n \t\tshift\n-\t\tupload_pack=\"--exec=$2\" ;;\n+\t\tupload_pack=\"--exec=$1\" ;;\n \t*,-*) usage ;;\n \t*) break ;;\n \tesac\n@@ -81,23 +81,28 @@ yes,yes)\n \t\tHEAD=HEAD\n \tfi\n \ttar Ccf \"$repo\" - refs $HEAD | tar Cxf \"$D/.git\" - || exit 1\n-\texit 0\n-\t;;\n-esac\n-\n-case \"$repo\" in\n-rsync://*)\n-\trsync $quiet -avz --ignore-existing \"$repo/objects/\" \"$D/.git/objects/\" &&\n-\trsync $quiet -avz --ignore-existing \"$repo/refs/\" \"$D/.git/refs/\"\n-\t;;\n-http://*)\n-\techo \"Somebody should add http fetch\" >&2\n-\texit 1\n \t;;\n *)\n-\tcd \"$D\" && case \"$upload_pack\" in\n-\t'') git-clone-pack $quiet \"$repo\" ;;\n-\t*) git-clone-pack $quiet \"$upload_pack\" \"$repo\" ;;\n+\tcase \"$repo\" in\n+\trsync://*)\n+\t\trsync $quiet -avz --ignore-existing \"$repo/objects/\" \"$D/.git/objects/\" &&\n+\t\trsync $quiet -avz --ignore-existing \"$repo/refs/\" \"$D/.git/refs/\"\n+\t\t;;\n+\thttp://*)\n+\t\techo \"Somebody should add http fetch\" >&2\n+\t\texit 1\n+\t\t;;\n+\t*)\n+\t\tcd \"$D\" && case \"$upload_pack\" in\n+\t\t'') git-clone-pack $quiet \"$repo\" ;;\n+\t\t*) git-clone-pack $quiet \"$upload_pack\" \"$repo\" ;;\n+\t\tesac\n+\t\t;;\n \tesac\n \t;;\n esac\n+\n+# Update origin.\n+mkdir -p \"$D/.git/branches/\" &&\n+rm -f \"$D/.git/branches/origin\" &&\n+echo \"$repo\" >\"$D/.git/branches/origin\"\n"}]}