Skip to content

Commit d8972a5

Browse files
committed
Merge branch 'ps/show-ref'
Teach "git show-ref" a mode to check the existence of a ref. * ps/show-ref: t: use git-show-ref(1) to check for ref existence builtin/show-ref: add new mode to check for reference existence builtin/show-ref: explicitly spell out different modes in synopsis builtin/show-ref: ensure mutual exclusiveness of subcommands builtin/show-ref: refactor options for patterns subcommand builtin/show-ref: stop using global vars for `show_one()` builtin/show-ref: stop using global variable to count matches builtin/show-ref: refactor `--exclude-existing` options builtin/show-ref: fix dead code when passing patterns builtin/show-ref: fix leaking string buffer builtin/show-ref: split up different subcommands builtin/show-ref: convert pattern to a local variable
2 parents 42b87f7 + 0497e6c commit d8972a5

File tree

8 files changed

+373
-122
lines changed

8 files changed

+373
-122
lines changed

Documentation/git-show-ref.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ git-show-ref - List references in a local repository
88
SYNOPSIS
99
--------
1010
[verse]
11-
'git show-ref' [-q | --quiet] [--verify] [--head] [-d | --dereference]
11+
'git show-ref' [--head] [-d | --dereference]
1212
[-s | --hash[=<n>]] [--abbrev[=<n>]] [--tags]
1313
[--heads] [--] [<pattern>...]
14+
'git show-ref' --verify [-q | --quiet] [-d | --dereference]
15+
[-s | --hash[=<n>]] [--abbrev[=<n>]]
16+
[--] [<ref>...]
1417
'git show-ref' --exclude-existing[=<pattern>]
18+
'git show-ref' --exists <ref>
1519

1620
DESCRIPTION
1721
-----------
@@ -27,6 +31,10 @@ The `--exclude-existing` form is a filter that does the inverse. It reads
2731
refs from stdin, one ref per line, and shows those that don't exist in
2832
the local repository.
2933

34+
The `--exists` form can be used to check for the existence of a single
35+
references. This form does not verify whether the reference resolves to an
36+
actual object.
37+
3038
Use of this utility is encouraged in favor of directly accessing files under
3139
the `.git` directory.
3240

@@ -62,6 +70,12 @@ OPTIONS
6270
Aside from returning an error code of 1, it will also print an error
6371
message if `--quiet` was not specified.
6472

73+
--exists::
74+
75+
Check whether the given reference exists. Returns an exit code of 0 if
76+
it does, 2 if it is missing, and 1 in case looking up the reference
77+
failed with an error other than the reference being missing.
78+
6579
--abbrev[=<n>]::
6680

6781
Abbreviate the object name. When using `--hash`, you do
@@ -70,8 +84,8 @@ OPTIONS
7084
-q::
7185
--quiet::
7286

73-
Do not print any results to stdout. When combined with `--verify`, this
74-
can be used to silently check if a reference exists.
87+
Do not print any results to stdout. Can be used with `--verify` to
88+
silently check if a reference exists.
7589

7690
--exclude-existing[=<pattern>]::
7791

0 commit comments

Comments
 (0)