ok/jj
1
0
Fork 0
forked from mirrors/jj
Commit graph

8 commits

Author SHA1 Message Date
Martin von Zweigbergk
20eb9ecec1 git: don't abandon HEAD commit when it loses a branch
I was trying to create a reproduction script for #412, but the script
ran into another bug first. The script removed all the local and
remote branches from the backing Git repo. I noticed that we would
then try to abandon all commits. We should still count Git HEAD's
target as visible and not try to abandon it. This patch fixes that.
2022-10-29 03:02:26 -07:00
Waleed Khan
de1c8f0f37 cli: make jj branch take subcommands, not flags
As per https://github.com/martinvonz/jj/issues/330.
2022-06-06 09:02:56 -07:00
Martin von Zweigbergk
0865b1ccff cli: show placeholder text for empty commit message
It can be confusing that some commits (typically the working copy)
don't have a description. Let's show a placeholder text in such cases.

I chose the format to match the "(no email configured)" message we
already have.
2022-05-18 09:16:04 -07:00
Martin von Zweigbergk
305adf05cc cli: when auto-importing from git, rebase descendants 2022-05-02 17:01:38 -07:00
Martin von Zweigbergk
726b29978d tests: show failure in git-shared working copy after deleting commit in git
Since 57ba9a9409, if the automatic import from git results in some
abandoned commit, that information gets recorded in the `MutableRepo`,
but I forgot to add a call to rebase the descendants. That causes a
failed assertion at
81a8cfefcb/lib/src/transaction.rs (L86). This
patch add a test showing that failure.
2022-05-02 17:01:38 -07:00
Martin von Zweigbergk
710d51c45b tests: move testutils from src/ to tests/ 2022-04-02 14:22:58 -07:00
Martin von Zweigbergk
034fbb47e3 cli: fix crash when initializing workspace colocated with Git repo
When initializing a workspace that shares its working copy with a Git
repo (i.e. `jj init --git-repo=.`), we import refs and HEAD when
creating the `WorkspaceCommandHelper` (as we do for all commands when
the working copy is shared). That makes the explicit import we do in
`cmd_init()` unnecessary. It also makes the checkout of HEAD I added
for the fix of #102 unnecessary. More importantly, as @yuja reported
in #177, it makes the command crash (at least if the repo is small
enough that the two checkouts happen within a second). I think the
problem is that the second checkout tries to create the same commit
except that the Change ID is different (the problem is not the
predecessors as I speculated in the issue tracker). The fix is to
simply avoid doing the redundant work. We still need a proper fix for
#27 eventually.

Closes #177.
2022-03-30 22:09:55 -07:00
Martin von Zweigbergk
197f669976 cli: fix git-colocated working copy on Windows
This patch adds a very simple e2e test of having a working copy shared
with Git. The test initially failed on Windows. The symptom was that
the "master" branch did not get updated when we create a commit using
`jj`. That suggested that we didn't correctly detect that the working
copy was shared. After a lot of troubleshooting, I think I mostly
understand what we going on here (thanks to @arxanas for suggesting
https://github.com/mxschmitt/action-tmate). The path we get from
`git2::Repository::workdir()` seems to not be canonicalized in the
same way as `std::fs::canonicalize()` canonicalizes. Specifically, it
does not have the "\\?\" prefix we get from that function. I suppose
that's because libgit2 is a C library and canonicalizes the path using
some other system call.
2022-03-30 22:09:55 -07:00