How to use the isomorphic-git/internal-apis.GitConfig.from function in isomorphic-git

To help you get started, weโ€™ve selected a few isomorphic-git examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('numeric suffix', async () => {
      const configA = GitConfig.from(`[core]
      bigFileThreshold = 2k`)
      const configB = GitConfig.from(`[core]
      bigFileThreshold = 2m`)
      const configC = GitConfig.from(`[core]
      bigFileThreshold = 2g`)
      const a = await configA.get('core.bigFileThreshold')
      const b = await configB.get('core.bigFileThreshold')
      const c = await configC.get('core.bigFileThreshold')
      expect(a).toEqual(2048)
      expect(b).toEqual(2097152)
      expect(c).toEqual(2147483648)
    })
  })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('numeric suffix', async () => {
      const configA = GitConfig.from(`[core]
      bigFileThreshold = 2k`)
      const configB = GitConfig.from(`[core]
      bigFileThreshold = 2m`)
      const configC = GitConfig.from(`[core]
      bigFileThreshold = 2g`)
      const a = await configA.get('core.bigFileThreshold')
      const b = await configB.get('core.bigFileThreshold')
      const c = await configC.get('core.bigFileThreshold')
      expect(a).toEqual(2048)
      expect(b).toEqual(2097152)
      expect(c).toEqual(2147483648)
    })
  })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('subsection', async () => {
      const config = GitConfig.from(`[one]
      keyaaa = valaaa
      
      [remote "foo"]
      url = https://foo.com/project.git
      ; this is a comment
      
      [remote "bar"]
      url = https://bar.com/project.git`)
      await config.deleteSection('remote', 'foo')
      expect(config.toString()).toEqual(`[one]
      keyaaa = valaaa
      
      [remote "bar"]
      url = https://bar.com/project.git`)
    })
  })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('multiple', async () => {
      const config = GitConfig.from(`[foo]
      keyaaa = valaaa
      keybbb = valbbb
      keybbb = valBBB`)
      const a = await config.getall('foo.keybbb')
      expect(a).toEqual(['valbbb', 'valBBB'])
    })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('subsection', async () => {
      const config = GitConfig.from(`[remote "foo"]
      url = https://foo.com/project.git
      [remote "bar"]
      url = https://bar.com/project.git`)
      await config.append('remote.baz.url', 'https://baz.com/project.git')
      expect(config.toString()).toEqual(`[remote "foo"]
      url = https://foo.com/project.git
      [remote "bar"]
      url = https://bar.com/project.git
[remote "baz"]
\turl = https://baz.com/project.git`)
    })
  })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('simple', async () => {
      const config = GitConfig.from(`[one]
      keyaaa = valaaa
          
      [remote "foo"]
      url = https://foo.com/project.git

      [remote "bar"]
      url = https://bar.com/project.git
            
      [two]
      keyaaa = valaaa`)
      const subsections = await config.getSubsections('remote')
      expect(subsections).toEqual(['foo', 'bar'])
    })
  })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('new section', async () => {
      const config = GitConfig.from(`[foo]
      keyaaa = valaaa`)
      await config.set('bar.keyaaa', 'valaaa')
      expect(config.toString()).toEqual(`[foo]
      keyaaa = valaaa
[bar]
\tkeyaaa = valaaa`)
    })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('special boolean', async () => {
      const config = GitConfig.from(`[core]
      filemode = off
      bare = on
      logallrefupdates = no
      symlinks = true`)
      const a = await config.get('core.filemode')
      const b = await config.get('core.bare')
      const c = await config.get('core.logallrefupdates')
      const d = await config.get('core.symlinks')
      expect(a).toEqual(false)
      expect(b).toEqual(true)
      expect(c).toEqual(false)
      expect(d).toEqual(true)
    })
github isomorphic-git / isomorphic-git / __tests__ / test-GitConfig.js View on Github external
it('numeric suffix', async () => {
      const configA = GitConfig.from(`[core]
      bigFileThreshold = 2k`)
      const configB = GitConfig.from(`[core]
      bigFileThreshold = 2m`)
      const configC = GitConfig.from(`[core]
      bigFileThreshold = 2g`)
      const a = await configA.get('core.bigFileThreshold')
      const b = await configB.get('core.bigFileThreshold')
      const c = await configC.get('core.bigFileThreshold')
      expect(a).toEqual(2048)
      expect(b).toEqual(2097152)
      expect(c).toEqual(2147483648)
    })
  })