{"thread":{"id":"62840","subject":"git refs migrate does not migrate stash entries","startedAt":"2025-01-22T02:09:13Z","lastAt":"2025-01-22T06:03:13Z","messageCount":2,"participants":["brian m. carlson","Karthik Nayak"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"511032","messageId":"Z5BTQRlsOj1sygun@tapette.crustytoothpaste.net","threadId":"62840","inReplyTo":null,"subject":"git refs migrate does not migrate stash entries","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2025-01-22T02:09:05Z","receivedAt":"2025-01-22T02:09:13Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"After the recent fix for reflog migrations posted to the list, I\nconverted two work repositories. Unfortunately, it doesn't appear as\nthough the reflog for `refs/stash` was converted, so I think I may have\nlost my stashes.  While I would have liked to retain them, fortunately\nthey were not essential in these repos and I can live without them, but\nwe probably do want to fix this issue since users in general will want\nto maintain them.\n\nHere's a shell script that reproduces the problem on the latest `next`:\n----\n#!/bin/sh -e\n\nrm -fr test-repo\ngit version\ngit init -b dev test-repo\ncd test-repo\ntouch abc.txt\ngit add abc.txt\ngit commit -m +\necho abc >abc.txt\ngit stash\ngit show stash@{0}\ngit stash list -p\n\necho \"Converting...\"\ngit refs migrate --ref-format=reftable\n\necho \"Now using reftable.\"\n\ngit stash show\ngit show stash@{0}\ngit stash list -p\n----\n\nMy expectation is that the script exits 0 and prints the stashes a\nsecond time, but it exits early and unsuccessfully and the stashes don't\nappear to be preserved.  It does appear to work correctly if you comment\nout the `git refs migrate` command.\n\nI would have liked to have done more investigation, but I'm dealing with\nsome administrivia in my personal life that has taken up more of my\nevenings than I would have liked, so I have not done so.\n\nI also apologize for sending a constant barrage of bug reports that\nmight make it seem like I'm dissatisfied with the work on reftable, when\nin fact that's not the case and I do very much appreciate the work being\ndone.  I did promise Patrick that I'd try it out and be the guinea pig,\nand so I'm doing so.  I'm excited to see it end up in its final state.\n-- \nbrian m. carlson (they/them or he/him)\nToronto, Ontario, CA\n"},{"id":"511039","messageId":"CAOLa=ZQmPRXSNtZfm7noMoUgBYp4+BcOgikkCY+JyAc6n1OuUQ@mail.gmail.com","threadId":"62840","inReplyTo":"Z5BTQRlsOj1sygun@tapette.crustytoothpaste.net","subject":"Re: git refs migrate does not migrate stash entries","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2025-01-22T06:03:11Z","receivedAt":"2025-01-22T06:03:13Z","isPatch":false,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> After the recent fix for reflog migrations posted to the list, I\n> converted two work repositories. Unfortunately, it doesn't appear as\n> though the reflog for `refs/stash` was converted, so I think I may have\n> lost my stashes.  While I would have liked to retain them, fortunately\n> they were not essential in these repos and I can live without them, but\n> we probably do want to fix this issue since users in general will want\n> to maintain them.\n>\n> Here's a shell script that reproduces the problem on the latest `next`:\n> ----\n> #!/bin/sh -e\n>\n> rm -fr test-repo\n> git version\n> git init -b dev test-repo\n> cd test-repo\n> touch abc.txt\n> git add abc.txt\n> git commit -m +\n> echo abc >abc.txt\n> git stash\n> git show stash@{0}\n> git stash list -p\n>\n> echo \"Converting...\"\n> git refs migrate --ref-format=reftable\n>\n> echo \"Now using reftable.\"\n>\n> git stash show\n> git show stash@{0}\n> git stash list -p\n> ----\n>\n\nConfirming that I can also reproduce the issue.\n\n> My expectation is that the script exits 0 and prints the stashes a\n> second time, but it exits early and unsuccessfully and the stashes don't\n> appear to be preserved.  It does appear to work correctly if you comment\n> out the `git refs migrate` command.\n>\n> I would have liked to have done more investigation, but I'm dealing with\n> some administrivia in my personal life that has taken up more of my\n> evenings than I would have liked, so I have not done so.\n>\n\nI didn't investigate it yet, over the top, it seems like the reflog is\nmigrated, however the detection and display doesn't work for some reason:\n\n  $ git for-each-ref --include-root-refs\n  0652ae7d444e73ed8bee7ca7a0b66e4413386297 commit\tHEAD\n  0652ae7d444e73ed8bee7ca7a0b66e4413386297 commit\tORIG_HEAD\n  0652ae7d444e73ed8bee7ca7a0b66e4413386297 commit\trefs/heads/dev\n  2652bce3ffc3769feb7eca552d3dbe27ff901aaf commit\trefs/stash\n\nI will spend time on this week.\n\n> I also apologize for sending a constant barrage of bug reports that\n> might make it seem like I'm dissatisfied with the work on reftable, when\n> in fact that's not the case and I do very much appreciate the work being\n> done.  I did promise Patrick that I'd try it out and be the guinea pig,\n> and so I'm doing so.  I'm excited to see it end up in its final state.\n> --\n\nIf anything, this is really useful and I really appreciate you putting\nefforts to report these bugs. This helps us improve the bridge and also\nhelps the community overall.\n\nThanks for your work!\n\n> brian m. carlson (they/them or he/him)\n> Toronto, Ontario, CA\n"}]}