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

Re: stgit: lost all my patches again

From
Karl Hasselström <kha@treskal.com>
Date
Nov 28, 2007, 16:04 UTC
Message-ID
<20071128160410.GB19302@diana.vm.bytemark.co.uk>
In-Reply-To
<9e4733910711280706j45fe9c17t928396eb8e1de8bf@mail.gmail.com>
On 2007-11-28 10:06:57 -0500, Jon Smirl wrote:
> I did this:
> all pataches were applied
> git rebase

At this point, a simple "git reset --hard HEAD@{1}" should have fixed the problem. Not much use knowing that now, I know, but still ... :-)

> stg repair -- partial repair, some patches empty, half are pushed

Modulo any bugs, this should have adjusted the appliedness of your patches to match the new HEAD (patches are applied iff they are reachable from HEAD) and made patches of any non-patch commits sitting between a patch and HEAD. Nothing else. In particular, it doesn't change your existing patches or change HEAD, so those empty patches were empty even before the repair. (Modulo any bugs, of course, but that kind of bug seems really unlikely.)

> moved HEAD back in front of rebase
> stg repair - it show all my patches as popped,

That sounds OK. You reset HEAD to a commit early enough in history that no patches are reachable from it.

> but when I started doing command it complain that some commits that
> stg needed were not there.

That sounds seriously broken. What exactly was the complaint? Missing commit objects?

> The complaint was caused by the first repair. The first repair
> altered some of the stg state to point at commits past the rebase.

Yes. It would have made patches out of some of the rebased commits, in order to give you a consistent state. For example, assume you started with the following situation:

(cN are commits, pN are commits that are also StGit patches)
   ...---c0---c1---p0---p1---p2---p3---p4:HEAD
You git-rebase, causing a situation like this:
   ...---c0---c1---p0---p1---p2---p3---p4
                         \
                          c2---c3---c4---c5---c6---c7---c8:HEAD

"stg repair" at this point will see that p2..p4 should be unapplied since they aren't reachable from HEAD, and c2..c8 need to be made patches since they are on top of p1.

Generally, what you want to do is to git-reset to the commit you want HEAD to be, and _then_ run stg repair.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Jon SmirlNext: Jon Smirl
Message 18 of 26 in “stgit: lost all my patches again”
  1. Jon SmirlNov 27, 2007
  2. Jakub NarebskiNov 27, 2007
  3. Jon SmirlNov 27, 2007
  4. Karl HasselströmNov 28, 2007
  5. StGit hooksKarl Hasselström, Nov 28, 2007
  6. Andreas EricssonNov 28, 2007
  7. Karl HasselströmNov 28, 2007
  8. Andreas EricssonNov 28, 2007
  9. Karl HasselströmNov 28, 2007
  10. Andreas EricssonNov 28, 2007
  11. Jon SmirlNov 28, 2007
  12. Andreas EricssonNov 28, 2007
  13. Karl HasselströmNov 28, 2007
  14. Andreas EricssonNov 28, 2007
  15. Karl HasselströmNov 28, 2007
  16. Junio C HamanoNov 28, 2007
  17. Jon SmirlNov 28, 2007
  18. Karl HasselströmNov 28, 2007
  19. Jon SmirlNov 28, 2007
  20. Karl HasselströmNov 28, 2007
  21. Jon SmirlNov 28, 2007
  22. Karl HasselströmNov 28, 2007
  23. Make "stg repair" help text more helpfulKarl Hasselström, Nov 30, 2007
  24. Junio C HamanoNov 28, 2007
  25. Jon SmirlNov 28, 2007
  26. Karl HasselströmNov 28, 2007

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.