Skip to content
This repository was archived by the owner on Jun 16, 2020. It is now read-only.

Commit 69c3f26

Browse files
committed
Specify new behavior in documentation
1 parent c376422 commit 69c3f26

File tree

8 files changed

+53
-44
lines changed

8 files changed

+53
-44
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# Changelog
22

3+
## Next version
4+
5+
* Feature: Monitor all remotes of local repositories instead of just 'origin' ([issue #3](https://github.com/nbedos/citop/issues/3))
6+
37

48
## Version 0.1.2 (2019-12-20)
59

6-
* Fix: Binary releases now contain an executable built for the right system (#4)
10+
* Fix: Binary releases now contain an executable built for the right system ([issue #4](https://github.com/nbedos/citop/issues/4))
711
* Fix: Appveyor pipelines triggered for a tag incorrectly showed a branch as reference instead of a tag
812

913

1014
## Version 0.1.1 (2019-12-18)
1115

12-
* Support for private GitLab instances [#2]
16+
* Support for private GitLab instances ([issue #2](https://github.com/nbedos/citop/issues/2))
1317

1418

1519
## Version 0.1.0 (2019-12-18)

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ Positional arguments:
119119
120120
Options:
121121
-r REPOSITORY, --repository REPOSITORY
122-
Specify the git repository to work with. REPOSITORY can
123-
be either a path to a local git repository, or the URL
124-
of an online repository hosted at GitHub or GitLab.
125-
Both web URLs and git URLs are accepted.
126-
127-
In the absence of this option, citop will work with the
128-
git repository located in the current directory. If
129-
there is no such repository, citop will fail.
122+
Specify the git repository to monitor. If REPOSITORY is
123+
the path of a local repository, citop will monitor all
124+
the associated remotes. If REPOSITORY is a URL, citop
125+
will monitor the corresponding online repository.
126+
If this option is not set, citop will behave as if it
127+
had been set to the path of the current directory.
128+
Note that citop will only monitor repositories hosted
129+
on GitLab or GitHub.
130130
131131
-h, --help Show usage
132132

cache/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (c Commit) Strings() []text.StyledString {
215215
return texts
216216
}
217217

218-
func GitOriginURL(path string, ref string) ([]string, Commit, error) {
218+
func RemotesAndCommit(path string, ref string) ([]string, Commit, error) {
219219
// If a path does not refer to an existing file or directory, go-git will continue
220220
// running and will walk its way up the directory structure looking for a .git repository.
221221
// This is not ideal for us since running 'citop -r github.com/owner/repo' from
@@ -637,7 +637,7 @@ func (c *Cache) broadcastMonitorPipeline(ctx context.Context, u string, ref stri
637637
// channel urlc once. If no provider is able to handle the specified URL, ErrUnknownRepositoryURL
638638
// is returned.
639639
func (c *Cache) broadcastMonitorRefStatus(ctx context.Context, repo string, ref string, commitc chan<- Commit, b backoff.ExponentialBackOff) error {
640-
repositoryURLs, commit, err := GitOriginURL(repo, ref)
640+
repositoryURLs, commit, err := RemotesAndCommit(repo, ref)
641641
switch err {
642642
case nil:
643643
select {

cache/cache_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ func createRepository(t *testing.T, remotes []config.RemoteConfig) (string, stri
534534

535535
func TestGitOriginURL(t *testing.T) {
536536
t.Run("invalid path", func(t *testing.T) {
537-
_, _, err := GitOriginURL("invalid path", "HEAD")
537+
_, _, err := RemotesAndCommit("invalid path", "HEAD")
538538
if err != ErrUnknownRepositoryURL {
539539
t.Fatalf("expected %v but got %v", ErrUnknownRepositoryURL, err)
540540
}
@@ -544,7 +544,7 @@ func TestGitOriginURL(t *testing.T) {
544544
repositoryPath, _ := createRepository(t, nil)
545545
defer os.RemoveAll(repositoryPath)
546546

547-
_, _, err := GitOriginURL(path.Join(repositoryPath, "invalidpath"), "HEAD")
547+
_, _, err := RemotesAndCommit(path.Join(repositoryPath, "invalidpath"), "HEAD")
548548
if err != ErrUnknownRepositoryURL {
549549
t.Fatalf("expected %v but got %v", ErrUnknownRepositoryURL, err)
550550
}
@@ -566,7 +566,7 @@ func TestGitOriginURL(t *testing.T) {
566566
repositoryPath, _ := createRepository(t, remotes)
567567
defer os.RemoveAll(repositoryPath)
568568

569-
urls, _, err := GitOriginURL(repositoryPath, "HEAD")
569+
urls, _, err := RemotesAndCommit(repositoryPath, "HEAD")
570570
if err != nil {
571571
t.Fatal(err)
572572
}
@@ -601,7 +601,7 @@ func TestGitOriginURL(t *testing.T) {
601601

602602
for _, ref := range references {
603603
t.Run(fmt.Sprintf("reference %q", ref), func(t *testing.T) {
604-
_, commit, err := GitOriginURL(repositoryPath, ref)
604+
_, commit, err := RemotesAndCommit(repositoryPath, ref)
605605
if err != nil {
606606
t.Fatal(err)
607607
}

docs/citop.man.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ <h2 id="commit"><code>COMMIT</code></h2>
101101
citop feature/doc</code></pre>
102102
<h1 id="options">OPTIONS</h1>
103103
<h2 id="rrepository---repositoryrepository"><code>-r=REPOSITORY, --repository=REPOSITORY</code></h2>
104-
<p>Specify the git repository to work with. REPOSITORY can be either a path to a local git repository, or the URL of an online repository hosted at GitHub or GitLab. Both web URLs and git URLs are accepted.</p>
105-
<p>In the absence of this option, citop will work with the git repository located in the current directory. If there is no such repository, citop will fail.</p>
104+
<p>Specify the git repository to monitor. REPOSITORY can be either a path to a local git repository, or the URL of an online repository hosted at GitHub or GitLab. Both web URLs and git URLs are accepted.</p>
105+
<p>In the absence of this option, citop will monitor the git repository located in the current directory. If there is no such repository, citop will fail.</p>
106106
<p>Examples:</p>
107107
<pre class="shell"><code># Work with the git repository in the current directory
108108
citop

main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ Positional arguments:
235235
236236
Options:
237237
-r REPOSITORY, --repository REPOSITORY
238-
Specify the git repository to work with. REPOSITORY can
239-
be either a path to a local git repository, or the URL
240-
of an online repository hosted at GitHub or GitLab.
241-
Both web URLs and git URLs are accepted.
242-
243-
In the absence of this option, citop will work with the
244-
git repository located in the current directory. If
245-
there is no such repository, citop will fail.
238+
Specify the git repository to monitor. If REPOSITORY is
239+
the path of a local repository, citop will monitor all
240+
the associated remotes. If REPOSITORY is a URL, citop
241+
will monitor the corresponding online repository.
242+
If this option is not set, citop will behave as if it
243+
had been set to the path of the current directory.
244+
Note that citop will only monitor repositories hosted
245+
on GitLab or GitHub.
246246
247247
-h, --help Show usage
248248

man.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,30 @@ citop feature/doc
124124
.SH OPTIONS
125125
.SS \f[C]-r=REPOSITORY, --repository=REPOSITORY\f[R]
126126
.PP
127-
Specify the git repository to work with.
128-
REPOSITORY can be either a path to a local git repository, or the URL of
129-
an online repository hosted at GitHub or GitLab.
130-
Both web URLs and git URLs are accepted.
127+
Specify the git repository to monitor.
128+
If REPOSITORY is the path of a local repository, citop will monitor all
129+
the associated remotes.
130+
If REPOSITORY is a URL, citop will monitor the corresponding online
131+
repository.
132+
.PP
133+
If this option is not set, citop will behave as if it had been set to
134+
the path of the current directory.
131135
.PP
132-
In the absence of this option, citop will work with the git repository
133-
located in the current directory.
134-
If there is no such repository, citop will fail.
136+
Note that citop will only monitor repositories hosted on GitLab or
137+
GitHub.
135138
.PP
136139
Examples:
137140
.IP
138141
.nf
139142
\f[C]
140-
# Work with the git repository in the current directory
143+
# Monitor pipelines of the git repository in the current directory
141144
citop
142-
# Work with the repository specified by a web URL
145+
# Monitor pipelines of the repository specified by a web URL
143146
citop -r https://gitlab.com/nbedos/citop
144147
citop -r github.com/nbedos/citop
145148
# Git URLs are accepted
146149
citop -r git\[at]github.com:nbedos/citop.git
147-
# Paths to a local repository are accepted too
150+
# A path referring to a local repository is valid too
148151
citop -r /home/user/repos/myrepo
149152
\f[R]
150153
.fi

man.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,25 @@ citop feature/doc
5656

5757
# OPTIONS
5858
## `-r=REPOSITORY, --repository=REPOSITORY`
59-
Specify the git repository to work with. REPOSITORY can be either a path to a local git repository,
60-
or the URL of an online repository hosted at GitHub or GitLab. Both web URLs and git URLs are
61-
accepted.
59+
Specify the git repository to monitor. If REPOSITORY is the path of a local repository, citop
60+
will monitor all the associated remotes. If REPOSITORY is a URL, citop will monitor the
61+
corresponding online repository.
6262

63-
In the absence of this option, citop will work with the git repository located in the current
64-
directory. If there is no such repository, citop will fail.
63+
If this option is not set, citop will behave as if it had been set to the path of the current
64+
directory.
65+
66+
Note that citop will only monitor repositories hosted on GitLab or GitHub.
6567

6668
Examples:
6769
```shell
68-
# Work with the git repository in the current directory
70+
# Monitor pipelines of the git repository in the current directory
6971
citop
70-
# Work with the repository specified by a web URL
72+
# Monitor pipelines of the repository specified by a web URL
7173
citop -r https://gitlab.com/nbedos/citop
7274
citop -r github.com/nbedos/citop
7375
# Git URLs are accepted
7476
citop -r [email protected]:nbedos/citop.git
75-
# Paths to a local repository are accepted too
77+
# A path referring to a local repository is valid too
7678
citop -r /home/user/repos/myrepo
7779
```
7880

0 commit comments

Comments
 (0)