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

[TopGit PATCH] tg import: fix + make more robust

From
Kirill Smelkov <kirr@landau.phys.spbu.ru>
Date
Sep 18, 2008, 16:29 UTC
Message-ID
<1221755370-6817-4-git-send-email-kirr@landau.phys.spbu.ru>
In-Reply-To
<1221755370-6817-1-git-send-email-kirr@landau.phys.spbu.ru>

a5bf892d0900cbf9949f628c3e05db599341a02c (tg import: Check out new files as we go) broke tg-import. This is how it fails after that change:

    $ tg import Z~~..Z
    tg: ---- Importing e3e8c1382fe4cedca31e955910914ae0033455eb to t/Z
    tg: Automatically marking dependency on master
    tg: Creating t/Z base from master...
    Switched to a new branch "t/Z"
    tg: Topic branch t/Z set up. Please fill .topmsg now and make initial commit.
    tg: To abort: git rm -f .top* && git checkout master && tg delete t/Z
    fatal: pathspec '.topdeps' did not match any files

That's why, when we do git read-tree -u -m it _kills_ .topmsg and .topdep both in index and in working tree!

Also, imagine that we are going to import patch C onto A
o---B---A
     \
      C

With read-tree we'll *override* any change in common files between A and B, so I think read-tree is wrong here (it was ok if we are importing on top of B).

What is right it seems, is to work on diff level -- to use cherry-pick. And since cherry-pick does not kill our already-in-index .topmsg and .topdeps we automatically fix the breakage.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
---
 tg-import.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tg-import.sh b/tg-import.sh
index 68477f0..799efc9 100644
--- a/tg-import.sh
+++ b/tg-import.sh
@@ -61,7 +61,7 @@ process_commit()
 	branch_name=$(get_branch_name "$commit")
 	info "---- Importing $commit to $branch_prefix$branch_name"
 	tg create "$branch_prefix""$branch_name"
-	git read-tree -u -m "$commit"
+	git cherry-pick --no-commit "$commit"
 	get_commit_msg "$commit" > .topmsg
 	git add -f .topmsg .topdeps
 	git commit -C "$commit"
-- 
1.6.0.2.250.g965aa
Previous: Kirill Smelkov
Message 22 of 22 in “A couple of TopGit tweaks”
  1. Kirill SmelkovSep 18, 2008
  2. .gitignore += vim swap filesKirill Smelkov, Sep 18, 2008
  3. martin f krafftSep 18, 2008
  4. Kirill SmelkovSep 18, 2008
  5. Bert WesargSep 18, 2008
  6. Kirill SmelkovSep 18, 2008
  7. Bert WesargSep 18, 2008
  8. Kirill SmelkovSep 18, 2008
  9. martin f krafftSep 18, 2008
  10. Daniel BarkalowSep 18, 2008
  11. Kirill SmelkovSep 19, 2008
  12. Bert WesargSep 19, 2008
  13. Kirill SmelkovSep 19, 2008
  14. Andreas EricssonSep 19, 2008
  15. Kirill SmelkovSep 19, 2008
  16. Bert WesargSep 19, 2008
  17. Default exclude rules for GitPetr Baudis, Sep 19, 2008
  18. Junio C HamanoSep 19, 2008
  19. Petr BaudisSep 19, 2008
  20. Avery PennarunSep 19, 2008
  21. tg help: <something>: improve readabilityKirill Smelkov, Sep 18, 2008
  22. tg import: fix + make more robustKirill Smelkov, Sep 18, 2008

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.