pijul_org / pijul

#314 Unable to switch branch

Opened by mp, on September 30, 2018
Closed
mp commented on September 30, 2018

While trying out Pijul for the first time, I ran into an interesting bug. I was able to get the repository into a state in which I was not able to change to another branch. I am using version 0.10.0 (obtained via brew) on macOS 10.13.6.

For convenience, copy the following sequence of commands into a script and execute it:

#!/bin/sh
pijul init hello
cd hello
echo "Hello, World!" > hello.txt
pijul add hello.txt
pijul record -am "Initial state"

pijul fork other
pijul checkout other
pijul mv hello.txt hello_world.txt
echo "Hello!" > hello.txt
pijul add hello.txt
pijul record -am 'Moved "Hello, World!", created new hello.txt'

pijul checkout master
pijul checkout other
touch foo

Here are the results:

> cd hello
> pijul checkout master
error: There are pending changes in the repository. You need to revert or record them if you want to continue.
> pijul status

Changes not yet recorded:
  (use "pijul record ..." to record a new patch)

        deleted:   hello.txt

Untracked files:
  (use "pijul add <file>..." to track them)

        foo
> pijul diff | cat
deleted file: hello.txt

In file "hello.txt"

- Hello, World!
> pijul revert -a
> pijul checkout master
error: There are pending changes in the repository. You need to revert or record them if you want to continue.
> pijul status

Changes not yet recorded:
  (use "pijul record ..." to record a new patch)

        modified:  hello.txt

Untracked files:
  (use "pijul add <file>..." to track them)

        foo
> pijul diff | cat
In file "hello.txt"

- Hello, World!
+ Hello!
> pijul revert -a
> pijul diff | cat
In file "hello.txt"

- Hello, World!
+ Hello!
> pijul record -am "Foobar"
Recorded patch ACB3CXqraZAiFvKZcKepGfUDuixShf17ywX7KRGAxzAoNs68AJtMa6hZP5qLXosXwVqPKuudnydh4VYym12NFdhQ
> pijul diff | cat
In file "hello_world.txt"

- Hello!
+ Hello, World!

You get the picture. Beyond that I could not do anything to convince Pijul that no unrecorded change has occured. No matter what I have tried, I was not able to checkout the master branch.

mp commented on September 30, 2018

I have experimented some more. Pijul does not behave entirely deterministic here. Sometimes it works okay, sometimes it does not. For example, deleting the untracked file sometimes does the trick, but not reliably so.

pmeunier commented on October 5, 2018

Hi! Thanks for reporting. I don't know what version of Pijul you have, but I just included the test in our test suite, and ran it multiple times without a problem. If you are using the version from the master here, can you give us more detail about your platform?

pmeunier commented on October 21, 2018

Ok, closing because the tests pass. If you want to reopen, please provide a test that fails, in a more reproducible way.

mpuppe commented on October 22, 2018

Sorry for not answering earlier. I have been very busy, and I had trouble logging into this site.

As I stated in my initial post, I was using version 0.10.0 (obtained via Homebrew) on macOS 10.13.6. I still experience the problem on macOS 10.14. And yes, it does not happen every time. But testing it again just now, an error occured 5 out of 10 times. See the protocol at the end of this post. ./foo is the script from my initial post, and I am using fish as my shell. I think it is fair to say, that it is reproducible on my system.

I tried to reproduce it with the version from master, but I was unable to build pijul because of issue #319.

If there is any way to provide more detailed debug output, I would be happy to provide that.

martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch AsE7HxFsLrpWkjs3RLe9gRuA3M96aoG4DBRTBSQF1zw53srbwycgj2NAbrnxHkubE6B3uDfzce39mMwWo4Lzr3fn
Current branch: "other"
Recorded patch 6osZKeJ1pKkvuMyTtE3nF6rVKM5nVCMHSbPprkY51uScZB2BnDiXeqFptv8gmBUokrRCvxgAr3Jut5Sj5dNzK1XQ
Current branch: "master"
Current branch: "other"
Current branch: "master"
martin@illyria ~/hello> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 898YJhfScTVa5fNfbHsEE4XPHRrUJCS72aQUetSANpNMsU3srzEf9DctB7hYpe4BgWJ5TrzxbShfAbMEbFr5Ytbk
Current branch: "other"
Recorded patch 9qjCTCxv4MRsy94uTKQTPv5QspUWoX2ere2P6Js8qG7EEmWsEgCAKDJRnvT1Y5rkHvXWrqZXjMNdFXFppdtx8kCP
Current branch: "master"
Current branch: "other"
error: There are pending changes in the repository. You need to revert or record them if you want to continue.
martin@illyria ~/hello [1]> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch BAk6gDdG6xJqkGSgsGfjeG4JnY7662sHYo6766FPZcTZDGBkgDEve8sBKfbcYVjfXUAxNKtoEoMecq2e9ccbyS1j
Current branch: "other"
Recorded patch 7QLf2zVcNF6E8C8M3zbFZ4HWTSmag6qugtqTnsSK7iMDuGbeDqvpmx1LbZ528JEmBh5F2GvEiYfo3J81Sr9Zk6iC
Current branch: "master"
Current branch: "other"
Current branch: "master"
martin@illyria ~/hello> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 6QMac8FEo7phCGXrXWaC28git5srBkkqmog8hWDMrVZsHFDPoNviVLhWdGWrWBfR9t1fUXoEycwdBBs81EUkzKeR
Current branch: "other"
Recorded patch 95TP2LCEiZ7MPyhd3G5RtpEtfhR6h4yRXkjQSzuQKGMgr5uo4JR59Qi2c6N3ZETozG6bVeYkskkS1bXADV539xKv
Current branch: "master"
Current branch: "other"
error: There are pending changes in the repository. You need to revert or record them if you want to continue.
martin@illyria ~/hello [1]> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 6ASccqZKx521S4vU3Ti87XhG18qVMTVKFpdYH98snHjq18VJF5kjyJKJCvUNBJrQwFXpr5EFcpn1ToNKYv6z1KPd
Current branch: "other"
Recorded patch AJxYcWViNuJZJsjKCNQ5E4ETwuTkNLMKfL3tT4J2GoRSSDH8XcK1GgJqn6af6AFqXeWZDERymvzE2woMnPxgq2vz
Current branch: "master"
Current branch: "other"
error: There are pending changes in the repository. You need to revert or record them if you want to continue.
martin@illyria ~/hello [1]> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 8yajqQJZ1RMgE6XGLL2EV2G28H6NM3uCpo6CNXqGqwyhGo4LZRhaMifySRXSoCyH6QQJ37eYctiMqb82g2deizcW
Current branch: "other"
Recorded patch 6WHwzrehuP8DApzD8BKtZpsoB91tqdf3CnZQWoKHjY2USiCq9SyXGN6zfBwXH2rE9eYpUsicBQbqvyv2Aj84zfAX
Current branch: "master"
Current branch: "other"
Current branch: "master"
martin@illyria ~/hello> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 75rytpJKDwT4iYnDC5Qe5MQPyo6srBkSEktzsS2Zz9Mi54YkZyWTc7KKojfiMtVeBeU7pCrU9bHL7RuZD8EuCEZP
Current branch: "other"
Recorded patch 9u25qkYPsWpysYw4FhNt4kQci8oFC2jnhjXGRHfpj6Hs9pDktCRNC6gbnR9aYPhh2uZKKa3FzceUt1Vwkz3F5jdd
Current branch: "master"
Current branch: "other"
Current branch: "master"
martin@illyria ~/hello> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 9MY8niTDpgG3A2s9UfAZxgFQYBAe5aejv13eFLp6xsMac5g6udd75FY2HnUNXU6YkXMih6kFTvvsjt2iuDvsd7M7
Current branch: "other"
Recorded patch 98DCWHgHNKava8DBG7Tz1QMUJLhcp4vTxaPi3FTiJuGKZYoWGDG51VRHKRWuxYxLJ9FQQhYmMbmMzrM5B3tQ4KqR
Current branch: "master"
Current branch: "other"
Current branch: "master"
martin@illyria ~/hello> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 6voyASo9cEHJzBeWy8bKKNVdC2Wkq78vZ4129cWGF7RjybHQo6Z9GYYQ9NxDDC3qD6We6Hz7mMwhucETKwHG5ccL
Current branch: "other"
Recorded patch 9qK49jbUdnsYuC1otSVZRthee6JqmUFiCbcFc6oynZhvus9wYpMoWJMdHVTs5GVEBvCaf38W9afPmoxN2avQH2Yq
Current branch: "master"
Current branch: "other"
error: There are pending changes in the repository. You need to revert or record them if you want to continue.
martin@illyria ~/hello [1]> cd ~/ ; and rm -r hello/
martin@illyria ~> ./foo ; and cd hello ; and pijul checkout master
Recorded patch 83g9CxQscGeFoP7YUR5jBzPMe96g6BwkW5rbwXv9PoEPRNnA13qMuupVxPc4Kg5Ra8TcSSNf9TKVqmtd4ot3PxNU
Current branch: "other"
Recorded patch ArkJvgzmCWKLLbb7MueWrM4pVQhWdw86KtmEXjcUzG3tTppGkpJFGxJwm5yRfxKcYtSMDXDZ7Eho2kMPLpTjwiFK
Current branch: "master"
Current branch: "other"
error: There are pending changes in the repository. You need to revert or record them if you want to continue.