fix 'got update' of an added + obstructed file
commite6f4ba3109814ba43d3a9e9c9c9dc55c40149dbc
authorStefan Sperling <stsp@stsp.name>
Fri, 24 Sep 2021 21:52:59 +0000 (24 21:52 +0000)
committerThomas Adam <thomas@xteddy.org>
Fri, 24 Sep 2021 22:01:09 +0000 (24 23:01 +0100)
treec81323558dcaa33b57f2a1cac73b74a45013c20a
parentdf3d7c3ef8853d0fa9182dd3f3023a4d5e222ce0
fix 'got update' of an added + obstructed file

When 'got update' tried to add a new file to the work tree and this
file was obstructed by, say, a directory on disk, the update failed:

  $ got update
  ?  new
  got: new: Is a directory
  $

And the work tree was not updated.

With this commit this situation is properly detected as an obstruction
and the update succeeds:

  $ got update
  ~  new
  Updated to refs/heads/master: c1f85b4938dc4c668a88f13df2b98a520fc077cc
  File paths obstructed by a non-regular file: 1
  $

Extend a corresponding test case to cover this issue.

ok tracey
lib/worktree.c
regress/cmdline/update.sh