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

[PATCH] Stgit - gitmergeonefile.py: handle removal vs. changes

From
PGPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Date
Nov 13, 2005, 19:42 UTC
Message-ID
<20051113194225.20447.57910.stgit@zion.home.lan>

I just got a "removal vs. changed" conflict, which is unhandled by StGit. That is taken from git-merge-one-file resolver, but is bad, as stg resolved does not handle unmerged entries (and probably it should be fixed too).

Sample patch included, but some thought must be done on it (see the comments I left in).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---
 gitmergeonefile.py |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/gitmergeonefile.py b/gitmergeonefile.py
index 1cba193..9344d33 100755
--- a/gitmergeonefile.py
+++ b/gitmergeonefile.py
@@ -180,6 +180,30 @@ if orig_hash:
             os.remove(path)
         __remove_files()
         sys.exit(os.system('git-update-index --remove -- %s' % path))
+    # file deleted in one and changed in the other
+    else:
+        # Do something here - we must at least merge the entry in the cache,
+        # instead of leaving it in U(nmerged) state. In fact, stg resolved
+        # does not handle that.
+
+        # Do the same thing cogito does - remove the file in any case.
+        os.system('git-update-index --remove -- %s' % path)
+
+        #if file1_hash:
+            ## file deleted upstream and changed in the patch. The patch is
+            ## probably going to move the changes elsewhere.
+
+            #os.system('git-update-index --remove -- %s' % path)
+        #else:
+            ## file deleted in the patch and changed upstream. We could re-delete
+            ## it, but for now leave it there - and let the user check if he
+            ## still wants to remove the file.
+
+            ## reset the cache to the first branch
+            #os.system('git-update-index --cacheinfo %s %s %s'
+                      #% (file1_mode, file1_hash, path))
+        __conflict()
+
 # file does not exist in origin
 else:
     # file added in both
Next: Catalin Marinas
Message 1 of 9 in “Stgit - gitmergeonefile.py: handle removal vs. changes”
  1. Stgit - gitmergeonefile.py: handle removal vs. changesPaolo 'Blaisorblade' Giarrusso, Nov 13, 2005
  2. Catalin MarinasNov 15, 2005
  3. BlaisorbladeNov 16, 2005
  4. Catalin MarinasNov 17, 2005
  5. Chuck LeverNov 17, 2005
  6. Catalin MarinasNov 21, 2005
  7. BlaisorbladeDec 30, 2005
  8. Catalin MarinasJan 7, 2006
  9. Chuck LeverJan 8, 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.