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

Re: Can I remove stg sync --undo ?

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Jul 7, 2008, 20:47 UTC
Message-ID
<b0943d9e0807071347n17e2e09ai761b849d2d03bc9c@mail.gmail.com>
In-Reply-To
<20080705083348.GA21097@diana.vm.bytemark.co.uk>
2008/7/5 Karl Hasselström <kha@treskal.com>:
Show 28 quoted lines
> On 2008-07-04 23:05:11 +0100, Catalin Marinas wrote:
>
>> 2008/7/4 Karl Hasselström <kha@treskal.com>:
>>
>> > On 2008-07-03 23:02:28 +0100, Catalin Marinas wrote:
>> >
>> > > The sync performs three operations - push, merge and refresh (if
>> > > the refresh is automatic after merge, it doesn't update the
>> > > backup information since it was done by merge).
>> > >
>> > > If merge fails, the refresh is manual after solving the
>> > > conflicts. I suspect this will be recorded as a separate step
>> > > for undo
>> >
>> > Yeah, the new undo stuff will currently handle sync just like e.g.
>> > push and pop: write one log entry when the command's all done,
>> > plus one extra just before the conflicting push if there is one.
>> > So you can always undo the entire command; and in case of
>> > conflicts, you also have the option of undoing just the
>> > conflicting push. Is this enough for sync?
>>
>> There are two operations that can conflict for sync - pushing a
>> patch and the actual sync'ing, i.e. a three-way merge with the patch
>> to be synchronised with (kind of fold).
>
> My guess is that conflicts of the first type would work out of the box
> (i.e. they'd get an extra log entry) while conflicts of the second
> type would not.

I don't really care as long as I can get back to the patch state before running the sync command if anything goes wrong. So, one undo level would be enough.

> We need a sync undo test.
Yes but not sure what how undo would behave in this situation yet.
Show 17 quoted lines
>> > > (BTW, is resolved take into account for undo?).
>> >
>> > Hmmm, what do you mean by "resolved"?
>>
>> The current resolved command - the clearing of the conflicting
>> entries in the index.
>
> With just "stg undo" (or reset or redo), you get the usual
> new-infrastructure check about dirty index and working tree (the whole
> index must be clean, and the parts of the worktree we need to touch
> must be clean). Which prevents you from undoing a conflicting push,
> for example.
>
> With the --hard flag, any uncleanliness in index or worktree simply
> gets zapped (just like with git reset --hard). I'm not 100% happy with
> this -- what I'd really like is to zap only the files that we need to
> touch. But I haven't figured out a good way to do that.
OK, not much to comment here, it's your implementation :-).
-- 
Catalin
Previous: Karl HasselströmNext: Karl Hasselström
Message 6 of 7 in “Can I remove stg sync --undo ?”
  1. Karl HasselströmJul 2, 2008
  2. Catalin MarinasJul 3, 2008
  3. Karl HasselströmJul 4, 2008
  4. Catalin MarinasJul 4, 2008
  5. Karl HasselströmJul 5, 2008
  6. Catalin MarinasJul 7, 2008
  7. Karl HasselströmJul 8, 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.