Re: [PATCH v4 1/7] t7063: more thorough status checking
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 29, 2020, 18:18 UTC
- Message-ID
- <xmqq369raut5.fsf@gitster.c.googlers.com>
- In-Reply-To
- <ffec2a50-e746-370c-1957-3615950bb6fb@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 5 quoted lines
>> +# Ignore_Untracked_Cache, abbreviated to 3 letters because then people can >> +# compare commands side-by-side, e.g. >> +# iuc status --porcelain >expect && >> +# git status --porcelain >actual && >> +# test_cmp expect actual
;-)
>> +iuc() {Missing SP after "iuc".
>> + git ls-files -s >../current-index-entries >> + git ls-files -t | grep ^S | sed -e s/^S.// >../current-sparse-entries
When you see yourself piping grep output to sed, think twice to see if you can lose one of them. sed -ne 's/^S.//p' perhaps?
Show 5 quoted lines
>> + >> + GIT_INDEX_FILE=.git/tmp_index >> + export GIT_INDEX_FILE >> + git update-index --index-info <../current-index-entries >> + git update-index --skip-worktree $(cat ../current-sparse-entries)
Are the dances with ls-files and update-index to prepare us for a possible future in which we do not use .git/index as the index file, or something? IOW, would
export GIT_INDEX_FILE=.git/tmp_index && cp .git/index "$GIT_INDEX_FILE &&
be insufficient?
Show 15 quoted lines
>> + >> + git -c core.untrackedCache=false "$@" >> + ret=$? >> + >> + rm ../current-index-entries >> + rm $GIT_INDEX_FILE >> + unset GIT_INDEX_FILE >> + >> + return $ret >> +} > > This is a clever way to get around the untracked cache deletion. > > Thanks for adding these extra comparisons! It really does help guarantee > that we are doing the right thing in each case.
Yes, I think it is a great idea to see tested commands behave the same way with or without the untracked cache.
Thanks.