Re: [PATCH 1/2] t7501: Add tests for various index usages, -i and -o, of commit command.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ghanshyam Thakkar <shyamthakkar001@xxxxxxxxx> writes:

> Subject: Re: [PATCH 1/2] t7501: Add tests for various index usages, -i and -o, of commit command.

Overly long subject that has an unusual capitalization after
"t7501:" (see "git log --no-merges --format=%s -20 v2.43.0" for
example and try to write something that blends better).

> +test_expect_success 'commit with -i fails with untracked files' '
> +	test_when_finished "rm -rf testdir" &&
> +	git init testdir &&
> +	echo content >testdir/file.txt &&
> +	test_must_fail git -C testdir commit -i file.txt -m initial
> +'

In addition to "why a new repository???" comment raised already, I
do not want to see the last command spelled like so.  Always write
dashed options (and their parameters) before non-option arguments,
i.e.

	git commit -i -m initial file.txt
	git -C testdir  commit -i -m initial file.txt
	test_must_fail git -C testdir commit -i -m initial file.txt

The command line parser does rotate the unrecognized arguments to
the end and keeps looking for recognisable option (possibly followed
by its parameter), but that is purely to help lazy writers (i.e.,
interactive command users).  When writers know "-i" does not take
any parameter, it may be convenient if the writer who forgot to say
"-m" can just append "-m initial" to what has already be written.

When writing source (be it the production code or test), however, we
write for readers.  What you wrote at a first glance, especially
given that "-i" (or "-o" for that matter) is a relatively less
commonly used option, would confuse less experienced readers by
making them wonder what "-i file.txt" means (e.g., "is that taking
input from the contents of file.txt?").





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux