user-manual: don't assume refs are stored under .git/refs
The scripts taken from Tony Luck's howto assume all refs can be found under .git/refs, but this is not necessarily true, especially since git-gc runs git-pack-refs. Also add a note warning of this in the chapter that introduces refs, and fix the same incorrect assumption in one other spot. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
J. Bruce Fields committed
Sep 9, 2007 at 22:07 UTC
fc74ecc12cd339c6d8abd1c363733e67eb50945c
1 file changed
+11
-7
Documentation/user-manual.txt
+11
-7
@@ -369,6 +369,11 @@ shorthand:
369
The full name is occasionally useful if, for example, there ever
370
exists a tag and a branch with the same name.
371
372
+(Newly created refs are actually stored in the .git/refs directory,
373
+under the path given by their name. However, for efficiency reasons
374
+they may also be packed together in a single file; see
375
+gitlink:git-pack-refs[1]).
376
+
377
As another useful shortcut, the "HEAD" of a repository can be referred
378
to just using the name of that repository. So, for example, "origin"
379
is usually a shortcut for the HEAD branch in the repository "origin".
@@ -2189,9 +2194,9 @@ test|release)
2194
git checkout $1 && git pull . origin
2195
;;
2196
origin)
2192
- before=$(cat .git/refs/remotes/origin/master)
2197
+ before=$(git rev-parse refs/remotes/origin/master)
2198
git fetch origin
2194
- after=$(cat .git/refs/remotes/origin/master)
2199
+ after=$(git rev-parse refs/remotes/origin/master)
2200
if [ $before != $after ]
2201
then
2202
git log $before..$after | git shortlog
@@ -2216,11 +2221,10 @@ usage()
2221
exit 1
2222
}
2223
2219
-if [ ! -f .git/refs/heads/"$1" ]
2220
-then
2224
+git show-ref -q --verify -- refs/heads/"$1" || {
2225
echo "Can't see branch <$1>" 1>&2
2226
usage
2223
-fi
2227
+}
2228
2229
case "$2" in
2230
test|release)
@@ -2251,7 +2255,7 @@ then
2255
git log test..release
2256
fi
2257
2254
-for branch in `ls .git/refs/heads`
2258
+for branch in `git show-ref --heads | sed 's|^.*/||'`
2259
do
2260
if [ $branch = test -o $branch = release ]
2261
then
@@ -2946,7 +2950,7 @@ nLE/L9aUXdWeTFPron96DLA=
2950
See the gitlink:git-tag[1] command to learn how to create and verify tag
2951
objects. (Note that gitlink:git-tag[1] can also be used to create
2952
"lightweight tags", which are not tag objects at all, but just simple
2949
-references in .git/refs/tags/).
2953
+references whose names begin with "refs/tags/").
2954
2955
[[pack-files]]
2956
How git stores objects efficiently: pack files