Skip to content

Conversation

@bk2204
Copy link
Member

@bk2204 bk2204 commented Feb 13, 2023

If git rev-parse --git-dir fails, Git doesn't think that the destination is a valid repository for whatever reason. One of the most common reasons for that is that the repository is owned by another user.

In such a case, we want to show the error message from Git, since we really have no other indication that this is the case. It could be just that the destination isn't a repository at all. Regardless, the error message would be useful to the user to determine the problem, so let's return it if standard error isn't empty.

We also have an initial commit that sets up the error message processing.

Fixes #5081

When the handler setup fails, we just exit right now, instead of sending
an error message.  That leads to less than helpful behaviour if the
destination repository isn't a valid Git repository for whatever reason.

To improve this, let's make sure that we return an error message at
setup if something fails so that the user in turn gets an error message.
If `git rev-parse --git-dir` fails, Git doesn't think that the
destination is a valid repository for whatever reason.  One of the most
common reasons for that is that the repository is owned by another user.

In such a case, we want to show the error message from Git, since we
really have no other indication that this is the case.  It could be just
that the destination isn't a repository at all.  Regardless, the error
message would be useful to the user to determine the problem, so let's
return it if standard error isn't empty.
@bk2204 bk2204 force-pushed the local-transfer-ownership branch from 7497d7e to a1e8632 Compare February 13, 2023 20:42
@bk2204 bk2204 marked this pull request as ready for review February 14, 2023 15:19
@bk2204 bk2204 requested a review from a team as a code owner February 14, 2023 15:19
Copy link
Member

@chrisd8088 chrisd8088 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@bk2204 bk2204 merged commit 46b7b0e into git-lfs:main Feb 14, 2023
@bk2204 bk2204 deleted the local-transfer-ownership branch February 14, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message of local transfers when safe.directory is required

2 participants