aboutsummaryrefslogtreecommitdiff
path: root/func.cc
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-08-05 14:38:34 -0700
committerDan Willemsen <dwillemsen@google.com>2015-08-05 15:05:50 -0700
commit48d6e8cf10618a398a85f3728f7a9243b4c57090 (patch)
tree577c42b703ab141f4c1af42be947dbbc5ab7a7fd /func.cc
parenta06bee9cb929c2e0646154c6803c3c32565ca6eb (diff)
downloadkati-48d6e8cf10618a398a85f3728f7a9243b4c57090.tar.gz
[C++] Don't sort find/ls results
These should only be sorted if explicitly requested, otherwise make-built binaries may be different from kati-built binaries. This resolves some binary-diff issues for Android between libc.a built with make vs kati/ninja. To be the same across multiple checkouts/machines, we should probably switch android to sorting these results, but then the kati ninja support will stop working.
Diffstat (limited to 'func.cc')
-rw-r--r--func.cc16
1 files changed, 4 insertions, 12 deletions
diff --git a/func.cc b/func.cc
index e9cdca3..73259c7 100644
--- a/func.cc
+++ b/func.cc
@@ -476,7 +476,6 @@ static bool HasNoIoInShellScript(const string& cmd) {
}
static void ShellFuncImpl(const string& shell, const string& cmd,
- bool is_file_list_command,
string* s, FindCommand** fc) {
LOG("ShellFunc: %s", cmd.c_str());
@@ -493,7 +492,6 @@ static void ShellFuncImpl(const string& shell, const string& cmd,
}
#else
if (FindEmulator::Get()->HandleFind(cmd, **fc, s)) {
- *s = SortWordsInString(*s);
return;
}
#endif
@@ -504,19 +502,13 @@ static void ShellFuncImpl(const string& shell, const string& cmd,
COLLECT_STATS_WITH_SLOW_REPORT("func shell time", cmd.c_str());
RunCommand(shell, cmd, RedirectStderr::NONE, s);
- if (is_file_list_command) {
- *s = SortWordsInString(*s);
- } else {
- FormatForCommandSubstitution(s);
- }
+ FormatForCommandSubstitution(s);
#ifdef TEST_FIND_EMULATOR
if (need_check) {
- string sorted = SortWordsInString(*s);
- out2 = SortWordsInString(out2);
- if (sorted != out2) {
+ if (*s != out2) {
ERROR("FindEmulator is broken: %s\n%s\nvs\n%s",
- cmd.c_str(), sorted.c_str(), out2.c_str());
+ cmd.c_str(), s->c_str(), out2.c_str());
}
}
#endif
@@ -542,7 +534,7 @@ void ShellFunc(const vector<Value*>& args, Evaluator* ev, string* s) {
string out;
FindCommand* fc = NULL;
- ShellFuncImpl(*shell, *cmd, is_file_list_command, &out, &fc);
+ ShellFuncImpl(*shell, *cmd, &out, &fc);
if (is_file_list_command) {
FileListCommand* flc = new FileListCommand();
flc->cmd = *cmd;