Skip to content

Close revision operands with -- in Log, RevList, Diff and Patch [patch] - #223

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/168-trailing-double-dash
Oct 20, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/168-trailing-double-dash

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #168

What changed

  • GitLogBuilder, GitRevListBuilder, GitDiffBuilder and GitPatchBuilder now emit -- after their revision operands even when no ForPath(...) follows. GitCheckoutBuilder already did this. --end-of-options stops git reading an operand as a flag, but git still guesses whether that operand is a revision or a path until it sees --.
    • A branch with the same name as a tracked directory (docs) now resolves to the branch. Before, it failed with ambiguous argument 'docs': both revision and filename.
    • A missing revision that matches a path now fails (fatal: bad revision, surfaced as GitCommandException). Before, the call exited 0 and returned results filtered to that path.
  • In Log(), the implicit HEAD used by ExcludingRemoteTrackingRefs() gets the same --. A builder that emits no revision (for example a plain Diff()) has an unchanged argument vector.

Tests

  • GitRoundTripTests.RevisionVerbsReadABranchNamedLikeADirectoryAsTheBranchAsync: with both a docs branch and a docs/ directory, Log, RevList, Diff and Patch return the branch's data.
  • GitRoundTripTests.RevisionVerbsRejectAMissingRevisionThatMatchesAPathAsync: all four verbs throw GitCommandException when there is no docs revision but a docs/ path exists.
  • GitRevListBuilderTests.BuildsTheDefaultCountVector and GitLogBuilderTests.DefaultsTheUnpushedQueryToHead now expect the trailing --.

Verification

  • With the builder changes reverted, both new tests fail: the first with "ambiguous argument", the second because no exception is thrown.
  • With the fix in place, the full suite passes locally on net10.0 with git 2.43: 879/879.
  • This PR and Pin --ignore-submodules=none in Status, Diff and Patch [patch] #222 both edit GitDiffBuilder and GitPatchBuilder, but in different hunks, so whichever merges second should still merge cleanly.

🤖 Generated with Claude Code

https://claude.ai/code/session_016vf9SXXkfFir6zugMSNM3b


Generated by Claude Code

--end-of-options stops option parsing but leaves git guessing whether an
operand is a revision or a path. A branch named like a tracked directory
failed as "ambiguous argument", and a missing revision that matched a
path returned that path's results with exit 0. A trailing -- after the
revisions, as GitCheckoutBuilder already emits, settles both.

Fixes #168

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016vf9SXXkfFir6zugMSNM3b

Copy link
Copy Markdown
Contributor Author

ci / .NET / Analyze & Release failed on 5dae37f, and I don't think this PR caused it. The SonarCloud scanner's POST https://api.sonarcloud.io/analysis/analyses returned HTTP 500 (Unable to create analysis: HTTP code 500) before any analysis ran. #222 failed the same way a minute earlier, on a different diff. There's nothing in the repo to change for it, so I've re-run the failed job once.


Generated by Claude Code

@sonarqubecloud

Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor Author

Cross-Platform Tests / Test on macos-latest was cancelled on 5dae37f. The job's Test step started at 09:32 and was still running when it was cancelled at 09:51, about 19 minutes later. GitHub has no log for it (404), so I can't say which test was running at the time.

I don't think this PR caused it. On the same commit, ci / .NET / Test on macos-latest runs the same test project on macOS, and it passed in about 2.5 minutes, along with Windows and Ubuntu. The Cross-Platform macOS job also passed on #222, which runs on the same base.

I've already used this PR's one re-run on the SonarCloud failure above, so I'm leaving this job for a maintainer to re-run. If it hangs a second time, treat it as a real hang worth investigating. The suspects would be the two new RevisionVerbs* integration tests, since they are the only tests this PR adds.


Generated by Claude Code

This was referenced Oct 17, 2026
@matt-edmondson
matt-edmondson merged commit eb3bde6 into main Oct 20, 2026
24 of 26 checks passed
@matt-edmondson
matt-edmondson deleted the fix/168-trailing-double-dash branch October 20, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants