jj icon indicating copy to clipboard operation
jj copied to clipboard

jj cat -R <repository> while not in repo produces misleading error message

Open sunshowers opened this issue 1 year ago • 0 comments

Description

While not in a repository, an operation like jj cat -R <repository> <file> produces an error: Error: Path "<file>" is not in the repo.

I was confused for a bit before I realized that -R doesn't change the cwd.

Steps to Reproduce the Problem

  1. Clone a repo with jj, e.g. https://github.com/nextest-rs/nextest
  2. Without cding into the new directory, run e.g. jj cat -R nextest README.md

Expected Behavior

It is correct to fail here, but a better error message would be

I checked what Mercurial does, and it produces a much better error:

% hg cat -R hg README.rst  
abort: README.rst not under root '/home/rain/dev/hg'
(consider using '--cwd hg')

(I think this kind of thing is why --cwd was added to Mercurial, so it may make sense to also add that option to jj)

Actual Behavior

A somewhat misleading error: Error: Path "README.md" is not in the repo.

Specifications

  • Platform: x86_64-unknown-linux-gnu
  • Version: jj 0.14.0

sunshowers avatar Mar 05 '24 03:03 sunshowers