-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git update-index --index-info missing 1 variant #43
Comments
One variant had to be added in #68 |
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:
..... |
I'm not sure what you mean by "test". Do you want to write an automated test that runs with To see the status of the index in the current git dir |
Sorry if i didn't explain me very well. My english is very bad. |
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. |
Of the 3 variants of
--index-info
listed ingit-update-index(1)
only the one used by the t0000-basic.sh test suite is implemented.It should be fairly to add support for the other two variants by basing them on the one which is implemented in UpdateIndexFromReader and adding new test cases.
The text was updated successfully, but these errors were encountered: