diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-19 22:04:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-19 22:04:46 +0200 |
commit | 8738a04708b91683d5804b4c648c871fdeb87f82 (patch) | |
tree | 017b15080dee8bd64026c9358d832e61d12674d5 /plumbing | |
parent | 595dfe6e53a038da4949263ea2d9a7a0020c48b7 (diff) | |
parent | 4a7e7cddc0e4f88085b263693c87635254de7f35 (diff) | |
download | go-git-8738a04708b91683d5804b4c648c871fdeb87f82.tar.gz |
Merge pull request #493 from src-d/windows
*: several windows support fixes
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/format/config/encoder.go | 8 | ||||
-rw-r--r-- | plumbing/transport/git/receive_pack_test.go | 4 | ||||
-rw-r--r-- | plumbing/transport/server/loader.go | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/plumbing/format/config/encoder.go b/plumbing/format/config/encoder.go index 88bdf65..6d17a5a 100644 --- a/plumbing/format/config/encoder.go +++ b/plumbing/format/config/encoder.go @@ -3,6 +3,7 @@ package config import ( "fmt" "io" + "strings" ) // An Encoder writes config files to an output stream. @@ -61,7 +62,12 @@ func (e *Encoder) encodeSubsection(sectionName string, s *Subsection) error { func (e *Encoder) encodeOptions(opts Options) error { for _, o := range opts { - if err := e.printf("\t%s = %s\n", o.Key, o.Value); err != nil { + pattern := "\t%s = %s\n" + if strings.Index(o.Value, "\\") != -1 { + pattern = "\t%s = %q\n" + } + + if err := e.printf(pattern, o.Key, o.Value); err != nil { return err } } diff --git a/plumbing/transport/git/receive_pack_test.go b/plumbing/transport/git/receive_pack_test.go index 326ef1b..f9afede 100644 --- a/plumbing/transport/git/receive_pack_test.go +++ b/plumbing/transport/git/receive_pack_test.go @@ -99,9 +99,11 @@ func (s *ReceivePackSuite) SetUpTest(c *C) { } func (s *ReceivePackSuite) TearDownTest(c *C) { - err := s.daemon.Process.Signal(os.Interrupt) + err := s.daemon.Process.Signal(os.Kill) c.Assert(err, IsNil) + _ = s.daemon.Wait() + err = os.RemoveAll(s.base) c.Assert(err, IsNil) } diff --git a/plumbing/transport/server/loader.go b/plumbing/transport/server/loader.go index d4eccd4..028ead4 100644 --- a/plumbing/transport/server/loader.go +++ b/plumbing/transport/server/loader.go @@ -10,7 +10,7 @@ import ( ) // DefaultLoader is a filesystem loader ignoring host and resolving paths to /. -var DefaultLoader = NewFilesystemLoader(osfs.New("/")) +var DefaultLoader = NewFilesystemLoader(osfs.New("")) // Loader loads repository's storer.Storer based on an optional host and a path. type Loader interface { |