(path string)
| 616 | } |
| 617 | |
| 618 | func RewriteLocalPathAsURL(path string) string { |
| 619 | var slash string |
| 620 | if abs, err := filepath.Abs(path); err == nil { |
| 621 | // Required for Windows paths to work. |
| 622 | if !strings.HasPrefix(abs, "/") { |
| 623 | slash = "/" |
| 624 | } |
| 625 | path = abs |
| 626 | } |
| 627 | |
| 628 | var gitpath string |
| 629 | if filepath.Base(path) == ".git" { |
| 630 | gitpath = path |
| 631 | path = filepath.Dir(path) |
| 632 | } else { |
| 633 | gitpath = filepath.Join(path, ".git") |
| 634 | } |
| 635 | |
| 636 | if _, err := os.Stat(gitpath); err == nil { |
| 637 | path = gitpath |
| 638 | } else if _, err := os.Stat(path); err != nil { |
| 639 | // Not a local path. We check down here because we perform |
| 640 | // canonicalization by stripping off the .git above. |
| 641 | return path |
| 642 | } |
| 643 | return fmt.Sprintf("file://%s%s", slash, filepath.ToSlash(path)) |
| 644 | } |
| 645 | |
| 646 | func UpdateIndexFromStdin() (*subprocess.Cmd, error) { |
| 647 | return git("update-index", "-q", "--refresh", "--stdin") |
no outgoing calls
no test coverage detected