Re: [PATCH 3/9] t3905: move all commands into test cases
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 2, 2021, 21:41 UTC
- Message-ID
- <xmqqft2ef8qq.fsf@gitster.c.googlers.com>
- In-Reply-To
- <519840b1a280fd1a47c028ba9de776727ed77608.1612258145.git.liu.denton@gmail.com>
Denton Liu <liu.denton@gmail.com> writes:
> test_expect_success 'stash save --include-untracked stashed the untracked files' ' > + tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin)) && > + untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin)) &&
Not a new issue introduced by this patch, but
* these will fail if blobs that record "1\n" and "untracked\n" do not exist in the repository already, because the hash-object command lacks the "-w" option.
* the reason why they do not fail is because there are these blobs already; grabbing them using extended SHA-1 expression may be simpler to read, e.g.
tracked=$(git rev-parse --short HEAD:file)
* even if it is not trivial to get to such a blob object, it probably is easier to read the test if a file that has the desired contents in it is used, not an "echo", e.g.
untracked=$(git rev-parse --short $(git hash-object -w untracked/untracked))
We may want to clean these up someday, but it does not have to be part of this topic (#leftoverbits).
Show 23 quoted lines
> + cat >expect.diff <<-EOF && > + diff --git a/HEAD b/HEAD > + new file mode 100644 > + index 0000000..$tracked > + --- /dev/null > + +++ b/HEAD > + @@ -0,0 +1 @@ > + +1 > + diff --git a/file2 b/file2 > + new file mode 100644 > + index 0000000..$tracked > + --- /dev/null > + +++ b/file2 > + @@ -0,0 +1 @@ > + +1 > + diff --git a/untracked/untracked b/untracked/untracked > + new file mode 100644 > + index 0000000..$untracked > + --- /dev/null > + +++ b/untracked/untracked > + @@ -0,0 +1 @@ > + +untracked > + EOF