validate remote name in pre-push too
This commit is contained in:
parent
dceb6611c7
commit
3f89436fd5
@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/github/git-lfs/git"
|
||||
"github.com/github/git-lfs/lfs"
|
||||
"github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra"
|
||||
)
|
||||
@ -48,6 +49,10 @@ func prePushCommand(cmd *cobra.Command, args []string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Remote is first arg
|
||||
if err := git.ValidateRemote(args[0]); err != nil {
|
||||
Exit("Invalid remote name %q", args[0])
|
||||
}
|
||||
lfs.Config.CurrentRemote = args[0]
|
||||
|
||||
// We can be passed multiple lines of refs
|
||||
|
@ -367,3 +367,16 @@ begin_test "pre-push multiple branches"
|
||||
|
||||
)
|
||||
end_test
|
||||
|
||||
begin_test "pre-push with bad remote"
|
||||
(
|
||||
set -e
|
||||
|
||||
cd repo
|
||||
|
||||
echo "refs/heads/master master refs/heads/master 0000000000000000000000000000000000000000" |
|
||||
git lfs pre-push not-a-remote "$GITSERVER/$reponame" 2>&1 |
|
||||
tee pre-push.log
|
||||
grep "Invalid remote name" pre-push.log
|
||||
)
|
||||
end_test
|
||||
|
Loading…
Reference in New Issue
Block a user