Let agents cancel open questions; fix snapshots missing same-size edits
This commit is contained in:
@@ -45,6 +45,10 @@ func Snapshot(dir string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
info, err := os.Stat(index)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
data, err := os.ReadFile(index)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -64,6 +68,11 @@ func Snapshot(dir string) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// git trusts cached stat data for entries older than the index file; a fresh mtime would hide same-size edits.
|
||||
err = os.Chtimes(tmp.Name(), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
env := []string{"GIT_INDEX_FILE=" + tmp.Name()}
|
||||
_, err = runEnv(dir, env, "add", "--all")
|
||||
|
||||
Reference in New Issue
Block a user