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

Re: [PATCH] git-clean: remove fifo, devices, socket files

From
AVAndrey Vagin <avagin@openvz.org>
Date
Jul 15, 2016, 07:46 UTC
Message-ID
<CANaxB-y6XW7-ps1G2CB=N9CiD0VnSLhSer2nsf+2R4pm5TyswA@mail.gmail.com>
In-Reply-To
<ab717fc4-fd07-53d1-1a88-ceba6155889c@kdbg.org>
On Thu, Jul 14, 2016 at 10:56 PM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 24 quoted lines
> Am 15.07.2016 um 04:42 schrieb Andrey Vagin:
>>
>> Currently git-clean removes only links and files, but
>> there can be special files like fifo, sockets, devices.
>>
>> I think git-clean has to remove them too.
>
>
> I think that is not necessary. If you do
>
>   mkfifo fifo && sudo mknod zero c 1 5
>
> then 'git status' will not report them and 'git add' will not add them to a
> repository.
>
> Similarly, if you happen to have a special file under a name in your working
> tree where the repository has regular files, then 'git status' will report
> the names as modified, and 'git reset --hard' will replace the special files
> by the files recorded in the repository.
>
> IOW: These special files are invisible for Git unless it already knows the
> names. The latter case is outside 'git clean's domain, and the former case
> really means that special files in the working tree are left at the user's
> discretion.
I understand your points, but I don't see any reasons to ignore these files.

What will be wrong if 'git status' will reports these files? What will be wrong if 'git add' will returns an error instead of skipping them silently?

How it works now:
[avagin@laptop tmp]$ git add README
[avagin@laptop tmp]$ git add fifo && echo ok
ok
[avagin@laptop tmp]$ git commit -a -m "Add fifo file"
[master b04da32] Add fifo file
 1 file changed, 1 insertion(+)
How it works with this patch:

[avagin@laptop tmp]$ ../git/bin-wrappers/git add fifo && echo ok error: fifo: can only add regular files, symbolic links or git-directories fatal: adding files failed

I like more when 'git add' reports an error when it can't add a file.

The git-clean man page says that it removes untracked files from the working tree. It doesn't specifies that there are only links and regular files.

I won't insist on my point, it may be wrong. But I like when a behavior is predictable. I didn't expect that 'git status' doesn't show special files and 'git clean' doesn't remove them. I asked my colleagues and the current behavior was not obvious for them too.

Thanks, Andrew

>
> -- Hannes
>
Previous: Johannes SixtNext: Johannes Schindelin
Message 3 of 6 in “git-clean: remove fifo, devices, socket files”
  1. git-clean: remove fifo, devices, socket filesAndrey Vagin, Jul 15, 2016
  2. Johannes SixtJul 15, 2016
  3. Andrey VaginJul 15, 2016
  4. Johannes SchindelinJul 15, 2016
  5. Johannes SixtJul 15, 2016
  6. Andrew VaginJul 15, 2016

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.