{"thread":{"id":"43751","subject":"[PATCH 2/3] git-fetch: fix dumb protocol transport to fetch from pack-pruned ref","startedAt":"2006-11-23T07:24:05Z","lastAt":"2006-11-23T07:24:05Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"297871","messageId":"7v64d6lj6y.fsf@assigned-by-dhcp.cox.net","threadId":"43751","inReplyTo":null,"subject":"[PATCH 2/3] git-fetch: fix dumb protocol transport to fetch from pack-pruned ref","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-23T07:24:05Z","receivedAt":"2006-11-23T07:24:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Earlier, commit walkers downloaded loose refs from refs/ hierarchy\nof the remote side to find where to start walking; this would\nnot work for a repository whose refs are packed and then pruned.\n\nWith the previous change, we have ls-remote output from the\nremote in-core; we can use the value from there without\nrequiring loose refs anymore.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n git-fetch.sh |   28 +++++++++++++---------------\n 1 files changed, 13 insertions(+), 15 deletions(-)\n\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 170c2cb..06b66b9 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -307,22 +307,20 @@ fetch_main () {\n \t\t\"`git-repo-config --bool http.noEPSV`\" = true ]; then\n \t      noepsv_opt=\"--disable-epsv\"\n \t  fi\n-\t  max_depth=5\n-\t  depth=0\n-\t  head=\"ref: $remote_name\"\n-\t  while (expr \"z$head\" : \"zref:\" && expr $depth \\< $max_depth) >/dev/null\n-\t  do\n-\t    remote_name_quoted=$(@@PERL@@ -e '\n-\t      my $u = $ARGV[0];\n-              $u =~ s/^ref:\\s*//;\n-\t      $u =~ s{([^-a-zA-Z0-9/.])}{sprintf\"%%%02x\",ord($1)}eg;\n-\t      print \"$u\";\n-\t  ' \"$head\")\n-\t    head=$(curl -nsfL $curl_extra_args $noepsv_opt \"$remote/$remote_name_quoted\")\n-\t    depth=$( expr \\( $depth + 1 \\) )\n-\t  done\n+\n+\t  # Find $remote_name from ls-remote output.\n+\t  head=$(\n+\t\tIFS='\t'\n+\t\techo \"$ls_remote_result\" |\n+\t\twhile read sha1 name\n+\t\tdo\n+\t\t\ttest \"z$name\" = \"z$remote_name\" || continue\n+\t\t\techo \"$sha1\"\n+\t\t\tbreak\n+\t\tdone\n+\t  )\n \t  expr \"z$head\" : \"z$_x40\\$\" >/dev/null ||\n-\t      die \"Failed to fetch $remote_name from $remote\"\n+\t\tdie \"No such ref $remote_name at $remote\"\n \t  echo >&2 \"Fetching $remote_name from $remote using $proto\"\n \t  git-http-fetch -v -a \"$head\" \"$remote/\" || exit\n \t  ;;\n-- \n1.4.4.1.g77614\n\n"}]}