commit 30db809c8a78b73916532d9a3f1c244ffd1c44df from: Stefan Sperling date: Wed Jun 05 10:27:03 2019 UTC make 'got diff object1 object2' work from inside a work tree commit - 30f8fd5e95741399cdda93c414d5e67ef8aeb263 commit + 30db809c8a78b73916532d9a3f1c244ffd1c44df blob - b380ff4c1a044ac0fb002ae4eaf00007c9c05a24 blob + 96fece4634c0766c9a3aaef60f3df693fc56fc11 --- got/got.c +++ got/got.c @@ -1334,6 +1334,14 @@ cmd_diff(int argc, char *argv[]) } else if (argc == 2) { id_str1 = argv[0]; id_str2 = argv[1]; + if (worktree && repo_path == NULL) { + repo_path = + strdup(got_worktree_get_repo_path(worktree)); + if (repo_path == NULL) { + error = got_error_from_errno("strdup"); + goto done; + } + } } else usage_diff(); @@ -1353,7 +1361,7 @@ cmd_diff(int argc, char *argv[]) if (error) goto done; - if (worktree) { + if (argc <= 1) { struct print_diff_arg arg; char *id_str; error = got_object_id_str(&id_str,