366
)
367
)
368
369
- # Write out remotes/$origin file, and update our "$head_points_at".
369
+ # Write out remote.$origin config, and update our "$head_points_at".
370
case "$head_points_at" in
371
?*)
372
- mkdir -p "$GIT_DIR/remotes" &&
372
+ # Local default branch
373
git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
374
+
375
+ # Tracking branch for the primary branch at the remote.
376
case "$use_separate_remote" in
377
t) origin_track="$remote_top/$head_points_at"
378
git-update-ref HEAD "$head_sha1" ;;
379
*) origin_track="$remote_top/$origin"
380
git-update-ref "refs/heads/$origin" "$head_sha1" ;;
381
esac &&
382
+
383
+ # Upstream URL and the primary branch tracking
384
git-repo-config remote."$origin".url "$repo" &&
385
git-repo-config remote."$origin".fetch \
386
"refs/heads/$head_points_at:$origin_track" &&
383
- (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
384
- while read dotslref
385
- do
386
- name=`expr "$dotslref" : './\(.*\)'`
387
- if test "z$head_points_at" = "z$name"
388
- then
389
- continue
390
- fi
391
- if test "$use_separate_remote" = '' &&
392
- test "z$origin" = "z$name"
393
- then
394
- continue
395
- fi
396
- git-repo-config remote."$origin".fetch "refs/heads/${name}:$remote_top/${name}" '^$'
397
- done &&
387
+
388
+ # Set up the mappings to track the remaining branches.
389
+ case "$use_separate_remote" in
390
+ t)
391
+ git-repo-config remote."$origin".fetch \
392
+ "refs/heads/*:$remote_top/*" '^$'
393
+ ;;
394
+ *)
395
+ (cd "$GIT_DIR/$remote_top" && find . -type f -print) |
396
+ while read dotslref
397
+ do
398
+ name=`expr "$dotslref" : './\(.*\)'`
399
+ if test "z$head_points_at" = "z$name" ||
400
+ test "z$origin" = "z$name"
401
+ then
402
+ continue
403
+ fi
404
+ git-repo-config remote."$origin".fetch \
405
+ "refs/heads/${name}:$remote_top/${name}" '^$'
406
+ done
407
+ ;;
408
+ esac &&
409
+
410
case "$use_separate_remote" in
411
t)
412
rm -f "refs/remotes/$origin/HEAD"
413
git-symbolic-ref "refs/remotes/$origin/HEAD" \
414
"refs/remotes/$origin/$head_points_at"
415
esac &&
416
+
417
git-repo-config branch."$head_points_at".remote "$origin" &&
418
git-repo-config branch."$head_points_at".merge "refs/heads/$head_points_at"
419
esac