git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Recent changes for the unsafe directory handling - TINY improvement requested in error output

From
Nathan Neulinger <nneul@neulinger.org>
Date
Apr 19, 2022, 11:26 UTC
Message-ID
<ec588ff7-b300-bc3a-b51c-67d190b27e9b@neulinger.org>

While I understand the need for the recent changes (even if I'd prefer they be limited to turning off any filter/script/custom alias/etc. support) - there is one piece of the new behavior that could be improved for usability:

If you do a 'git status' in the directory - you get the "helpful" response:
   root@server:/local/APPNAME/bin# git status
   fatal: unsafe repository ('/local/APPNAME' is owned by someone else)
   To add an exception for this directory, call:
   git config --global --add safe.directory /local/APPNAME

However, if you do a 'git diff' - such as what you might naturally do right before attempting a 'git commit' - you do NOT get any useful response:

   root@SERVER:/local/APPNAME/bin# git diff
   warning: Not a git repository. Use --no-index to compare two paths outside a working tree
   usage: git diff --no-index [<options>] <path> <path>
   ...snip-long-diff-help...

Please consider a small improvement to have the git diff help output (if displayed due to the repo exclusion warning) - ALSO display the 'git config' suggestion at the end of the output, instead of me having to remember - oh, go issue status to get the command hint to go set the exclusion. Would also be useful to have the git diff output do the same 'unsafe repository' message about ownership.

In case it matters for why I'm hitting this - server with various different application accounts. All maintained by a trusted list of users, but separated into different users for permissions isolation between the apps/repos/etc. Often edit/commit/etc. as other root or as other users (when facl's are being used). Running 1:2.25.1-1ubuntu3.3 on ubuntu 20.04 in case this is already addressed in upstream and just not included in ubuntu repackaging.

-- Nathan

------------------------------------------------------------ Nathan Neulinger nneul@neulinger.org Neulinger Consulting (573) 612-1412

Next: Bagas Sanjaya
Message 1 of 3 in “Recent changes for the unsafe directory handling - TINY improvement requested in error output”
  1. Nathan NeulingerApr 19, 2022
  2. Bagas SanjayaApr 20, 2022
  3. Nathan NeulingerApr 20, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.