You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(vcs): better support for shallow clones in repo.get_changed_files()
`git log BASE..HEAD` says, show me commits reachable from HEAD, but not
reachable from BASE. In a shallow clone where we only fetch BASE and
HEAD (which is what run-task does), this means the command will only
return `HEAD`. In otherwords, we're only returning files changed by the
tip commit of the push and ignoring everything else.
By switching to `git diff BASE HEAD`, we're instead comparing the
snapshots of both revisions. Sometimes this is what we want, e.g for
force pushes, it'll be the interdiff of files modified between the two
pushes (though some developers might expect it to contain the files
modified since the merge base).
Sometimes it's not what we want, e.g for PRs, it'll be the files changed
between the PR and the latest commit on `main`.
Either way, this behaviour is at least somewhat more accurate than git
log when we don't have full history. Likely we'll need to fetch the
proper changed files using the Github API in the future, but for now
this is better than nothing.
0 commit comments