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

"stgit clean" has problems with removed generated files

From
Yann Dirson <ydirson@altern.org>
Date
Nov 23, 2006, 16:11 UTC
Message-ID
<20061123161135.GK5443@nan92-1-81-57-214-146.fbx.proxad.net>

I recently encountered a problem with "stgit clean", but it really is a generic issue, which can also impact other subcommands.

In a kernel tree, the precise problem I had is due to generated files committed by error in an upstream branch (a BSP from a well-known vendor, indeed ;). The first patch in my stgir stack does some cleanup by removing them from git control (so that "make dep" does not cause them to change every so often).

Now when I want to run "stg clean" for applied patches, stgit first wants to pop the whole stack, including that patch, which triggers the following error:

fatal: Untracked working tree file 'include/asm-arm/constants.h' would be                                                                                                              overwritten by merge.                                                                                                                                                                  stg clean: git-read-tree failed (local changes maybe?)                                                                                                                                 

Obviously, removing all such files by hand allows to run "stg clean", as does (floating and) popping that patch and deleting it, or running "stg clean --unappplied". The 1st approach is intrusive, and forces the user to rerun "make dep", which is not very friendy; the 2nd one is too error-prone for an operation that ought to be risk-less (delete has no --undo). The 3rd option is probably the best, but is surely not so intuitive.

The root issue seems to be that stgit has problem with such generated files, ie., files that were removed from version-control, but can still legitimately exist in the tree. Dealing with them could possibly be done (eg. allowing to back them up, and restore them when pushing the annoying patch), but is not a trivial issue (eg. we still need to guard the user against real conflicts).

At least we could put a notice about this case in the doc, so users don't get too surprised.

I could think of several (non-exclusive) possibilities to deal with the precise problem I got, which should allow.

First, when cleaning patches, we could first look up which patches are to be removed, and only pop the necessary ones.

Second, we could generalize the "clean" subcommand to accept arbitrary ranges, not only the "applied" and "unapplied" ones. A special case would be "stg clean that-patch", which would be a secure version of "stg delete".

BTW, maybe it would those make sense to allowthose special ranges in most places a range is valid.

Best regards,
Next: Catalin Marinas
Message 1 of 5 in “"stgit clean" has problems with removed generated files”
  1. Yann DirsonNov 23, 2006
  2. Catalin MarinasNov 23, 2006
  3. Yann DirsonNov 23, 2006
  4. Jakub NarebskiNov 24, 2006
  5. Catalin MarinasDec 6, 2006

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.