Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b06747

Browse files
Vampiretnyblom
authored andcommitted
Exit with non-zero exit code and usage if not giving exactly one repository
1 parent 1090a19 commit 1b06747

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎src/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,14 @@ int main(int argc, char **argv)
169169
printf("Git version: %s\n", VER);
170170
return 0;
171171
}
172-
if (args->contains(QLatin1String("help")) || args->arguments().count() != 1) {
172+
if (args->contains(QLatin1String("help"))) {
173173
args->usage(QString(), "[Path to subversion repo]");
174174
return 0;
175175
}
176+
if (args->arguments().count() != 1) {
177+
args->usage(QString(), "[Path to subversion repo]");
178+
return 12;
179+
}
176180
if (args->undefinedOptions().count()) {
177181
QTextStream out(stderr);
178182
out << "svn-all-fast-export failed: ";

‎test/command-line.bats

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,15 @@ setup() {
5555
assert_success
5656
assert_output --partial 'Usage:'
5757
}
58+
59+
@test 'not giving a repository should exist with non-zero exit code and print usage' {
60+
run svn2git
61+
assert_failure 12
62+
assert_output --partial 'Usage:'
63+
}
64+
65+
@test 'giving mutliple repositories should exist with non-zero exit code and print usage' {
66+
run svn2git repo-a repo-b
67+
assert_failure 12
68+
assert_output --partial 'Usage:'
69+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /