Skip to content

Commit 9697d77

Browse files
joskeclaude
andcommitted
VCS integration, welcome window, and bug fixes
- Add `meld-rs .` VCS mode: shows git changed files, double-click opens HEAD vs working copy diff in a new tab - Add welcome window with file/dir/merge picker dialogs when launched with no arguments - Fix initial diff not updating chunk label and chunk maps (async diff was spawned before those widgets existed) - Fix file watcher refresh loop (.git/ events caused infinite cycle) - Only rebuild VCS file list when entries actually change - Add Enter key support for opening VCS diffs - Clean up pedantic clippy warnings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent effd641 commit 9697d77

3 files changed

Lines changed: 828 additions & 61 deletions

File tree

src/main.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use gtk4::{Application, glib};
77
mod myers;
88
mod settings;
99
mod ui;
10+
mod vcs;
1011

1112
#[derive(Parser)]
1213
#[command(name = "meld-rs", about = "Visual diff and merge tool")]
@@ -42,6 +43,10 @@ pub enum CompareMode {
4243
output: Option<PathBuf>,
4344
labels: Vec<String>,
4445
},
46+
Vcs {
47+
dir: PathBuf,
48+
},
49+
Welcome,
4550
}
4651

4752
fn main() -> glib::ExitCode {
@@ -92,11 +97,20 @@ fn main() -> glib::ExitCode {
9297
eprintln!("Error: cannot compare a file with a directory");
9398
std::process::exit(1);
9499
}
100+
} else if cli.paths.len() == 1 {
101+
let path = &cli.paths[0];
102+
if path.is_dir() && vcs::is_git_repo(path) {
103+
CompareMode::Vcs { dir: path.clone() }
104+
} else if path.is_dir() {
105+
eprintln!("Error: '{}' is not inside a git repository", path.display());
106+
eprintln!("For directory comparison, provide two directories.");
107+
std::process::exit(1);
108+
} else {
109+
eprintln!("Error: single file argument not supported. Provide 2 files to compare.");
110+
std::process::exit(1);
111+
}
95112
} else {
96-
eprintln!("Usage: meld-rs <LEFT> <RIGHT>");
97-
eprintln!(" meld-rs <LOCAL> <MERGED> <REMOTE>");
98-
eprintln!(" meld-rs <LOCAL> <BASE> <REMOTE> --output MERGED");
99-
std::process::exit(1);
113+
CompareMode::Welcome
100114
};
101115

102116
let application = Application::builder()

0 commit comments

Comments
 (0)