forked from mirrors/jj
cli: don't commit working copy more than once per command
This commit is contained in:
parent
6d3c4c144c
commit
1ef85e621a
1 changed files with 4 additions and 2 deletions
|
@ -131,6 +131,7 @@ fn get_repo(ui: &Ui, matches: &ArgMatches) -> Result<Arc<ReadonlyRepo>, CommandE
|
||||||
struct RepoCommand {
|
struct RepoCommand {
|
||||||
settings: UserSettings,
|
settings: UserSettings,
|
||||||
repo: Arc<ReadonlyRepo>,
|
repo: Arc<ReadonlyRepo>,
|
||||||
|
working_copy_committed: bool,
|
||||||
// Whether the checkout should be updated to an appropriate successor when the transaction
|
// Whether the checkout should be updated to an appropriate successor when the transaction
|
||||||
// finishes. This should generally be true for commands that rewrite commits.
|
// finishes. This should generally be true for commands that rewrite commits.
|
||||||
auto_update_checkout: bool,
|
auto_update_checkout: bool,
|
||||||
|
@ -142,6 +143,7 @@ impl RepoCommand {
|
||||||
Ok(RepoCommand {
|
Ok(RepoCommand {
|
||||||
settings: ui.settings().clone(),
|
settings: ui.settings().clone(),
|
||||||
repo,
|
repo,
|
||||||
|
working_copy_committed: false,
|
||||||
auto_update_checkout: true,
|
auto_update_checkout: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -173,8 +175,8 @@ impl RepoCommand {
|
||||||
// reference pointing to the working copy commit. If it's a
|
// reference pointing to the working copy commit. If it's a
|
||||||
// type of reference that would get updated when the commit gets rewritten, then
|
// type of reference that would get updated when the commit gets rewritten, then
|
||||||
// we probably should create a new working copy commit.
|
// we probably should create a new working copy commit.
|
||||||
if revision_str == "@" {
|
if revision_str == "@" && !self.working_copy_committed {
|
||||||
// TODO: Avoid committing every time this function is called.
|
self.working_copy_committed = true;
|
||||||
self.commit_working_copy();
|
self.commit_working_copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue