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

Re: [PATCH v4] git-new-workdir: Don't fail if the target directory is empty

From
Paul Smith <paul@mad-scientist.net>
Date
Nov 28, 2014, 18:34 UTC
Message-ID
<1417199645.3562.6.camel@homebase>
In-Reply-To
<xmqqk32ho8mc.fsf@gitster.dls.corp.google.com>
On Wed, 2014-11-26 at 15:16 -0800, Junio C Hamano wrote:
Show 5 quoted lines
> > $ ./src/git/contrib/workdir/git-new-workdir src/git foo master
> > mkdir: cannot create directory ‘foo’: Not a directory
> > unable to create new workdir "foo"!
> 
> ;-)  That comes from mkdir || fail which is indeed sufficient.

Right. Often I find it simpler/clearer to let the underlying commands give the errors: they use perror() and can often provide more specific error messages than my script can, unless I spend a lot of effort trying to determine exactly what the problem is (permissions, disk space, bad symlink, existing file, whatever).

Should I respin this with the \"$new_workdir\" -> '$new_workdir' change (I actually prefer the latter myself but the former was used somewhere so I kept it)?

Previous: Junio C HamanoNext: Paul Smith
Message 5 of 6 in “git-new-workdir: Don't fail if the target directory is empty”
  1. git-new-workdir: Don't fail if the target directory is emptyPaul Smith, Nov 26, 2014
  2. Junio C HamanoNov 26, 2014
  3. Paul SmithNov 26, 2014
  4. Junio C HamanoNov 26, 2014
  5. Paul SmithNov 28, 2014
  6. Paul SmithDec 10, 2014

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.