Comments (5)
One variant had to be added in #68
from dgit.
I'm trying to implement this, is there a way to test the git command?
This is the code i have so far.
func UpdateIndexFromReader(c *Client, opts UpdateIndexOptions, r io.Reader) (*Index, error) {
idx := NewIndex()
scanner := bufio.NewScanner(r)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line == "" {
continue
}
tab := strings.Split(line, "\t")
if len(tab) != 2 {
return nil, fmt.Errorf("Invalid line in index-info: %v", line)
}
path := tab[1]
spaces := strings.Split(tab[0], " ")
switch len(spaces) {
case 2:
// mode SP sha1 TAB path
mode, err := ModeFromString(spaces[0])
if err != nil {
return nil, err
}
sha1, err := Sha1FromString(spaces[1])
if err != nil {
return nil, err
}
if err := idx.AddStage(c, IndexPath(path), mode, sha1, Stage0, 0, 0, UpdateIndexOptions{Add: true}); err != nil {
return nil, err
}
case 3:
.....
from dgit.
I'm not sure what you mean by "test". Do you want to write an automated test that runs with go test
or do you just want to see if your output is right after running the command in any given git repo?
To see the status of the index in the current git dirgit ls-files --stage
should be sufficient to show the details that are managed by git update-index --index-info
.. it prints "mode sha1 stage\tpath" for each file in the index. To do automated testing, idx.Objects is a slice of git.IndexEntry pointers which get serialized to the index when dgit does something that requires saving the index.
from dgit.
Sorry if i didn't explain me very well. My english is very bad.
What i meant was to check the output after running the command because i found the official-git/run-tests.sh script but i have no idea how to use it.
(It would be nice to have a small guide in the readme file on how to use it)
from dgit.
There's the wiki page that @sirnewton01 wrote at https://github.com/driusan/dgit/wiki/Verify-dgit-using-official-git-tests, but the easiest way to check that there's no regressions is to send a PR. All the known passing tests are run by Travis automatically and a green checkmark means they passed.
from dgit.
Related Issues (20)
- Add support for local configuration parameters specified using "-c" global option
- Add log support for -n and -format options HOT 4
- Enhance fetch subcommand with -f and multiple groups HOT 4
- Clone is freezing when cloning from one local repo to another HOT 3
- Freeze cloning from a local repository HOT 6
- Support for git fetch depth HOT 1
- Hierarchical tags and branches aren't working properly HOT 1
- Slice bounds out of range error while running the t5510-fetch tests
- Fetch is not fetching to a destination specified by the remote.<repoid>.fetch config HOT 6
- Panic while cloning repo HOT 7
- git library is noisy HOT 2
- Unable to push - object not found HOT 7
- go master branch not invoking dgit HOT 1
- Could not find origin/master HOT 9
- panic while adding .gitignore HOT 1
- Can not index inflated thin packs
- go get fails due to bitbucket HOT 2
- dgit clone breaks on ARM64 (seems to relate to broken assumptions about memory safety/locking?)
- Migrate from Travis to GitHub Actions HOT 1
- module is not pure Go
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgit.