Download raw body.
got: fix incorrect argc check when diffing blobs
On Fri, Aug 26, 2022 at 01:44:05AM +1000, Mark Jamsek wrote:
> We should check for more than two args as we have two blob ids:
>
> $ got diff 66173f9f4759b015a8 dae7c1789fc137c1b6927dca
> got: path arguments cannot be used when diffing blobs
>
> With the below diff:
>
> $ got diff 66173f9f4759b015a8 dae7c1789fc137c1b6927dca
> blob - 66173f9f4759b015a8e2f0f9acc21194830f066d
> blob + dae7c1789fc137c1b6927dca65e7f44b457d1e34
> --- 66173f9f4759b015a8e2f0f9acc21194830f066d
> +++ dae7c1789fc137c1b6927dca65e7f44b457d1e34
> @@ -21,6 +21,14 @@ got:
> This must require an up-to-date and clean work tree to avoid unrelated
> changes from getting mixed in. Perform an implicit work tree base-commit
> bump after committing, like 'got rebase' and 'got histedit' do it.
> +- Respect the current umask when creating or changing files and directories
> + in the work tree. This behaviour is already documented in got-worktree(5)
> + but not actually implemented.
> +- When a clone fails the HEAD symref will always point to "refs/heads/main"
> + (ie. the internal default HEAD symref of Got). Resuming a failed clone with
> + 'got fetch' is supposed to work. To make this easier, if the HEAD symref
> + points to a non-existent reference it should be updated by 'got fetch'
> + to match the HEAD symref sent by the server.
>
> network protocol:
> - add http(s) transport with libtls, speaking the two Git HTTP protocols
>
ok stsp
Too bad this didn't have test coverage.
> diff /home/mark/src/got
> commit - f0680473a7db1e5941bffdc2ab5f80ddec209122
> path + /home/mark/src/got
> blob - f9bcb1bca8436bc052e3bdeab3be53a13add0a61
> file + got/got.c
> --- got/got.c
> +++ got/got.c
> @@ -5157,7 +5157,7 @@ cmd_diff(int argc, char *argv[])
> error = got_error(GOT_ERR_OBJ_TYPE);
> goto done;
> }
> - if (type1 == GOT_OBJ_TYPE_BLOB && argc > 0) {
> + if (type1 == GOT_OBJ_TYPE_BLOB && argc > 2) {
> error = got_error_msg(GOT_ERR_OBJ_TYPE,
> "path arguments cannot be used when diffing blobs");
> goto done;
>
> --
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
got: fix incorrect argc check when diffing blobs