Skip to content

Commit 1bdbb57

Browse files
author
Junio C Hamano
committed
Merge branch 'jc/clone' into next
* jc/clone: git-clone: fix handling of upsteram whose HEAD does not point at master. fix repacking with lots of tags Documentation: revise top of git man page
2 parents f0c979f + c72112e commit 1bdbb57

File tree

3 files changed

+70
-70
lines changed

3 files changed

+70
-70
lines changed

Documentation/git.txt

Lines changed: 41 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ SYNOPSIS
1212

1313
DESCRIPTION
1414
-----------
15-
'git' is both a program and a directory content tracker system.
16-
The program 'git' is just a wrapper to reach the core git programs
17-
(or a potty if you like, as it's not exactly porcelain but still
18-
brings your stuff to the plumbing).
15+
Git is a fast, scalable, distributed revision control system with an
16+
unusually rich command set that provides both high-level operations
17+
and full access to internals.
18+
19+
See this link:tutorial.html[tutorial] to get started, then see
20+
link:everyday.html[Everyday Git] for a useful minimum set of commands, and
21+
"man git-commandname" for documentation of each command. CVS users may
22+
also want to read link:cvs-migration.html[CVS migration].
1923

2024
OPTIONS
2125
-------
@@ -35,55 +39,38 @@ OPTIONS
3539
the current setting and then exit.
3640

3741

38-
NOT LEARNING CORE GIT COMMANDS
39-
------------------------------
40-
41-
This manual is intended to give complete background information
42-
and internal workings of git, which may be too much for most
43-
people. The <<Discussion>> section below contains much useful
44-
definition and clarification - read that first.
45-
46-
If you are interested in using git to manage (version control)
47-
projects, use link:tutorial.html[The Tutorial] to get you started,
48-
and then link:everyday.html[Everyday GIT] as a guide to the
49-
minimum set of commands you need to know for day-to-day work.
50-
Most likely, that will get you started, and you can go a long
51-
way without knowing the low level details too much.
52-
53-
The link:core-tutorial.html[Core tutorial] document covers how things
54-
internally work.
55-
56-
If you are migrating from CVS, link:cvs-migration.html[cvs
57-
migration] document may be helpful after you finish the
58-
tutorial.
42+
FURTHER DOCUMENTATION
43+
---------------------
5944

60-
After you get the general feel from the tutorial and this
61-
overview page, you may want to take a look at the
62-
link:howto-index.html[howto] documents.
45+
See the references above to get started using git. The following is
46+
probably more detail than necessary for a first-time user.
6347

48+
The <<Discussion,Discussion>> section below and the
49+
link:core-tutorial.html[Core tutorial] both provide introductions to the
50+
underlying git architecture.
6451

65-
CORE GIT COMMANDS
66-
-----------------
52+
See also the link:howto-index.html[howto] documents for some useful
53+
examples.
6754

68-
If you are writing your own Porcelain, you need to be familiar
69-
with most of the low level commands --- I suggest starting from
70-
gitlink:git-update-index[1] and gitlink:git-read-tree[1].
55+
GIT COMMANDS
56+
------------
7157

58+
We divide git into high level ("porcelain") commands and low level
59+
("plumbing") commands.
7260

73-
Commands Overview
74-
-----------------
75-
The git commands can helpfully be split into those that manipulate
76-
the repository, the index and the files in the working tree, those that
77-
interrogate and compare them, and those that moves objects and
78-
references between repositories.
61+
Low-level commands (plumbing)
62+
-----------------------------
7963

80-
In addition, git itself comes with a spartan set of porcelain
81-
commands. They are usable but are not meant to compete with real
82-
Porcelains.
64+
Although git includes its
65+
own porcelain layer, its low-level commands are sufficient to support
66+
development of alternative porcelains. Developers of such porcelains
67+
might start by reading about gitlink:git-update-index[1] and
68+
gitlink:git-read-tree[1].
8369

84-
There are also some ancillary programs that can be viewed as useful
85-
aids for using the core commands but which are unlikely to be used by
86-
SCMs layered over git.
70+
We divide the low-level commands into commands that manipulate objects (in
71+
the repository, index, and working tree), commands that interrogate and
72+
compare objects, and commands that move objects and references between
73+
repositories.
8774

8875
Manipulation commands
8976
~~~~~~~~~~~~~~~~~~~~~
@@ -248,8 +235,14 @@ gitlink:git-upload-pack[1]::
248235
what are asked for.
249236

250237

251-
Porcelain-ish Commands
252-
----------------------
238+
High-level commands (porcelain)
239+
-------------------------------
240+
241+
We separate the porcelain commands into the main commands and some
242+
ancillary user utilities.
243+
244+
Main porcelain commands
245+
~~~~~~~~~~~~~~~~~~~~~~~
253246

254247
gitlink:git-add[1]::
255248
Add paths to the index.
@@ -346,7 +339,7 @@ gitlink:git-whatchanged[1]::
346339

347340

348341
Ancillary Commands
349-
------------------
342+
~~~~~~~~~~~~~~~~~~
350343
Manipulators:
351344

352345
gitlink:git-applypatch[1]::

git-clone.sh

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ Perhaps git-update-server-info needs to be run there?"
5252
git-http-fetch -v -a -w "$tname" "$name" "$1/" || exit 1
5353
done <"$clone_tmp/refs"
5454
rm -fr "$clone_tmp"
55-
http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD"
55+
http_fetch "$1/HEAD" "$GIT_DIR/REMOTE_HEAD" ||
56+
rm -f "$GIT_DIR/REMOTE_HEAD"
5657
}
5758

5859
# Read git-fetch-pack -k output and store the remote branches.
@@ -324,30 +325,33 @@ test -d "$GIT_DIR/refs/reference-tmp" && rm -fr "$GIT_DIR/refs/reference-tmp"
324325

325326
if test -f "$GIT_DIR/CLONE_HEAD"
326327
then
327-
# Figure out where the remote HEAD points at.
328+
# Read git-fetch-pack -k output and store the remote branches.
328329
perl -e "$copy_refs" "$GIT_DIR" "$use_separate_remote" "$origin"
329330
fi
330331

331332
cd "$D" || exit
332333

333334
if test -z "$bare" && test -f "$GIT_DIR/REMOTE_HEAD"
334335
then
335-
head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
336336
# Figure out which remote branch HEAD points at.
337337
case "$use_separate_remote" in
338338
'') remote_top=refs/heads ;;
339339
*) remote_top="refs/remotes/$origin" ;;
340340
esac
341341

342-
# What to use to track the remote primary branch
343-
if test -n "$use_separate_remote"
344-
then
345-
origin_tracking="remotes/$origin/master"
346-
else
347-
origin_tracking="heads/$origin"
348-
fi
342+
head_sha1=`cat "$GIT_DIR/REMOTE_HEAD"`
343+
case "$head_sha1" in
344+
'ref: refs/'*)
345+
# Uh-oh, the remote told us (http transport done against
346+
# new style repository with a symref HEAD).
347+
# Ideally we should skip the guesswork but for now
348+
# opt for minimum change.
349+
head_sha1=`expr "$head_sha1" : 'ref: refs/heads/\(.*\)'`
350+
head_sha1=`cat "$GIT_DIR/$remote_top/$head_sha1"`
351+
;;
352+
esac
349353

350-
# The name under $remote_top the remote HEAD seems to point at
354+
# The name under $remote_top the remote HEAD seems to point at.
351355
head_points_at=$(
352356
(
353357
echo "master"
@@ -368,23 +372,28 @@ then
368372
)
369373
)
370374

371-
# Write out remotes/$origin file.
375+
# Write out remotes/$origin file, and update our "$head_points_at".
372376
case "$head_points_at" in
373377
?*)
374378
mkdir -p "$GIT_DIR/remotes" &&
375-
echo >"$GIT_DIR/remotes/$origin" \
376-
"URL: $repo
377-
Pull: refs/heads/$head_points_at:refs/$origin_tracking" &&
379+
git-symbolic-ref HEAD "refs/heads/$head_points_at" &&
378380
case "$use_separate_remote" in
379-
t) git-update-ref HEAD "$head_sha1" ;;
380-
*) git-update-ref "refs/heads/$origin" $(git-rev-parse HEAD) ;;
381+
t) origin_track="$remote_top/$head_points_at"
382+
git-update-ref HEAD "$head_sha1" ;;
383+
*) origin_track="$remote_top/$origin"
384+
git-update-ref "refs/heads/$origin" "$head_sha1" ;;
381385
esac &&
386+
echo >"$GIT_DIR/remotes/$origin" \
387+
"URL: $repo
388+
Pull: refs/heads/$head_points_at:$origin_track" &&
382389
(cd "$GIT_DIR/$remote_top" && find . -type f -print) |
383390
while read dotslref
384391
do
385392
name=`expr "$dotslref" : './\(.*\)'` &&
386-
test "$head_points_at" = "$name" ||
387-
test "$origin" = "$name" ||
393+
test "$use_separate_remote" = '' && {
394+
test "$head_points_at" = "$name" ||
395+
test "$origin" = "$name"
396+
} ||
388397
echo "Pull: refs/heads/${name}:$remote_top/${name}"
389398
done >>"$GIT_DIR/remotes/$origin" &&
390399
case "$use_separate_remote" in

git-repack.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
2929
case ",$all_into_one," in
3030
,,)
3131
rev_list='--unpacked'
32-
rev_parse='--all'
3332
pack_objects='--incremental'
3433
;;
3534
,t,)
3635
rev_list=
37-
rev_parse='--all'
3836
pack_objects=
3937

4038
# Redundancy check in all-into-one case is trivial.
@@ -43,7 +41,7 @@ case ",$all_into_one," in
4341
;;
4442
esac
4543
pack_objects="$pack_objects $local $quiet $no_reuse_delta"
46-
name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) 2>&1 |
44+
name=$(git-rev-list --objects --all $rev_list 2>&1 |
4745
git-pack-objects --non-empty $pack_objects .tmp-pack) ||
4846
exit 1
4947
if [ -z "$name" ]; then

0 commit comments

Comments
 (0)