Thread (2 messages) 2 messages, 2 authors, 2020-03-31

Re: [PATCH v4 1/7] t7063: more thorough status checking

flat view

From: Junio C Hamano <hidden>
Date: 2020-03-29 18:18:58

Derrick Stolee [off-list ref] writes:
quoted
+# 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
;-)
quoted
+iuc() {
Missing SP after "iuc".
quoted
+	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?
quoted
+
+	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?
quoted
+
+	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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help