Skip to content

Commit 972b6fe

Browse files
author
Junio C Hamano
committed
ls-remote: drop storing operation and add documentation.
The store operation was never useful because we needed to fetch the objects needed to complete the reference. Remove it. The fetch command fetch multiple references shortly to replace the lost "store" functionality in more a generic way. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4282c4f commit 972b6fe

File tree

2 files changed

+87
-27
lines changed

2 files changed

+87
-27
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
git-ls-remote-script(1)
2+
=======================
3+
v0.1, May 2005
4+
5+
NAME
6+
----
7+
git-ls-remote-script - Look at references other repository has.
8+
9+
10+
SYNOPSIS
11+
--------
12+
'git-ls-remote' [--heads] [--tags] <repository> <refs>...
13+
14+
DESCRIPTION
15+
-----------
16+
Displays the references other repository has.
17+
18+
19+
OPTIONS
20+
-------
21+
--heads --tags::
22+
Limit to only refs/heads and refs/tags, respectively.
23+
These options are _not_ mutually exclusive; when given
24+
both, references stored in refs/heads and refs/tags are
25+
displayed.
26+
27+
<repository>::
28+
Location of the repository. The shorthand defined in
29+
$GIT_DIR/branches/ can be used.
30+
31+
<refs>...::
32+
When unspecified, all references, after filtering done
33+
with --heads and --tags, are shown. When <refs>... are
34+
specified, only references matching the given patterns
35+
are displayed.
36+
37+
EXAMPLES
38+
--------
39+
40+
$ git ls-remote --tags ./.
41+
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
42+
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
43+
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
44+
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
45+
0918385dbd9656cab0d1d81ba7453d49bbc16250 refs/tags/junio-gpg-pub
46+
$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master pu rc
47+
5fe978a5381f1fbad26a80e682ddd2a401966740 refs/heads/master
48+
c781a84b5204fb294c9ccc79f8b3baceeb32c061 refs/heads/pu
49+
b1d096f2926c4e37c9c0b6a7bf2119bedaa277cb refs/heads/rc
50+
$ echo http://www.kernel.org/pub/scm/git/git.git >.git/branches/public
51+
$ git ls-remote --tags public v\*
52+
d6602ec5194c87b0fc87103ca4d67251c76f233a refs/tags/v0.99
53+
f25a265a342aed6041ab0cc484224d9ca54b6f41 refs/tags/v0.99.1
54+
c5db5456ae3b0873fc659c19fafdde22313cc441 refs/tags/v0.99.2
55+
7ceca275d047c90c0c7d5afb13ab97efdf51bd6e refs/tags/v0.99.3
56+
57+
Author
58+
------
59+
Written by Junio C Hamano <[email protected]>
60+
61+
GIT
62+
---
63+
Part of the link:git.html[git] suite
64+

git-ls-remote-script

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
. git-sh-setup-script || die "Not a git archive"
44

55
usage () {
6-
echo >&2 "usage: $0 [--heads] [--tags] [--overwrite | --store] repo"
6+
echo >&2 "usage: $0 [--heads] [--tags] <repository> <refs>..."
77
exit 1;
88
}
99

@@ -12,10 +12,6 @@ do
1212
case "$1" in
1313
-h|--h|--he|--hea|--head|--heads)
1414
heads=heads; shift ;;
15-
-o|--o|--ov|--ove|--over|--overw|--overwr|--overwri|--overwrit|--overwrite)
16-
overwrite=overwrite; shift ;;
17-
-s|--s|--st|--sto|--stor|--store)
18-
store=store; shift ;;
1915
-t|--t|--ta|--tag|--tags)
2016
tags=tags; shift ;;
2117
--)
@@ -27,15 +23,15 @@ do
2723
esac
2824
done
2925

30-
case "$#" in 1) ;; *) usage ;; esac
31-
case ",$store,$overwrite," in *,,*) ;; *) usage ;; esac
26+
case "$#" in 0) usage ;; esac
3227

3328
case ",$heads,$tags," in
3429
,,,) heads=heads tags=tags other=other ;;
3530
esac
3631

37-
. git-parse-remote "$@"
32+
. git-parse-remote "$1"
3833
peek_repo="$_remote_repo"
34+
shift
3935

4036
tmp=.ls-remote-$$
4137
trap "rm -fr $tmp-*" 0 1 2 3 15
@@ -65,7 +61,7 @@ rsync://* )
6561
git-peek-remote "$peek_repo"
6662
;;
6763
esac |
68-
64+
sort -t ' ' -k 2 |
6965
while read sha1 path
7066
do
7167
case "$path" in
@@ -82,23 +78,23 @@ do
8278
*)
8379
continue;;
8480
esac
85-
86-
echo "$sha1 $path"
87-
88-
case "$path,$store,$overwrite," in
89-
*,,, | HEAD,*) continue ;;
81+
case "$#" in
82+
0)
83+
match=yes ;;
84+
*)
85+
match=no
86+
for pat
87+
do
88+
case "/$path" in
89+
*/$pat )
90+
match=yes
91+
break ;;
92+
esac
93+
done
9094
esac
91-
92-
if test -f "$GIT_DIR/$path" && test "$overwrite" == ""
93-
then
94-
continue
95-
fi
96-
97-
# Be careful. We may not have that object yet!
98-
if git-cat-file -t "$sha1" >/dev/null 2>&1
99-
then
100-
echo "$sha1" >"$GIT_DIR/$path"
101-
else
102-
echo >&2 "* You have not fetched updated $path ($sha1)."
103-
fi
95+
case "$match" in
96+
no)
97+
continue ;;
98+
esac
99+
echo "$sha1 $path"
104100
done

0 commit comments

Comments
 (0)